Browse Source

commit server login code

superbee 8 years ago
commit
bb81590099
100 changed files with 49340 additions and 0 deletions
  1. 5 0
      .buildpath
  2. 28 0
      .project
  3. 2 0
      .settings/org.eclipse.php.core.prefs
  4. 7 0
      .settings/org.eclipse.wst.common.project.facet.core.xml
  5. 54 0
      Application/Base/Controller/BaseController.class.php
  6. 96 0
      Application/Common/Common/function.php
  7. 1 0
      Application/Common/Common/index.html
  8. 29 0
      Application/Common/Conf/config.php
  9. 1 0
      Application/Common/Conf/index.html
  10. 1 0
      Application/Common/index.html
  11. 5 0
      Application/Home/Conf/config.php
  12. 11 0
      Application/Home/Controller/IndexController.class.php
  13. 70 0
      Application/Home/Controller/LoginController.class.php
  14. 26 0
      Application/Home/Controller/UserController.class.php
  15. 92 0
      Application/Home/View/Login/login.html
  16. 0 0
      Application/Home/View/layout.html
  17. 1 0
      Application/Home/index.html
  18. 45 0
      Application/Runtime/Cache/Home/16c44e53d6e2fcc003545821ebcd7fe4.php
  19. 1 0
      Application/Runtime/Cache/Home/20914c0f075f91df3579ffbdf5180b02.php
  20. 92 0
      Application/Runtime/Cache/Home/50c9f5d2ef37c2cf131d5cf1381d3a4b.php
  21. 1 0
      Application/Runtime/Cache/Home/index.html
  22. 166 0
      Application/Runtime/Cache/User/c96fd5f14bf4745e88e61fb19c700d33.php
  23. 1 0
      Application/Runtime/Cache/index.html
  24. 1 0
      Application/Runtime/Data/index.html
  25. 1313 0
      Application/Runtime/Logs/Home/17_02_12.log
  26. 1 0
      Application/Runtime/Logs/Home/index.html
  27. 25 0
      Application/Runtime/Logs/User/17_02_12.log
  28. 1 0
      Application/Runtime/Logs/index.html
  29. 1 0
      Application/Runtime/Temp/index.html
  30. 1 0
      Application/Runtime/index.html
  31. 48 0
      Application/User/Controller/UserController.class.php
  32. 105 0
      Application/User/Model/AdminModel.class.php
  33. 115 0
      Application/User/Model/UserModel.class.php
  34. 0 0
      Application/User/View/User/edit.html
  35. 72 0
      Application/User/View/User/index.html
  36. 4 0
      Application/User/View/layout.html
  37. 373 0
      Public/css/admin.css
  38. 10247 0
      Public/css/amazeui.css
  39. 10269 0
      Public/css/amazeui.flat.css
  40. 0 0
      Public/css/amazeui.flat.min.css
  41. 0 0
      Public/css/amazeui.min.css
  42. 1 0
      Public/css/app.css
  43. BIN
      Public/fonts/FontAwesome.otf
  44. BIN
      Public/fonts/fontawesome-webfont.eot
  45. BIN
      Public/fonts/fontawesome-webfont.ttf
  46. BIN
      Public/fonts/fontawesome-webfont.woff
  47. BIN
      Public/fonts/fontawesome-webfont.woff2
  48. BIN
      Public/i/app-icon72x72@2x.png
  49. BIN
      Public/i/examples/admin-chrome.png
  50. BIN
      Public/i/examples/admin-firefox.png
  51. BIN
      Public/i/examples/admin-ie.png
  52. BIN
      Public/i/examples/admin-opera.png
  53. BIN
      Public/i/examples/admin-safari.png
  54. BIN
      Public/i/examples/adminPage.png
  55. BIN
      Public/i/examples/blogPage.png
  56. BIN
      Public/i/examples/landing.png
  57. BIN
      Public/i/examples/landingPage.png
  58. BIN
      Public/i/examples/loginPage.png
  59. BIN
      Public/i/examples/sidebarPage.png
  60. BIN
      Public/i/favicon.png
  61. BIN
      Public/i/startup-640x1096.png
  62. 2879 0
      Public/js/amazeui.ie8polyfill.js
  63. 1 0
      Public/js/amazeui.ie8polyfill.min.js
  64. 16800 0
      Public/js/amazeui.js
  65. 1 0
      Public/js/amazeui.min.js
  66. 52 0
      Public/js/amazeui.widgets.helper.js
  67. 1 0
      Public/js/amazeui.widgets.helper.min.js
  68. 14 0
      Public/js/app.js
  69. 26 0
      Public/js/handlebars.min.js
  70. 1 0
      Public/js/jquery.min.js
  71. 12 0
      Public/templates/footer.html
  72. 51 0
      Public/templates/header.html
  73. 38 0
      Public/templates/menu.html
  74. 1550 0
      ThinkPHP/Common/functions.php
  75. 167 0
      ThinkPHP/Conf/convention.php
  76. 27 0
      ThinkPHP/Conf/debug.php
  77. 32 0
      ThinkPHP/LICENSE.txt
  78. 51 0
      ThinkPHP/Lang/en-us.php
  79. 51 0
      ThinkPHP/Lang/pt-br.php
  80. 51 0
      ThinkPHP/Lang/zh-cn.php
  81. 51 0
      ThinkPHP/Lang/zh-tw.php
  82. 24 0
      ThinkPHP/Library/Behavior/AgentCheckBehavior.class.php
  83. 42 0
      ThinkPHP/Library/Behavior/BorisBehavior.class.php
  84. 34 0
      ThinkPHP/Library/Behavior/BrowserCheckBehavior.class.php
  85. 87 0
      ThinkPHP/Library/Behavior/BuildLiteBehavior.class.php
  86. 194 0
      ThinkPHP/Library/Behavior/CheckActionRouteBehavior.class.php
  87. 77 0
      ThinkPHP/Library/Behavior/CheckLangBehavior.class.php
  88. 610 0
      ThinkPHP/Library/Behavior/ChromeShowPageTraceBehavior.class.php
  89. 47 0
      ThinkPHP/Library/Behavior/ContentReplaceBehavior.class.php
  90. 66 0
      ThinkPHP/Library/Behavior/CronRunBehavior.class.php
  91. 2079 0
      ThinkPHP/Library/Behavior/FireShowPageTraceBehavior.class.php
  92. 95 0
      ThinkPHP/Library/Behavior/ParseTemplateBehavior.class.php
  93. 117 0
      ThinkPHP/Library/Behavior/ReadHtmlCacheBehavior.class.php
  94. 41 0
      ThinkPHP/Library/Behavior/RobotCheckBehavior.class.php
  95. 119 0
      ThinkPHP/Library/Behavior/ShowPageTraceBehavior.class.php
  96. 69 0
      ThinkPHP/Library/Behavior/ShowRuntimeBehavior.class.php
  97. 54 0
      ThinkPHP/Library/Behavior/TokenBuildBehavior.class.php
  98. 117 0
      ThinkPHP/Library/Behavior/UpgradeNoticeBehavior.class.php
  99. 29 0
      ThinkPHP/Library/Behavior/WriteHtmlCacheBehavior.class.php
  100. 271 0
      ThinkPHP/Library/Org/Net/Http.class.php

+ 5 - 0
.buildpath

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+	<buildpathentry kind="src" path=""/>
+	<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
+</buildpath>

+ 28 - 0
.project

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>garden_server</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.dltk.core.scriptbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.php.core.PHPNature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+	</natures>
+</projectDescription>

+ 2 - 0
.settings/org.eclipse.php.core.prefs

@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+include_path=0;/garden_server

+ 7 - 0
.settings/org.eclipse.wst.common.project.facet.core.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+  <fixed facet="php.component"/>
+  <fixed facet="php.core.component"/>
+  <installed facet="php.core.component" version="1"/>
+  <installed facet="php.component" version="7"/>
+</faceted-project>

+ 54 - 0
Application/Base/Controller/BaseController.class.php

@@ -0,0 +1,54 @@
+<?php
+
+namespace Base\Controller;
+
+use Think\Controller;
+use Admin\Model\ColumnModel;
+
+/**
+ * 基础控制器
+ * @author Superbee
+ *
+ */
+class BaseController extends Controller {
+
+    /**
+     * 初始化模板
+     */
+    public function _initialize() {
+		$this->checkLogin();
+    }
+
+    /**
+     * 检查用户是否登录
+     */
+    private function checkLogin() {
+
+        $admin = $this->getCurrentAdmin();
+
+        if (empty($admin)) {
+            $actionName = strtolower(CONTROLLER_NAME);
+            if (!in_array($actionName, array("login"))) {
+                header("location: " . __APP__ . "/Home/Login/login");
+                exit;
+            }
+        }
+
+//         $this->initMenu();
+    }
+
+    /**
+     * 从session里面获得当前登录的管理员信息
+     */
+    public function getCurrentAdmin() {
+        return isset($_SESSION['admin']) ? session('admin') : null;
+    }
+
+    private function initMenu() {
+        $column = new ColumnModel();
+        $temp = $column->menu();
+
+        $this->assign('menu', $temp);
+    }
+
+}

+ 96 - 0
Application/Common/Common/function.php

@@ -0,0 +1,96 @@
+<?php
+
+	/**
+	 * 获取服务器当前时间
+	 * @return string 时间
+	 */
+	function getCurrentTime(){
+		return date("Y-m-d H:i:s", time());
+	}
+	
+	/**
+	 * 验证码检查
+	 * @param string $code 传入验证码
+	 * @param string $id 验证码id
+	 * @return boolean
+	 */
+	function checkVerify($code, $id = ""){
+		$verify = new \Think\Verify();
+		return $verify->check($code, $id);
+	}
+	
+	/**
+	 * 基础分页的相同代码封装,使前台的代码更少
+	 * @param $m 模型类,引用传递
+	 * @param $where 查询条件
+	 * @param int $pageSize 每页查询条数
+	 * @return \Think\Page
+	 */
+	function getPages($module, $where, $pageSize = 15){
+		$m = clone $module;	//浅复制一个模型
+		$count = $module->where($where)->count();	//连惯操作后会对join等操作进行重置
+		$module = $m;	//为保持在为定的连惯操作,浅复制一个模型
+		$p = new Think\Page($count,$pageSize);
+		$p->lastSuffix = false;
+		$p->setConfig('header','<span class="rows">共<b>%TOTAL_ROW%</b>条记录&nbsp;&nbsp;第<b>%NOW_PAGE%</b>页/共<b>%TOTAL_PAGE%</b>页</span>');
+		$p->setConfig('prev','上一页');
+		$p->setConfig('next','下一页');
+		$p->setConfig('last','末页');
+		$p->setConfig('first','首页');
+		$p->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
+	
+		$p->parameter=I('get.');
+	
+		$m->limit($p->firstRow,$p->listRows);
+	
+		return $p;
+	}
+	
+	/**
+	 * 发送HTTP请求方法
+	 * @param  string $url    请求URL
+	 * @param  array  $params 请求参数
+	 * @param  string $method 请求方法GET/POST
+	 * @return array  $data   响应数据
+	 */
+	function http($url, $params, $method = 'GET', $header = array(), $multi = false){
+		$opts = array(
+				CURLOPT_TIMEOUT        => 30,
+				CURLOPT_RETURNTRANSFER => 1,
+				CURLOPT_SSL_VERIFYPEER => false,
+				CURLOPT_SSL_VERIFYHOST => false,
+				CURLOPT_HTTPHEADER     => $header
+		);
+		/* 根据请求类型设置特定参数 */
+		switch(strtoupper($method)){
+			case 'GET':
+				$opts[CURLOPT_URL] = $url . '?' . http_build_query($params);
+				break;
+			case 'POST':
+				//判断是否传输文件
+				$params = $multi ? $params : http_build_query($params);
+				$opts[CURLOPT_URL] = $url;
+				$opts[CURLOPT_POST] = 1;
+				$opts[CURLOPT_POSTFIELDS] = $params;
+				break;
+			default:
+				throw new Exception('不支持的请求方式!');
+		}
+		/* 初始化并执行curl请求 */
+		$ch = curl_init();
+		curl_setopt_array($ch, $opts);
+		$data  = curl_exec($ch);
+		$error = curl_error($ch);
+		curl_close($ch);
+		if($error) throw new Exception('请求发生错误:' . $error);
+		return  $data;
+	}
+	
+	function decode(){
+		
+	}
+	
+	function getId(){
+		return 0;
+	}
+	

+ 1 - 0
Application/Common/Common/index.html

@@ -0,0 +1 @@
+ 

+ 29 - 0
Application/Common/Conf/config.php

@@ -0,0 +1,29 @@
+<?php
+
+define("PAGE_ROW", 15);			// 显示页面行数
+
+return array(
+		// '配置项'=>'配置值'
+		'DB_TYPE'      =>  'mysql',     	// 数据库类型
+		'DB_HOST'      =>  '127.0.0.1',     // 服务器地址
+		'DB_NAME'      =>  'garden',    		// 数据库名
+		'DB_USER'      =>  'root',    		// 用户名
+		'DB_PWD'       =>  'root',     		// 密码
+		'DB_PORT'      =>  '3306',     		// 端口
+		'DB_PREFIX'    =>  'gd_',     		// 数据库表前缀
+		'DB_DSN'       =>  '',     			// 数据库连接DSN 用于PDO方式
+		'DB_CHARSET'   =>  'utf8', 			// 数据库的编码 默认为utf8
+
+		'LAYOUT_ON'			=> true, 		// 启用布局
+		'URL_MODEL'			=> 0, 			// URL模式
+		'SESSION_AUTO_START'=> true, 		// 是否开启session
+		'VAR_PAGE'			=> 'page',		// 分页参数
+		'URL_CASE_INSENSITIVE' =>true,		// URL访问路径忽略大小写
+		
+		'IMAGE_EXTS'		=>  array('jpg', 'gif', 'png', 'jpeg'), // 图片格式
+		'IMAGE_SAVEPATH'	=>  'images/', // 图片保存路径
+		'UPLOAD_PATH'		=>	'Public/uploads/', // 图片文件路径
+		
+		'PLUS'		=> 0,	// 增加
+		'REDUCE' 	=> 1,	// 减少
+);

+ 1 - 0
Application/Common/Conf/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
Application/Common/index.html

@@ -0,0 +1 @@
+ 

+ 5 - 0
Application/Home/Conf/config.php

@@ -0,0 +1,5 @@
+<?php
+return array(
+	//'配置项'=>'配置值'
+		'LAYOUT_ON'			=> false, 		// 启用布局
+);

+ 11 - 0
Application/Home/Controller/IndexController.class.php

@@ -0,0 +1,11 @@
+<?php
+namespace Home\Controller;
+use Think\Controller;
+use Base\Controller\BaseController;
+
+class IndexController extends BaseController {
+	
+    public function index(){
+        
+    }
+}

+ 70 - 0
Application/Home/Controller/LoginController.class.php

@@ -0,0 +1,70 @@
+<?php
+namespace Home\Controller;
+use Base\Controller\BaseController;
+use User\Model\AdminModel;
+use Think\Verify;
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * 登录控制器
+ */
+class LoginController extends BaseController {
+	
+	private $adminModel;
+	
+	public function _initialize(){
+		$this->adminModel = new AdminModel();
+	}
+
+
+    public function login() {
+    	layout(false);
+    	
+        if (IS_POST) {
+        	$res = checkVerify(I('verify'));
+	       	if(empty($res)){
+	       		$this->error('验证码错误', __APP__.'/Home/Login/login', 2);
+	       		exit;
+	       	}
+        	
+        	if(empty(I('username')) || empty(I('password'))){
+        		$this->error('用户名或者密码不能为空', __APP__.'/Home/Login/login', 2);
+        		exit;
+        	}
+        	
+        	$admin = $this->adminModel->onLogin();
+        	if(empty($admin)) {
+        		$this->error('用户名或者密码错误', __APP__.'/Home/Login/login', 2);
+        		exit;
+        	}
+        	
+        	session('admin', $admin);
+        	header("location: " . __APP__ . "/User/User/index");
+        	exit;
+        }
+        
+        $this->display();
+    }
+    
+    
+    public function createVerify(){
+    	$Verify = new Verify();
+    	$Verify->fontSize = 20;
+    	$Verify->length   = 4;
+    	$Verify->useNoise = false;
+    	$Verify->imageW = 150;
+    	$Verify->imageH = 50;
+    	$Verify->entry();
+    }
+    
+    public function outLogin(){
+    	session(null);
+    	layout(false);
+    	$this->display("login");
+    }
+
+}

+ 26 - 0
Application/Home/Controller/UserController.class.php

@@ -0,0 +1,26 @@
+<?php
+namespace Home\Controller;
+
+use Think\Controller;
+use User\Model\UserModel;
+
+class UserController extends Controller{
+	private $userModel;
+	
+	public function __construct(){
+				
+		
+		$this->userModel = new UserModel();
+	}
+	
+	
+	public function login(){
+		$data = decode();
+		$uid = "temp";
+		
+		$info = $this->userModel->loginByUid(uid);
+		
+		return $this->ajaxReturn($info);		
+	}
+	
+}

+ 92 - 0
Application/Home/View/Login/login.html

@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+  <meta charset="UTF-8">
+  <title>后台登录</title>
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <meta name="format-detection" content="telephone=no">
+  <meta name="renderer" content="webkit">
+  <meta http-equiv="Cache-Control" content="no-siteapp" />
+  <link rel="alternate icon" type="image/png" href="/shop/Public/i/favicon.png">
+  <link rel="stylesheet" href="/shop/Public/css/amazeui.min.css"/>
+  <load href="__ROOT__/Public/js/jquery.min.js"/>
+  <style>
+    .main_box {
+	    position: absolute; top:50%; left:50%; 
+	    margin-left: -300px; padding: 30px; width:600px; height:460px;
+	    border-radius: 10px;
+	}
+	.main_box .setting {position: absolute; top: 5px; right: 10px; width: 10px; height: 10px;}
+	.main_box .setting a {color: #FF6600;}
+	.main_box .setting a:hover {color: #555;}
+	.login_logo {margin-bottom: 20px; height: 45px; text-align: center;}
+	.login_logo img {height: 45px;}
+	.login_msg {text-align: center; font-size: 16px;}
+	.login_form {padding-top: 20px; font-size: 16px;}
+	.login_box .form-control {display: inline-block; *display: inline; zoom: 1; width: auto; font-size: 18px;}
+	.login_box .form-control.x319 {width: 319px;}
+	.login_box .form-control.x164 {width: 164px;}
+	.login_box .form-group {margin-bottom: 20px;}
+	.login_box .form-group label.t {width: 120px; text-align: right; cursor: pointer;}
+	.login_box .form-group.space {padding-top: 15px; border-top: 1px #FFF dotted;}
+	.login_box .form-group img {margin-top: 1px; height: 32px; width:150px; vertical-align: top;}
+	.login_box .m {cursor: pointer;}
+	.bottom {text-align: center; font-size: 12px;}
+  </style>
+</head>
+
+<body>
+<div class="page-container">
+	<div class="main_box">
+		<div class="login_box">
+			<div class="login_logo">
+				<!-- <img src="images/logo.png" > -->
+			</div>
+			<div class="login_form">
+				<form action="login" id="login_form" method="post">
+					<div class="form-group">
+						<label for="name" class="t">用户名:</label> 
+						<input id="name" value="" name="username" type="text" class="form-control x319 in" autocomplete="off">
+					</div>
+					<div class="form-group">
+						<label for="password" class="t">密 码:</label> 
+						<input id="password" value="" name="password" type="password" class="password form-control x319 in">
+					</div>
+					<div class="form-group">
+						<label for="verify" class="t">验证码:</label>
+						 <input id="verify" name="verify" type="text" class="form-control x164 in">
+						 <img class="m" id="captcha_img" alt="验证码" src="{:U('Home/Login/createVerify')}" title="点击刷新"/>
+					</div>
+					<div class="form-group">
+						<label class="t"></label>
+						<label for="j_remember" class="m">
+						<input id="j_remember" type="checkbox" value="true">&nbsp;记住登陆账号!</label>
+					</div>
+					<div class="form-group space">
+						<label class="t"></label>   
+						<button type="submit"  id="submit_btn" class="am-btn am-btn-primary am-btn-lg">&nbsp;登&nbsp;录&nbsp; </button>
+						<input type="reset" value="&nbsp;重&nbsp;置&nbsp;" class="am-btn am-btn-default am-btn-lg">
+					</div>
+				</form>
+			</div>
+		</div>
+		<div class="bottom">Copyright &copy; {:date('Y')}<a href="#">系统登陆</a></div>
+	</div>
+</div>
+
+<script>
+	var captcha_img = $('#captcha_img');
+	var verifyimg = captcha_img.attr("src");  
+	captcha_img.attr('title', '点击刷新');  
+	captcha_img.click(function(){  
+	    if( verifyimg.indexOf('?')>0){  
+	        $(this).attr("src", verifyimg+'&random='+Math.random());  
+	    }else{  
+	        $(this).attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());  
+	    }  
+	}); 
+</script>
+
+</body>
+</html>

+ 0 - 0
Application/Home/View/layout.html


+ 1 - 0
Application/Home/index.html

@@ -0,0 +1 @@
+ 

+ 45 - 0
Application/Runtime/Cache/Home/16c44e53d6e2fcc003545821ebcd7fe4.php

@@ -0,0 +1,45 @@
+<?php if (!defined('THINK_PATH')) exit(); if(C('LAYOUT_ON')) { echo ''; } ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>跳转提示</title>
+<style type="text/css">
+*{ padding: 0; margin: 0; }
+body{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16px; }
+.system-message{ padding: 24px 48px; }
+.system-message h1{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; }
+.system-message .jump{ padding-top: 10px}
+.system-message .jump a{ color: #333;}
+.system-message .success,.system-message .error{ line-height: 1.8em; font-size: 36px }
+.system-message .detail{ font-size: 12px; line-height: 20px; margin-top: 12px; display:none}
+</style>
+</head>
+<body>
+<div class="system-message">
+<?php if(isset($message)) {?>
+<h1>:)</h1>
+<p class="success"><?php echo($message); ?></p>
+<?php }else{?>
+<h1>:(</h1>
+<p class="error"><?php echo($error); ?></p>
+<?php }?>
+<p class="detail"></p>
+<p class="jump">
+页面自动 <a id="href" href="<?php echo($jumpUrl); ?>">跳转</a> 等待时间: <b id="wait"><?php echo($waitSecond); ?></b>
+</p>
+</div>
+<script type="text/javascript">
+(function(){
+var wait = document.getElementById('wait'),href = document.getElementById('href').href;
+var interval = setInterval(function(){
+	var time = --wait.innerHTML;
+	if(time <= 0) {
+		location.href = href;
+		clearInterval(interval);
+	};
+}, 1000);
+})();
+</script>
+</body>
+</html>

+ 1 - 0
Application/Runtime/Cache/Home/20914c0f075f91df3579ffbdf5180b02.php

@@ -0,0 +1 @@
+<?php if (!defined('THINK_PATH')) exit();?>

+ 92 - 0
Application/Runtime/Cache/Home/50c9f5d2ef37c2cf131d5cf1381d3a4b.php

@@ -0,0 +1,92 @@
+<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
+<html>
+<head lang="en">
+  <meta charset="UTF-8">
+  <title>后台登录</title>
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <meta name="format-detection" content="telephone=no">
+  <meta name="renderer" content="webkit">
+  <meta http-equiv="Cache-Control" content="no-siteapp" />
+  <link rel="alternate icon" type="image/png" href="/shop/Public/i/favicon.png">
+  <link rel="stylesheet" href="/shop/Public/css/amazeui.min.css"/>
+  <script type="text/javascript" src="/garden_server/Public/js/jquery.min.js"></script>
+  <style>
+    .main_box {
+	    position: absolute; top:50%; left:50%; 
+	    margin-left: -300px; padding: 30px; width:600px; height:460px;
+	    border-radius: 10px;
+	}
+	.main_box .setting {position: absolute; top: 5px; right: 10px; width: 10px; height: 10px;}
+	.main_box .setting a {color: #FF6600;}
+	.main_box .setting a:hover {color: #555;}
+	.login_logo {margin-bottom: 20px; height: 45px; text-align: center;}
+	.login_logo img {height: 45px;}
+	.login_msg {text-align: center; font-size: 16px;}
+	.login_form {padding-top: 20px; font-size: 16px;}
+	.login_box .form-control {display: inline-block; *display: inline; zoom: 1; width: auto; font-size: 18px;}
+	.login_box .form-control.x319 {width: 319px;}
+	.login_box .form-control.x164 {width: 164px;}
+	.login_box .form-group {margin-bottom: 20px;}
+	.login_box .form-group label.t {width: 120px; text-align: right; cursor: pointer;}
+	.login_box .form-group.space {padding-top: 15px; border-top: 1px #FFF dotted;}
+	.login_box .form-group img {margin-top: 1px; height: 32px; width:150px; vertical-align: top;}
+	.login_box .m {cursor: pointer;}
+	.bottom {text-align: center; font-size: 12px;}
+  </style>
+</head>
+
+<body>
+<div class="page-container">
+	<div class="main_box">
+		<div class="login_box">
+			<div class="login_logo">
+				<!-- <img src="images/logo.png" > -->
+			</div>
+			<div class="login_form">
+				<form action="login" id="login_form" method="post">
+					<div class="form-group">
+						<label for="name" class="t">用户名:</label> 
+						<input id="name" value="" name="username" type="text" class="form-control x319 in" autocomplete="off">
+					</div>
+					<div class="form-group">
+						<label for="password" class="t">密 码:</label> 
+						<input id="password" value="" name="password" type="password" class="password form-control x319 in">
+					</div>
+					<div class="form-group">
+						<label for="verify" class="t">验证码:</label>
+						 <input id="verify" name="verify" type="text" class="form-control x164 in">
+						 <img class="m" id="captcha_img" alt="验证码" src="<?php echo U('Home/Login/createVerify');?>" title="点击刷新"/>
+					</div>
+					<div class="form-group">
+						<label class="t"></label>
+						<label for="j_remember" class="m">
+						<input id="j_remember" type="checkbox" value="true">&nbsp;记住登陆账号!</label>
+					</div>
+					<div class="form-group space">
+						<label class="t"></label>   
+						<button type="submit"  id="submit_btn" class="am-btn am-btn-primary am-btn-lg">&nbsp;登&nbsp;录&nbsp; </button>
+						<input type="reset" value="&nbsp;重&nbsp;置&nbsp;" class="am-btn am-btn-default am-btn-lg">
+					</div>
+				</form>
+			</div>
+		</div>
+		<div class="bottom">Copyright &copy; <?php echo date('Y');?><a href="#">系统登陆</a></div>
+	</div>
+</div>
+
+<script>
+	var captcha_img = $('#captcha_img');
+	var verifyimg = captcha_img.attr("src");  
+	captcha_img.attr('title', '点击刷新');  
+	captcha_img.click(function(){  
+	    if( verifyimg.indexOf('?')>0){  
+	        $(this).attr("src", verifyimg+'&random='+Math.random());  
+	    }else{  
+	        $(this).attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());  
+	    }  
+	}); 
+</script>
+
+</body>
+</html>

+ 1 - 0
Application/Runtime/Cache/Home/index.html

@@ -0,0 +1 @@
+ 

+ 166 - 0
Application/Runtime/Cache/User/c96fd5f14bf4745e88e61fb19c700d33.php

@@ -0,0 +1,166 @@
+<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
+<html class="no-js fixed-layout">
+    <head>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <title>花园后台管理</title>
+        <meta name="description" content="花园后台管理">
+        <meta name="keywords" content="index">
+        <meta name="viewport" content="width=device-width, initial-scale=1">
+        <meta name="renderer" content="webkit">
+        <meta http-equiv="Cache-Control" content="no-siteapp" />
+        <link rel="icon" type="image/png" href="/garden_server/Public/i/favicon.png">
+        <link rel="apple-touch-icon-precomposed" href="/garden_server/Public/i/app-icon72x72@2x.png">
+
+    <link rel="stylesheet" type="text/css" href="/garden_server/Public/css/amazeui.css" />
+    <link rel="stylesheet" type="text/css" href="/garden_server/Public/css/admin.css" />
+    <link rel="stylesheet" type="text/css" href="/garden_server/Public/css/app.css" />
+    <script type="text/javascript" src="/garden_server/Public/js/jquery.min.js"></script>
+    <script type="text/javascript" src="/garden_server/Public/js/amazeui.js"></script>
+    <script type="text/javascript" src="/garden_server/Public/js/app.js"></script> 
+
+</head>
+<body>
+
+    <header class="am-topbar am-topbar-inverse admin-header">
+        <div class="am-topbar-brand">
+            <strong>花园后台管理</strong>
+        </div>
+
+        <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>
+
+        <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
+
+            <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list">
+                <li class="am-dropdown" data-am-dropdown>
+                    <a class="am-dropdown-toggle" data-am-dropdown-toggle href="javascript:;">
+                        <span class="am-icon-users"></span> (<?php echo ($_SESSION['admin']['realname']); ?>) <span class="am-icon-caret-down"></span>
+                    </a>
+                    <ul class="am-dropdown-content">
+                        <li><a href="#"><span class="am-icon-user"></span> 资料</a></li>
+                        <li><a href="#"><span class="am-icon-cog"></span> 设置</a></li>
+                        <li><a href="/garden_server/index.php/Home/Login/outLogin"><span class="am-icon-power-off"></span> 退出</a></li>
+                    </ul>
+                </li>
+                <li class="am-hide-sm-only"><a href="javascript:;" id="admin-fullscreen"><span class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>
+            </ul>
+        </div>
+    </header>
+
+
+    <div class="am-cf admin-main">
+<!-- sidebar start -->
+<div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
+    <div class="am-offcanvas-bar admin-offcanvas-bar">
+        <ul class="am-list admin-sidebar-list">
+			<?php if(is_array($menu)): foreach($menu as $k=>$v): if(!isset($v['children'])): ?><li><a href="/garden_server/index.php/<?php echo ($v["url"]); ?>"><span class="am-icon-<?php echo ($v["icon"]); ?>"></span> <?php echo ($v["name"]); ?></a></li>
+            	<?php else: ?>
+            		<li class="admin-parent">
+            		<a class="am-cf" data-am-collapse="{target: '#collapse-nav<?php echo ($v["id"]); ?>'}"><span class="am-icon-<?php echo ($v["icon"]); ?>"></span> <?php echo ($v["name"]); ?><span class="am-icon-angle-right am-fr am-margin-right"></span></a>
+            		<ul class="am-list am-collapse admin-sidebar-sub" id="collapse-nav<?php echo ($v["id"]); ?>">
+            		<?php if(is_array($v["children"])): foreach($v["children"] as $key=>$val): ?><li>
+	                    	<a href="/garden_server/index.php/<?php echo ($val["url"]); ?>"><span class="am-icon-<?php echo ($val["url"]); ?>"></span> <?php echo ($val["name"]); ?>
+	                    	<?php if($val["ispush"] == 1): ?><span class="am-icon-star am-fr am-margin-right admin-icon-yellow"></span><?php endif; ?>
+	                    	</a>
+	                    </li><?php endforeach; endif; ?>	
+                	</ul>
+            		</li><?php endif; endforeach; endif; ?>
+            
+            
+        </ul>
+
+        <div class="am-panel am-panel-default admin-sidebar-panel">
+            <div class="am-panel-bd">
+                <p><span class="am-icon-bookmark"></span> 公告</p>
+                <p>时光静好,与君语;细水流年,与君同。</p>
+            </div>
+        </div>
+    </div>
+</div>
+<!-- sidebar end -->
+
+<!-- content start -->
+<div class="admin-content">
+
+ <div class="admin-content-body">
+      <div class="am-cf am-padding am-padding-bottom-0">
+        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">用户列表</strong> / <small>User</small></div>
+      </div>
+
+      <hr>
+
+      <div class="am-g">
+        <div class="am-u-sm-12 am-u-md-6">
+          <div class="am-btn-toolbar">
+            <div class="am-btn-group am-btn-group-xs">
+              <a type="button" class="am-btn am-btn-default" href="edit"><span class="am-icon-plus"></span> 新增</a>
+            </div>
+          </div>
+        </div>
+        
+<!--        <div class="am-u-sm-12 am-u-md-3">
+          <div class="am-input-group am-input-group-sm">
+            <input type="text" class="am-form-field">
+          <span class="am-input-group-btn">
+            <button class="am-btn am-btn-default" type="button">搜索</button>
+          </span>
+          </div>
+        </div>-->
+        
+      </div>
+
+      <div class="am-g">
+        <div class="am-u-sm-12">
+          <form class="am-form">
+            <table id="datatables" class="am-table am-table-striped am-table-hover table-main">
+              <thead>
+	              <tr>
+	                <th>顺序</th>
+	                <th>UID</th>
+	                <th>钻石</th>
+	                <th>金币</th>
+	                <th class="table-set">操作</th>
+	              </tr>
+              </thead>
+              <tbody>
+              	<?php if(is_array($array)): foreach($array as $k=>$v): ?><tr>
+	                <td><?php echo ($k + 1); ?></td>
+                    <td><?php echo ($v["uid"]); ?></td>
+	                <td><?php echo ($v["diamond"]); ?></td>
+	                <td><?php echo ($v["coin"]); ?></td>
+	                <td>
+	                  <div class="am-btn-toolbar">
+	                    <div class="am-btn-group am-btn-group-xs">
+	                      <a class="my_list_button am-text-secondary" href="edit/id/<?php echo ($v["type_id"]); ?>"><span class="am-icon-pencil-square-o"></span> 用户档案</a>
+	                      <a class="my_list_button am-text-danger" href="remove/id/<?php echo ($v["type_id"]); ?>"><span class="am-icon-trash-o"></span> 删除</a>
+	                    </div>
+	                  </div>
+	                </td>
+	              </tr><?php endforeach; endif; ?>  
+              </tbody>
+            </table>
+            
+            <div class="am-cf">
+              <div class="am-fr">
+                  <div class="pagination"><?php echo ($page); ?></div>
+              </div>
+            </div>
+            <hr />
+            <p>注:.....</p>
+          </form>
+        </div>
+
+      </div>
+</div>      
+	<footer class="admin-content-footer">
+      <hr>
+      <p class="am-padding-left">Copyright © 2016</p>
+    </footer>
+  </div>
+  <!-- content end -->
+
+</div>
+
+<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
+</body>
+</html>

+ 1 - 0
Application/Runtime/Cache/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
Application/Runtime/Data/index.html

@@ -0,0 +1 @@
+ 

+ 1313 - 0
Application/Runtime/Logs/Home/17_02_12.log

@@ -0,0 +1,1313 @@
+[ 2017-02-12T14:30:38+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.002000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_parse ] --START--
+ERR: 模板不存在:./Application/Home/View/layout.html
+
+[ 2017-02-12T14:31:11+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_parse ] --START--
+INFO: [ template_filter ] --START--
+INFO: Run Behavior\ContentReplaceBehavior [ RunTime:0.008500s ]
+INFO: [ template_filter ] --END-- [ RunTime:0.008500s ]
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.018500s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.018500s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T14:32:14+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_parse ] --START--
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.000000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.000000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T14:32:14+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_parse ] --START--
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.000500s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T14:32:15+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+INFO: [ view_parse ] --START--
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.000000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.000000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T14:32:15+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_parse ] --START--
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.000000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.000000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000000s ]
+
+[ 2017-02-12T14:32:15+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_parse ] --START--
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.000000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.000000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T14:33:00+08:00 ] ::1 /garden_server/index.php/Home/Index/index
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_parse ] --START--
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.000000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.000000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:08:54+08:00 ] ::1 /garden_server/index.php/Home/Index/index
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_parse ] --START--
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.000500s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:08:58+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_parse ] --START--
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.000500s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.000500s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000000s ]
+
+[ 2017-02-12T16:09:35+08:00 ] ::1 /garden_server/index.php/Home/Login/login
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+ERR: Class 'Admin\Model\AdminModel' not found
+
+[ 2017-02-12T16:09:50+08:00 ] ::1 /garden_server/index.php/Home/Login/login
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+ERR: 1146:Table 'garden.gd_admin' doesn't exist
+ [ SQL语句 ] : SHOW COLUMNS FROM `gd_admin`
+ERR: 1146:Table 'garden.gd_admin' doesn't exist
+ [ SQL语句 ] : SHOW COLUMNS FROM `gd_admin`
+
+[ 2017-02-12T16:10:31+08:00 ] ::1 /garden_server/index.php/Home/Login/login
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.001000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.001000s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ view_parse ] --START--
+INFO: [ template_filter ] --START--
+INFO: Run Behavior\ContentReplaceBehavior [ RunTime:0.000500s ]
+INFO: [ template_filter ] --END-- [ RunTime:0.000500s ]
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.007000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.007000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000000s ]
+
+[ 2017-02-12T16:10:50+08:00 ] ::1 /garden_server/index.php/Home/Login/login
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ view_parse ] --START--
+INFO: [ template_filter ] --START--
+INFO: Run Behavior\ContentReplaceBehavior [ RunTime:0.000000s ]
+INFO: [ template_filter ] --END-- [ RunTime:0.000000s ]
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.004500s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.004500s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:10:50+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:00+08:00 ] ::1 /garden_server/index.php/Home/Login/login
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ view_parse ] --START--
+INFO: [ template_filter ] --START--
+INFO: Run Behavior\ContentReplaceBehavior [ RunTime:0.000500s ]
+INFO: [ template_filter ] --END-- [ RunTime:0.000500s ]
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.004000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.004000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:00+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:01+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.3050146225311219
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:02+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.1877933604327
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:03+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.3574479262357295
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:03+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.19626986853631778
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:03+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.8159234529682504
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:04+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.7704984887210682
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000000s ]
+
+[ 2017-02-12T16:11:04+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.32698695606501893
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000000s ]
+
+[ 2017-02-12T16:11:04+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.2135134035022328
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000000s ]
+
+[ 2017-02-12T16:11:05+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.7973355032622995
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:05+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.33191391793046043
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:05+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.8986673760669375
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0010s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:05+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify&random=0.328502385536239
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:11:16+08:00 ] ::1 /garden_server/index.php/Home/Login/login
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0005s ]
+INFO: [ view_parse ] --START--
+INFO: [ template_filter ] --START--
+INFO: Run Behavior\ContentReplaceBehavior [ RunTime:0.000000s ]
+INFO: [ template_filter ] --END-- [ RunTime:0.000000s ]
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.010000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.010000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000000s ]
+
+[ 2017-02-12T16:11:18+08:00 ] ::1 /garden_server/index.php/Home/Login/login
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0005s ]
+INFO: [ view_parse ] --START--
+INFO: [ template_filter ] --START--
+INFO: Run Behavior\ContentReplaceBehavior [ RunTime:0.000000s ]
+INFO: [ template_filter ] --END-- [ RunTime:0.000000s ]
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.004000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.004000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000000s ]
+
+[ 2017-02-12T16:11:18+08:00 ] ::1 /garden_server/index.php?m=Home&c=Login&a=createVerify
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.001000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.001000s ]
+
+[ 2017-02-12T16:11:54+08:00 ] ::1 /garden_server/index.php/Home/Login/login
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\AdminModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\AdminModel.class.php 第 10 行.
+SQL: SHOW COLUMNS FROM `gd_admin` [ RunTime:0.0000s ]
+SQL: SELECT * FROM `gd_admin` WHERE `password` = 'e10adc3949ba59abbe56e057f20f883e' LIMIT 1   [ RunTime:0.0000s ]
+
+[ 2017-02-12T16:12:47+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+INFO: [ view_parse ] --START--
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.000000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.000000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:13:35+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000000s ]
+
+[ 2017-02-12T16:14:06+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:14:12+08:00 ] ::1 /garden_server/index.php
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:15:46+08:00 ] ::1 /garden_server/index.php?m=home&a=login&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+NOTIC: [8] Use of undefined constant uid - assumed 'uid' F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 21 行.
+SQL: SELECT * FROM `gd_user` WHERE `uid` = 'uid' LIMIT 1   [ RunTime:0.0000s ]
+SQL: INSERT INTO `gd_user` (`id`,`uid`,`registertime`) VALUES ('0','uid','2017-02-12 16:15:46') [ RunTime:0.0450s ]
+
+[ 2017-02-12T16:19:22+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0010s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:25+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0010s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:25+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:25+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0010s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:26+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0010s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.001000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.001000s ]
+
+[ 2017-02-12T16:19:26+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:26+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:26+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:26+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0010s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:27+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0010s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:27+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0010s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:19:27+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+NOTIC: [8] Undefined index: LOCAL_ADDR F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 32 行.
+NOTIC: [8] Undefined index: LOCAL_PORT F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 33 行.
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:34:26+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0010s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:34:27+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.001000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.001000s ]
+
+[ 2017-02-12T16:34:28+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:34:28+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:34:28+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.001000s ]
+
+[ 2017-02-12T16:34:28+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:34:29+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:34:29+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:10+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:11+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:11+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:11+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:12+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:12+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:12+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:12+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:13+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.001000s ]
+
+[ 2017-02-12T16:36:13+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:13+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:13+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:14+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:14+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:14+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:14+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:15+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.001000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.001000s ]
+
+[ 2017-02-12T16:36:15+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:15+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:15+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:15+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:16+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:16+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.001000s ]
+
+[ 2017-02-12T16:36:16+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:16+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:36:16+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:44:19+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:44:20+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:44:20+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:44:20+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:44:20+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:44:20+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:44:21+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:44:21+08:00 ] ::1 /garden_server/index.php?m=home&a=uid&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0005s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000500s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000500s ]
+
+[ 2017-02-12T16:53:57+08:00 ] ::1 /garden_server/index.php?m=home&a=login&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.001000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.001000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+NOTIC: [8] Use of undefined constant uid - assumed 'uid' F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 21 行.
+SQL: SELECT * FROM `gd_user` WHERE `uid` = 'uid' LIMIT 1   [ RunTime:0.0010s ]
+
+[ 2017-02-12T16:54:15+08:00 ] ::1 /garden_server/index.php?m=home&a=login&c=user
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000000s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0000s ]
+NOTIC: [8] Use of undefined constant uid - assumed 'uid' F:\User\workspace\garden_server\Application\Home\Controller\UserController.class.php 第 21 行.
+SQL: SELECT * FROM `gd_user` WHERE `uid` = 'uid' LIMIT 1   [ RunTime:0.0000s ]
+NOTIC: [2] Illegal offset type in isset or empty F:\User\workspace\garden_server\ThinkPHP\Library\Think\Model.class.php 第 445 行.
+SQL: UPDATE `gd_user` SET `last_login`='2017-02-12 16:54:15' WHERE `id` = '456' [ RunTime:0.0300s ]
+

+ 1 - 0
Application/Runtime/Logs/Home/index.html

@@ -0,0 +1 @@
+ 

+ 25 - 0
Application/Runtime/Logs/User/17_02_12.log

@@ -0,0 +1,25 @@
+[ 2017-02-12T16:11:54+08:00 ] ::1 /garden_server/index.php/User/User/index
+INFO: [ app_init ] --START--
+INFO: Run Behavior\BuildLiteBehavior [ RunTime:0.000000s ]
+INFO: [ app_init ] --END-- [ RunTime:0.000500s ]
+INFO: [ app_begin ] --START--
+INFO: Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000500s ]
+INFO: [ app_begin ] --END-- [ RunTime:0.000500s ]
+NOTIC: [2] Declaration of User\Model\UserModel::add() should be compatible with Think\Model::add($data = '', $options = Array, $replace = false) F:\User\workspace\garden_server\Application\User\Model\UserModel.class.php 第 11 行.
+SQL: SHOW COLUMNS FROM `gd_user` [ RunTime:0.0010s ]
+SQL: SELECT * FROM `gd_user` LIMIT 0,15   [ RunTime:0.0000s ]
+SQL: SELECT COUNT(*) AS tp_count FROM `gd_user` LIMIT 1   [ RunTime:0.0360s ]
+INFO: [ view_parse ] --START--
+INFO: [ template_filter ] --START--
+INFO: Run Behavior\ContentReplaceBehavior [ RunTime:0.000000s ]
+INFO: [ template_filter ] --END-- [ RunTime:0.000000s ]
+NOTIC: [8] Undefined variable: menu F:\User\workspace\garden_server\Application\Runtime\Cache\User\c96fd5f14bf4745e88e61fb19c700d33.php 第 56 行.
+INFO: Run Behavior\ParseTemplateBehavior [ RunTime:0.005000s ]
+INFO: [ view_parse ] --END-- [ RunTime:0.005000s ]
+INFO: [ view_filter ] --START--
+INFO: Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000000s ]
+INFO: [ view_filter ] --END-- [ RunTime:0.000000s ]
+INFO: [ app_end ] --START--
+INFO: Run Behavior\ShowPageTraceBehavior [ RunTime:0.000000s ]
+INFO: [ app_end ] --END-- [ RunTime:0.000000s ]
+

+ 1 - 0
Application/Runtime/Logs/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
Application/Runtime/Temp/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
Application/Runtime/index.html

@@ -0,0 +1 @@
+ 

+ 48 - 0
Application/User/Controller/UserController.class.php

@@ -0,0 +1,48 @@
+<?php
+namespace User\Controller;
+use Base\Controller\BaseController;
+use User\Model\UserModel;
+
+/**
+ * 用户控制器
+ * @author Superbee
+ *
+ */
+class UserController extends BaseController {
+	
+	private $userModel;
+	
+	public function _initialize(){
+		parent::_initialize();
+		
+		$this->userModel = new UserModel();
+	}
+	
+    public function index(){
+    	$page = I('get.page');
+    	$info = $this->userModel->getInfo($page);
+    	$p = $this->userModel->getPages();
+    	
+    	$this->assign("array", $info);
+    	$this->assign("page", $p);
+    	$this->display('index');
+    }
+    
+    public function edit(){
+    	$id = I('get.id');
+    	$info = $this->userModel->getUserById($id);
+    	$action = ($info)?'update':'add';
+    	
+    	$this->assign('action', $action);
+    	$this->assign("info", $info);
+    	$this->display('edit');
+    }
+    
+    public function update(){
+    	
+    }
+    
+    public function remove(){
+    	
+    }
+}

+ 105 - 0
Application/User/Model/AdminModel.class.php

@@ -0,0 +1,105 @@
+<?php
+namespace User\Model;
+use Think\Model;
+
+/**
+ * 管理员模型
+ * @author Superbee
+ *
+ */
+class AdminModel extends Model{
+	
+	protected $fields = array('id', 'name', 'password', 'realname', 'last_login' , 'last_ip', 
+			'_pk' => 'id', '_autoinc' => true);
+	
+	protected $rule = array(
+			array('username', 'require', '用户名不能为空!', 1),
+			// 正则验证密码 [需包含字母数字以及@*#中的一种,长度为6-22位]			
+			array('password', '/^([a-zA-Z0-9@*#]{6,22})$/', '密码格式不正确,请重新输入!', 1),
+			array('verify','require','验证码必须!'),  // 都有时间都验证
+			array('verify','checkVerify','验证码错误',0, 'function'),
+	);
+	
+	protected $_auto = array(
+			array('password','md5',3,'function') , // 对password字段在新增和编辑的时候使md5函数处理 
+	);
+	
+	public function __construct(){
+		$this->dbName = 'admin';	// 表名
+		$this->db = M($this->dbName);
+	}
+        
+        public function getAdminList(){
+        
+            return $this->db->alias('a')->join('jj_admintype as b on(a.type_id=b.type_id)')->select();
+        }
+	
+	/**
+	 * 获取页码当前标签
+	 * @param array $where
+	 * @param int $page
+	 * @return \Think\mixed
+	 */
+	public function getInfo($page=0, $where=array()){
+		return $this->db->where($where)->page(0, PAGE_ROW)->select();
+	}
+	
+	/**
+	 * 获取分页信息
+	 * @param array $where 查询条件
+	 * @return string
+	 */
+	public function getPages($where=array()){
+		$p = getPages($this->db, $where, PAGE_ROW);
+		return $p->show();
+	}
+	
+	/**
+	 * 根据id找到人员
+	 * @param int $id
+	 * @return mixed|boolean|NULL|string|unknown|object
+	 */
+	public function getAdminById($id){
+		return $this->db->where(array('id'=>$id))->find();
+	}
+
+	/**
+	 * 登录判断
+	 */
+	public function onLogin(){
+		$name = I('name');
+		$password = I('password');
+		$where = array('username'=>$name, 'password'=>md5($password));
+		$res = $this->db->where($where)->find();
+		
+		if($res){
+			$this->db->save(array('last_login'=>getCurrentTime()));
+		}
+		
+		return $res;
+	}
+	
+	
+	
+	/**
+	 * 修改密码
+	 * @param int $id 管理员id
+	 * @param string $pwd 新密码
+	 */
+	public function modifyPwd($id, $pwd){
+		return $this->db->where(array('id'=>$id))->save(array('password'=>md5($pwd)));
+	}
+	
+	public function update(){
+		$data = $this->db->create();
+		return $this->db->save($data);
+	}
+	
+	public function add(){
+		$data = $this->db->create();
+       	$data['password']=md5($data['password']);
+		return $this->db->add($data);
+	}
+	
+	
+}

+ 115 - 0
Application/User/Model/UserModel.class.php

@@ -0,0 +1,115 @@
+<?php
+namespace User\Model;
+use Think\Model;
+use Org\Net\Http;
+
+/**
+ * 用户模型
+ * @author Superbee
+ *
+ */
+class UserModel extends Model {
+	
+    protected $fields = array('id', 'uid', 'diamond', 'nickname', 'coin', 'mobile', 'last_login', 'registertime', 
+        '_pk' => 'id', '_autoinc' => false);
+    
+    protected $_validate = array(
+        array('nickname', 'require', '昵称不能为空!'), //默认情况下用正则进行验证
+        array('mobile', '', '该手机号码已被占用', 0, 'unique', 1), // 新增的时候mobile字段是否唯一
+        // 正则验证密码 [需包含字母数字以及@*#中的一种,长度为6-22位]
+        array('password', '/^([a-zA-Z0-9@*#]{6,22})$/', '密码格式不正确,请重新输入!', 0),
+        array('repassword', 'password', '确认密码不正确', 0, 'confirm'), // 验证确认密码是否和密码一致
+        array('mobile', '/^1[34578]/d{9}$/', '手机号码格式不正确', 0), // 正则表达式验证手机号
+    );
+    
+    protected $_auto = array(
+        array('password', 'md5', 3, 'function'), // 对password字段在新增和编辑的时候使md5函数处理
+        array('regdate', 'time', 1, 'function'), // 对regdate字段在新增的时候写入当前时间戳
+        array('regip', 'get_client_ip', 1, 'function'), // 对regip字段在新增的时候写入当前注册ip地址
+    );
+    
+    
+    public function __construct(){
+    	$this->dbName = "user";
+    	$this->db = M($this->dbName);
+    }
+    
+    /**
+     * 获取页码当前信息
+     * @param array $where
+     * @param int $page
+     * @return \Think\mixed
+     */
+    public function getInfo($page = 0, $where = array()) {
+        return $this->db->where($where)->page(0, PAGE_ROW)->select();
+    }
+    
+    /**
+     * 获取分页信息
+     * @param array $where 查询条件
+     * @return string
+     */
+    public function getPages($where = array()) {
+    	$p = getPages($this->db, $where, PAGE_ROW);
+    	return $p->show();
+    }
+    
+    /**
+     * 根据id找到用户
+     * @param int $id
+     * @return \Think\mixed
+     */
+    public function getUserById($id) {
+    	return $this->db->where(array("id" => $id))->find();
+    }
+    
+    /**
+     * 利用UID登陆,如果UID不存在则创建新的用户
+     * @param string $uid 登陆唯一码
+     * @return array
+     */
+    public function loginByUid($uid){
+    	$data = array();
+    	$id = 0;
+    	$info = $this->db->where(array("uid"=>$uid))->find();
+    	
+    	if($info){
+    		$data['d'] = $info['diamond'];
+    		$data['c'] = $info['coin'];
+    		$id = $info['id'];
+    	}else{
+    		$data['d'] = 0;
+    		$data['c'] = 0;
+    		$id = $this->createUser($uid);
+    	}
+    	
+    	if($id)
+    		$this->db->where(array('id'=>$id))->save(array('last_login'=>getCurrentTime()));	// 更新最后登陆时间
+    	
+    	return $data;
+    }
+    
+    /**
+     * 创建新用户
+     * @param string $uid
+     */
+    private function createUser($uid){
+    	$data = array('id'=>getId(), 'uid'=>$uid, 'registertime'=>getCurrentTime());
+    	$this->db->add($data);
+    	return $data['id'];
+    }
+    
+    
+	public function update(){
+		$data = $this->db->create();
+		return $this->db->save($data);
+	}
+	
+	public function add(){
+		$data = $this->db->create();
+		return $this->db->add($data);
+	}
+    
+}
+
+

+ 0 - 0
Application/User/View/User/edit.html


+ 72 - 0
Application/User/View/User/index.html

@@ -0,0 +1,72 @@
+ <div class="admin-content-body">
+      <div class="am-cf am-padding am-padding-bottom-0">
+        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">用户列表</strong> / <small>User</small></div>
+      </div>
+
+      <hr>
+
+      <div class="am-g">
+        <div class="am-u-sm-12 am-u-md-6">
+          <div class="am-btn-toolbar">
+            <div class="am-btn-group am-btn-group-xs">
+              <a type="button" class="am-btn am-btn-default" href="edit"><span class="am-icon-plus"></span> 新增</a>
+            </div>
+          </div>
+        </div>
+        
+<!--        <div class="am-u-sm-12 am-u-md-3">
+          <div class="am-input-group am-input-group-sm">
+            <input type="text" class="am-form-field">
+          <span class="am-input-group-btn">
+            <button class="am-btn am-btn-default" type="button">搜索</button>
+          </span>
+          </div>
+        </div>-->
+        
+      </div>
+
+      <div class="am-g">
+        <div class="am-u-sm-12">
+          <form class="am-form">
+            <table id="datatables" class="am-table am-table-striped am-table-hover table-main">
+              <thead>
+	              <tr>
+	                <th>顺序</th>
+	                <th>UID</th>
+	                <th>钻石</th>
+	                <th>金币</th>
+	                <th class="table-set">操作</th>
+	              </tr>
+              </thead>
+              <tbody>
+              	<foreach name="array" key="k" item="v">
+	              <tr>
+	                <td>{$k + 1}</td>
+                    <td>{$v.uid}</td>
+	                <td>{$v.diamond}</td>
+	                <td>{$v.coin}</td>
+	                <td>
+	                  <div class="am-btn-toolbar">
+	                    <div class="am-btn-group am-btn-group-xs">
+	                      <a class="my_list_button am-text-secondary" href="edit/id/{$v.type_id}"><span class="am-icon-pencil-square-o"></span> 用户档案</a>
+	                      <a class="my_list_button am-text-danger" href="remove/id/{$v.type_id}"><span class="am-icon-trash-o"></span> 删除</a>
+	                    </div>
+	                  </div>
+	                </td>
+	              </tr>
+	            </foreach>  
+              </tbody>
+            </table>
+            
+            <div class="am-cf">
+              <div class="am-fr">
+                  <div class="pagination">{$page}</div>
+              </div>
+            </div>
+            <hr />
+            <p>注:.....</p>
+          </form>
+        </div>
+
+      </div>
+</div>      

+ 4 - 0
Application/User/View/layout.html

@@ -0,0 +1,4 @@
+<include file="./Public/templates/header.html" />
+<include file="./Public/templates/menu.html" />
+{__CONTENT__}
+<include file="./Public/templates/footer.html" />

+ 373 - 0
Public/css/admin.css

@@ -0,0 +1,373 @@
+/**
+ * admin.css
+ */
+
+
+/*
+ fixed-layout 固定头部和边栏布局
+*/
+
+html,
+body {
+  height: 100%;
+  overflow: hidden;
+}
+
+ul {
+  margin-top: 0;
+}
+
+.admin-icon-yellow {
+  color: #ffbe40;
+}
+
+.admin-header {
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  z-index: 1500;
+  font-size: 1.4rem;
+  margin-bottom: 0;
+}
+
+.admin-header-list a:hover :after {
+  content: none;
+}
+
+.admin-main {
+  position: relative;
+  height: 100%;
+  padding-top: 51px;
+  background: #f3f3f3;
+}
+
+.admin-menu {
+  position: fixed;
+  z-index: 10;
+  bottom: 30px;
+  right: 20px;
+}
+
+.admin-sidebar {
+  width: 260px;
+  min-height: 100%;
+  float: left;
+  border-right: 1px solid #cecece;
+}
+
+.admin-sidebar.am-active {
+  z-index: 1600;
+}
+
+.admin-sidebar-list {
+  margin-bottom: 0;
+}
+
+.admin-sidebar-list li a {
+  color: #5c5c5c;
+  padding-left: 24px;
+}
+
+.admin-sidebar-list li:first-child {
+  border-top: none;
+}
+
+.admin-sidebar-sub {
+  margin-top: 0;
+  margin-bottom: 0;
+  box-shadow: 0 16px 8px -15px #e2e2e2 inset;
+  background: #ececec;
+  padding-left: 24px;
+}
+
+.admin-sidebar-sub li:first-child {
+  border-top: 1px solid #dedede;
+}
+
+.admin-sidebar-panel {
+  margin: 10px;
+}
+
+.admin-content {
+  display: -webkit-box;
+  display: -webkit-flex;
+  display: -ms-flexbox;
+  display: flex;
+  -webkit-box-orient: vertical;
+  -webkit-box-direction: normal;
+  -webkit-flex-direction: column;
+  -ms-flex-direction: column;
+  flex-direction: column;
+  background: #fff;
+}
+
+.admin-content,
+.admin-sidebar {
+  height: 100%;
+  overflow-x: hidden;
+  overflow-y: scroll;
+  -webkit-overflow-scrolling: touch;
+}
+
+.admin-content-body {
+  -webkit-box-flex: 1;
+  -webkit-flex: 1 0 auto;
+  -ms-flex: 1 0 auto;
+  flex: 1 0 auto;
+}
+
+.admin-content-footer {
+  font-size: 85%;
+  color: #777;
+}
+
+.admin-content-list {
+  border: 1px solid #e9ecf1;
+  margin-top: 0;
+}
+
+.admin-content-list li {
+  border: 1px solid #e9ecf1;
+  border-width: 0 1px;
+  margin-left: -1px;
+}
+
+.admin-content-list li:first-child {
+  border-left: none;
+}
+
+.admin-content-list li:last-child {
+  border-right: none;
+}
+
+.admin-content-table a {
+  color: #535353;
+}
+.admin-content-file {
+  margin-bottom: 0;
+  color: #666;
+}
+
+.admin-content-file p {
+  margin: 0 0 5px 0;
+  font-size: 1.4rem;
+}
+
+.admin-content-file li {
+  padding: 10px 0;
+}
+
+.admin-content-file li:first-child {
+  border-top: none;
+}
+
+.admin-content-file li:last-child {
+  border-bottom: none;
+}
+
+.admin-content-file li .am-progress {
+  margin-bottom: 4px;
+}
+
+.admin-content-file li .am-progress-bar {
+  line-height: 14px;
+}
+
+.admin-content-task {
+  margin-bottom: 0;
+}
+
+.admin-content-task li {
+  padding: 5px 0;
+  border-color: #eee;
+}
+
+.admin-content-task li:first-child {
+  border-top: none;
+}
+
+.admin-content-task li:last-child {
+  border-bottom: none;
+}
+
+.admin-task-meta {
+  font-size: 1.2rem;
+  color: #999;
+}
+
+.admin-task-bd {
+  font-size: 1.4rem;
+  margin-bottom: 5px;
+}
+
+.admin-content-comment {
+  margin-bottom: 0;
+}
+
+.admin-content-comment .am-comment-bd {
+  font-size: 1.4rem;
+}
+
+.admin-content-pagination {
+  margin-bottom: 0;
+}
+.admin-content-pagination li a {
+  padding: 4px 8px;
+}
+
+@media only screen and (min-width: 641px) {
+  .admin-sidebar {
+    display: block;
+    position: static;
+    background: none;
+  }
+
+  .admin-offcanvas-bar {
+    position: static;
+    width: auto;
+    background: none;
+    -webkit-transform: translate3d(0, 0, 0);
+    -ms-transform: translate3d(0, 0, 0);
+    transform: translate3d(0, 0, 0);
+    overflow-y: visible;
+    min-height: 100%;
+  }
+  .admin-offcanvas-bar:after {
+    content: none;
+  }
+}
+
+@media only screen and (max-width: 640px) {
+  .admin-sidebar {
+    width: inherit;
+  }
+
+  .admin-offcanvas-bar {
+    background: #f3f3f3;
+  }
+
+  .admin-offcanvas-bar:after {
+    background: #BABABA;
+  }
+
+  .admin-sidebar-list a:hover, .admin-sidebar-list a:active{
+    -webkit-transition: background-color .3s ease;
+    -moz-transition: background-color .3s ease;
+    -ms-transition: background-color .3s ease;
+    -o-transition: background-color .3s ease;
+    transition: background-color .3s ease;
+    background: #E4E4E4;
+  }
+
+  .admin-content-list li {
+    padding: 10px;
+    border-width: 1px 0;
+    margin-top: -1px;
+  }
+
+  .admin-content-list li:first-child {
+    border-top: none;
+  }
+
+  .admin-content-list li:last-child {
+    border-bottom: none;
+  }
+
+  .admin-form-text {
+    text-align: left !important;
+  }
+
+}
+
+/*
+* user.html css
+*/
+.user-info {
+  margin-bottom: 15px;
+}
+
+.user-info .am-progress {
+  margin-bottom: 4px;
+}
+
+.user-info p {
+  margin: 5px;
+}
+
+.user-info-order {
+  font-size: 1.4rem;
+}
+
+/*
+* errorLog.html css
+*/
+
+.error-log .am-pre-scrollable {
+  max-height: 40rem;
+}
+
+/*
+* table.html css
+*/
+
+.table-main {
+  font-size: 1.4rem;
+  padding: .5rem;
+}
+
+.table-main button {
+  background: #fff;
+}
+
+.table-check {
+  width: 30px;
+}
+
+.table-id {
+  width: 50px;
+}
+
+@media only screen and (max-width: 640px) {
+  .table-select {
+    margin-top: 10px;
+    margin-left: 5px;
+  }
+}
+
+/*
+gallery.html css
+*/
+
+.gallery-list li {
+  padding: 10px;
+}
+
+.gallery-list a {
+  color: #666;
+}
+
+.gallery-list a:hover {
+  color: #3bb4f2;
+}
+
+.gallery-title {
+  margin-top: 6px;
+  font-size: 1.4rem;
+}
+
+.gallery-desc {
+  font-size: 1.2rem;
+  margin-top: 4px;
+}
+
+/*
+ 404.html css
+*/
+
+.page-404 {
+  background: #fff;
+  border: none;
+  width: 200px;
+  margin: 0 auto;
+}

File diff suppressed because it is too large
+ 10247 - 0
Public/css/amazeui.css


File diff suppressed because it is too large
+ 10269 - 0
Public/css/amazeui.flat.css


File diff suppressed because it is too large
+ 0 - 0
Public/css/amazeui.flat.min.css


File diff suppressed because it is too large
+ 0 - 0
Public/css/amazeui.min.css


+ 1 - 0
Public/css/app.css

@@ -0,0 +1 @@
+/* Write your styles */

BIN
Public/fonts/FontAwesome.otf


BIN
Public/fonts/fontawesome-webfont.eot


BIN
Public/fonts/fontawesome-webfont.ttf


BIN
Public/fonts/fontawesome-webfont.woff


BIN
Public/fonts/fontawesome-webfont.woff2


BIN
Public/i/app-icon72x72@2x.png


BIN
Public/i/examples/admin-chrome.png


BIN
Public/i/examples/admin-firefox.png


BIN
Public/i/examples/admin-ie.png


BIN
Public/i/examples/admin-opera.png


BIN
Public/i/examples/admin-safari.png


BIN
Public/i/examples/adminPage.png


BIN
Public/i/examples/blogPage.png


BIN
Public/i/examples/landing.png


BIN
Public/i/examples/landingPage.png


BIN
Public/i/examples/loginPage.png


BIN
Public/i/examples/sidebarPage.png


BIN
Public/i/favicon.png


BIN
Public/i/startup-640x1096.png


File diff suppressed because it is too large
+ 2879 - 0
Public/js/amazeui.ie8polyfill.js


File diff suppressed because it is too large
+ 1 - 0
Public/js/amazeui.ie8polyfill.min.js


+ 16800 - 0
Public/js/amazeui.js

@@ -0,0 +1,16800 @@
+/*! Amaze UI v2.7.2 | by Amaze UI Team | (c) 2016 AllMobilize, Inc. | Licensed under MIT | 2016-12-16T16:25:57+0800 */ 
+(function webpackUniversalModuleDefinition(root, factory) {
+	if(typeof exports === 'object' && typeof module === 'object')
+		module.exports = factory(require("jquery"));
+	else if(typeof define === 'function' && define.amd)
+		define(["jquery"], factory);
+	else if(typeof exports === 'object')
+		exports["AMUI"] = factory(require("jquery"));
+	else
+		root["AMUI"] = factory(root["jQuery"]);
+})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ 	// The module cache
+/******/ 	var installedModules = {};
+
+/******/ 	// The require function
+/******/ 	function __webpack_require__(moduleId) {
+
+/******/ 		// Check if module is in cache
+/******/ 		if(installedModules[moduleId])
+/******/ 			return installedModules[moduleId].exports;
+
+/******/ 		// Create a new module (and put it into the cache)
+/******/ 		var module = installedModules[moduleId] = {
+/******/ 			exports: {},
+/******/ 			id: moduleId,
+/******/ 			loaded: false
+/******/ 		};
+
+/******/ 		// Execute the module function
+/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ 		// Flag the module as loaded
+/******/ 		module.loaded = true;
+
+/******/ 		// Return the exports of the module
+/******/ 		return module.exports;
+/******/ 	}
+
+
+/******/ 	// expose the modules object (__webpack_modules__)
+/******/ 	__webpack_require__.m = modules;
+
+/******/ 	// expose the module cache
+/******/ 	__webpack_require__.c = installedModules;
+
+/******/ 	// __webpack_public_path__
+/******/ 	__webpack_require__.p = "";
+
+/******/ 	// Load entry module and return exports
+/******/ 	return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(3);
+	__webpack_require__(4);
+	__webpack_require__(5);
+	__webpack_require__(6);
+	__webpack_require__(7);
+	__webpack_require__(8);
+	__webpack_require__(9);
+	__webpack_require__(10);
+	__webpack_require__(11);
+	__webpack_require__(14);
+	__webpack_require__(15);
+	__webpack_require__(16);
+	__webpack_require__(17);
+	__webpack_require__(18);
+	__webpack_require__(19);
+	__webpack_require__(20);
+	__webpack_require__(21);
+	__webpack_require__(22);
+	__webpack_require__(24);
+	__webpack_require__(25);
+	__webpack_require__(23);
+	__webpack_require__(27);
+	__webpack_require__(28);
+	__webpack_require__(29);
+	__webpack_require__(30);
+	__webpack_require__(31);
+	__webpack_require__(32);
+	__webpack_require__(33);
+	__webpack_require__(26);
+	__webpack_require__(34);
+	__webpack_require__(35);
+	__webpack_require__(36);
+	__webpack_require__(37);
+	__webpack_require__(38);
+	__webpack_require__(39);
+	__webpack_require__(40);
+	__webpack_require__(41);
+	__webpack_require__(42);
+	__webpack_require__(43);
+	__webpack_require__(44);
+	__webpack_require__(45);
+	__webpack_require__(46);
+	__webpack_require__(47);
+	__webpack_require__(48);
+	__webpack_require__(49);
+	__webpack_require__(50);
+	__webpack_require__(51);
+	__webpack_require__(52);
+	__webpack_require__(53);
+	__webpack_require__(54);
+
+	module.exports = $.AMUI = UI;
+
+
+/***/ },
+/* 1 */
+/***/ function(module, exports) {
+
+	module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
+
+/***/ },
+/* 2 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+
+	if (typeof $ === 'undefined') {
+	  throw new Error('Amaze UI 2.x requires jQuery :-(\n' +
+	  '\u7231\u4e0a\u4e00\u5339\u91ce\u9a6c\uff0c\u53ef\u4f60' +
+	  '\u7684\u5bb6\u91cc\u6ca1\u6709\u8349\u539f\u2026');
+	}
+
+	var UI = $.AMUI || {};
+	var $win = $(window);
+	var doc = window.document;
+	var $html = $('html');
+
+	UI.VERSION = '2.7.2';
+
+	UI.support = {};
+
+	UI.support.transition = (function() {
+	  var transitionEnd = (function() {
+	    // https://developer.mozilla.org/en-US/docs/Web/Events/transitionend#Browser_compatibility
+	    var element = doc.body || doc.documentElement;
+	    var transEndEventNames = {
+	      WebkitTransition: 'webkitTransitionEnd',
+	      MozTransition: 'transitionend',
+	      OTransition: 'oTransitionEnd otransitionend',
+	      transition: 'transitionend'
+	    };
+
+	    for (var name in transEndEventNames) {
+	      if (element.style[name] !== undefined) {
+	        return transEndEventNames[name];
+	      }
+	    }
+	  })();
+
+	  return transitionEnd && {end: transitionEnd};
+	})();
+
+	UI.support.animation = (function() {
+	  var animationEnd = (function() {
+	    var element = doc.body || doc.documentElement;
+	    var animEndEventNames = {
+	      WebkitAnimation: 'webkitAnimationEnd',
+	      MozAnimation: 'animationend',
+	      OAnimation: 'oAnimationEnd oanimationend',
+	      animation: 'animationend'
+	    };
+
+	    for (var name in animEndEventNames) {
+	      if (element.style[name] !== undefined) {
+	        return animEndEventNames[name];
+	      }
+	    }
+	  })();
+
+	  return animationEnd && {end: animationEnd};
+	})();
+
+	/* eslint-disable dot-notation */
+	UI.support.touch = (
+	('ontouchstart' in window &&
+	navigator.userAgent.toLowerCase().match(/mobile|tablet/)) ||
+	(window.DocumentTouch && document instanceof window.DocumentTouch) ||
+	(window.navigator['msPointerEnabled'] &&
+	window.navigator['msMaxTouchPoints'] > 0) || // IE 10
+	(window.navigator['pointerEnabled'] &&
+	window.navigator['maxTouchPoints'] > 0) || // IE >=11
+	false);
+	/* eslint-enable dot-notation */
+
+	// https://developer.mozilla.org/zh-CN/docs/DOM/MutationObserver
+	UI.support.mutationobserver = (window.MutationObserver ||
+	window.WebKitMutationObserver || null);
+
+	// https://github.com/Modernizr/Modernizr/blob/924c7611c170ef2dc502582e5079507aff61e388/feature-detects/forms/validation.js#L20
+	UI.support.formValidation = (typeof document.createElement('form').
+	  checkValidity === 'function');
+
+	UI.utils = {};
+
+	/**
+	 * Debounce function
+	 *
+	 * @param {function} func  Function to be debounced
+	 * @param {number} wait Function execution threshold in milliseconds
+	 * @param {bool} immediate  Whether the function should be called at
+	 *                          the beginning of the delay instead of the
+	 *                          end. Default is false.
+	 * @description Executes a function when it stops being invoked for n seconds
+	 * @see  _.debounce() http://underscorejs.org
+	 */
+	UI.utils.debounce = function(func, wait, immediate) {
+	  var timeout;
+	  return function() {
+	    var context = this;
+	    var args = arguments;
+	    var later = function() {
+	      timeout = null;
+	      if (!immediate) {
+	        func.apply(context, args);
+	      }
+	    };
+	    var callNow = immediate && !timeout;
+
+	    clearTimeout(timeout);
+	    timeout = setTimeout(later, wait);
+
+	    if (callNow) {
+	      func.apply(context, args);
+	    }
+	  };
+	};
+
+	UI.utils.isInView = function(element, options) {
+	  var $element = $(element);
+	  var visible = !!($element.width() || $element.height()) &&
+	    $element.css('display') !== 'none';
+
+	  if (!visible) {
+	    return false;
+	  }
+
+	  var windowLeft = $win.scrollLeft();
+	  var windowTop = $win.scrollTop();
+	  var offset = $element.offset();
+	  var left = offset.left;
+	  var top = offset.top;
+
+	  options = $.extend({topOffset: 0, leftOffset: 0}, options);
+
+	  return (top + $element.height() >= windowTop &&
+	  top - options.topOffset <= windowTop + $win.height() &&
+	  left + $element.width() >= windowLeft &&
+	  left - options.leftOffset <= windowLeft + $win.width());
+	};
+
+	UI.utils.parseOptions = UI.utils.options = function(string) {
+	  if ($.isPlainObject(string)) {
+	    return string;
+	  }
+
+	  var start = (string ? string.indexOf('{') : -1);
+	  var options = {};
+
+	  if (start != -1) {
+	    try {
+	      options = (new Function('',
+	        'var json = ' + string.substr(start) +
+	        '; return JSON.parse(JSON.stringify(json));'))();
+	    } catch (e) {
+	    }
+	  }
+
+	  return options;
+	};
+
+	UI.utils.generateGUID = function(namespace) {
+	  var uid = namespace + '-' || 'am-';
+
+	  do {
+	    uid += Math.random().toString(36).substring(2, 7);
+	  } while (document.getElementById(uid));
+
+	  return uid;
+	};
+
+	// @see https://davidwalsh.name/get-absolute-url
+	UI.utils.getAbsoluteUrl = (function() {
+	  var a;
+
+	  return function(url) {
+	    if (!a) {
+	      a = document.createElement('a');
+	    }
+
+	    a.href = url;
+
+	    return a.href;
+	  };
+	})();
+
+	/**
+	 * Plugin AMUI Component to jQuery
+	 *
+	 * @param {String} name - plugin name
+	 * @param {Function} Component - plugin constructor
+	 * @param {Object} [pluginOption]
+	 * @param {String} pluginOption.dataOptions
+	 * @param {Function} pluginOption.methodCall - custom method call
+	 * @param {Function} pluginOption.before
+	 * @param {Function} pluginOption.after
+	 * @since v2.4.1
+	 */
+	UI.plugin = function UIPlugin(name, Component, pluginOption) {
+	  var old = $.fn[name];
+	  pluginOption = pluginOption || {};
+
+	  $.fn[name] = function(option) {
+	    var allArgs = Array.prototype.slice.call(arguments, 0);
+	    var args = allArgs.slice(1);
+	    var propReturn;
+	    var $set = this.each(function() {
+	      var $this = $(this);
+	      var dataName = 'amui.' + name;
+	      var dataOptionsName = pluginOption.dataOptions || ('data-am-' + name);
+	      var instance = $this.data(dataName);
+	      var options = $.extend({},
+	        UI.utils.parseOptions($this.attr(dataOptionsName)),
+	        typeof option === 'object' && option);
+
+	      if (!instance && option === 'destroy') {
+	        return;
+	      }
+
+	      if (!instance) {
+	        $this.data(dataName, (instance = new Component(this, options)));
+	      }
+
+	      // custom method call
+	      if (pluginOption.methodCall) {
+	        pluginOption.methodCall.call($this, allArgs, instance);
+	      } else {
+	        // before method call
+	        pluginOption.before &&
+	        pluginOption.before.call($this, allArgs, instance);
+
+	        if (typeof option === 'string') {
+	          propReturn = typeof instance[option] === 'function' ?
+	            instance[option].apply(instance, args) : instance[option];
+	        }
+
+	        // after method call
+	        pluginOption.after && pluginOption.after.call($this, allArgs, instance);
+	      }
+	    });
+
+	    return (propReturn === undefined) ? $set : propReturn;
+	  };
+
+	  $.fn[name].Constructor = Component;
+
+	  // no conflict
+	  $.fn[name].noConflict = function() {
+	    $.fn[name] = old;
+	    return this;
+	  };
+
+	  UI[name] = Component;
+	};
+
+	// http://blog.alexmaccaw.com/css-transitions
+	$.fn.emulateTransitionEnd = function(duration) {
+	  var called = false;
+	  var $el = this;
+
+	  $(this).one(UI.support.transition.end, function() {
+	    called = true;
+	  });
+
+	  var callback = function() {
+	    if (!called) {
+	      $($el).trigger(UI.support.transition.end);
+	    }
+	    $el.transitionEndTimmer = undefined;
+	  };
+	  this.transitionEndTimmer = setTimeout(callback, duration);
+	  return this;
+	};
+
+	$.fn.redraw = function() {
+	  return this.each(function() {
+	    /* eslint-disable */
+	    var redraw = this.offsetHeight;
+	    /* eslint-enable */
+	  });
+	};
+
+	$.fn.transitionEnd = function(callback) {
+	  var endEvent = UI.support.transition.end;
+	  var dom = this;
+
+	  function fireCallBack(e) {
+	    callback.call(this, e);
+	    endEvent && dom.off(endEvent, fireCallBack);
+	  }
+
+	  if (callback && endEvent) {
+	    dom.on(endEvent, fireCallBack);
+	  }
+
+	  return this;
+	};
+
+	$.fn.removeClassRegEx = function() {
+	  return this.each(function(regex) {
+	    var classes = $(this).attr('class');
+
+	    if (!classes || !regex) {
+	      return false;
+	    }
+
+	    var classArray = [];
+	    classes = classes.split(' ');
+
+	    for (var i = 0, len = classes.length; i < len; i++) {
+	      if (!classes[i].match(regex)) {
+	        classArray.push(classes[i]);
+	      }
+	    }
+
+	    $(this).attr('class', classArray.join(' '));
+	  });
+	};
+
+	//
+	$.fn.alterClass = function(removals, additions) {
+	  var self = this;
+
+	  if (removals.indexOf('*') === -1) {
+	    // Use native jQuery methods if there is no wildcard matching
+	    self.removeClass(removals);
+	    return !additions ? self : self.addClass(additions);
+	  }
+
+	  var classPattern = new RegExp('\\s' +
+	  removals.
+	    replace(/\*/g, '[A-Za-z0-9-_]+').
+	    split(' ').
+	    join('\\s|\\s') +
+	  '\\s', 'g');
+
+	  self.each(function(i, it) {
+	    var cn = ' ' + it.className + ' ';
+	    while (classPattern.test(cn)) {
+	      cn = cn.replace(classPattern, ' ');
+	    }
+	    it.className = $.trim(cn);
+	  });
+
+	  return !additions ? self : self.addClass(additions);
+	};
+
+	// handle multiple browsers for requestAnimationFrame()
+	// http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
+	// https://github.com/gnarf/jquery-requestAnimationFrame
+	UI.utils.rAF = (function() {
+	  return window.requestAnimationFrame ||
+	    window.webkitRequestAnimationFrame ||
+	    window.mozRequestAnimationFrame ||
+	    window.oRequestAnimationFrame ||
+	      // if all else fails, use setTimeout
+	    function(callback) {
+	      return window.setTimeout(callback, 1000 / 60); // shoot for 60 fps
+	    };
+	})();
+
+	// handle multiple browsers for cancelAnimationFrame()
+	UI.utils.cancelAF = (function() {
+	  return window.cancelAnimationFrame ||
+	    window.webkitCancelAnimationFrame ||
+	    window.mozCancelAnimationFrame ||
+	    window.oCancelAnimationFrame ||
+	    function(id) {
+	      window.clearTimeout(id);
+	    };
+	})();
+
+	// via http://davidwalsh.name/detect-scrollbar-width
+	UI.utils.measureScrollbar = function() {
+	  if (document.body.clientWidth >= window.innerWidth) {
+	    return 0;
+	  }
+
+	  // if ($html.width() >= window.innerWidth) return;
+	  // var scrollbarWidth = window.innerWidth - $html.width();
+	  var $measure = $('<div ' +
+	  'style="width: 100px;height: 100px;overflow: scroll;' +
+	  'position: absolute;top: -9999px;"></div>');
+
+	  $(document.body).append($measure);
+
+	  var scrollbarWidth = $measure[0].offsetWidth - $measure[0].clientWidth;
+
+	  $measure.remove();
+
+	  return scrollbarWidth;
+	};
+
+	UI.utils.imageLoader = function($image, callback) {
+	  function loaded() {
+	    callback($image[0]);
+	  }
+
+	  function bindLoad() {
+	    this.one('load', loaded);
+	    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
+	      var src = this.attr('src');
+	      var param = src.match(/\?/) ? '&' : '?';
+
+	      param += 'random=' + (new Date()).getTime();
+	      this.attr('src', src + param);
+	    }
+	  }
+
+	  if (!$image.attr('src')) {
+	    loaded();
+	    return;
+	  }
+
+	  if ($image[0].complete || $image[0].readyState === 4) {
+	    loaded();
+	  } else {
+	    bindLoad.call($image);
+	  }
+	};
+
+	/**
+	 * @see https://github.com/cho45/micro-template.js
+	 * (c) cho45 http://cho45.github.com/mit-license
+	 */
+	UI.template = function(id, data) {
+	  var me = UI.template;
+
+	  if (!me.cache[id]) {
+	    me.cache[id] = (function() {
+	      var name = id;
+	      var string = /^[\w\-]+$/.test(id) ?
+	        me.get(id) : (name = 'template(string)', id); // no warnings
+
+	      var line = 1;
+	      /* eslint-disable max-len, quotes */
+	      var body = ('try { ' + (me.variable ?
+	      'var ' + me.variable + ' = this.stash;' : 'with (this.stash) { ') +
+	      "this.ret += '" +
+	      string.
+	        replace(/<%/g, '\x11').replace(/%>/g, '\x13'). // if you want other tag, just edit this line
+	        replace(/'(?![^\x11\x13]+?\x13)/g, '\\x27').
+	        replace(/^\s*|\s*$/g, '').
+	        replace(/\n/g, function() {
+	          return "';\nthis.line = " + (++line) + "; this.ret += '\\n";
+	        }).
+	        replace(/\x11-(.+?)\x13/g, "' + ($1) + '").
+	        replace(/\x11=(.+?)\x13/g, "' + this.escapeHTML($1) + '").
+	        replace(/\x11(.+?)\x13/g, "'; $1; this.ret += '") +
+	      "'; " + (me.variable ? "" : "}") + "return this.ret;" +
+	      "} catch (e) { throw 'TemplateError: ' + e + ' (on " + name +
+	      "' + ' line ' + this.line + ')'; } " +
+	      "//@ sourceURL=" + name + "\n" // source map
+	      ).replace(/this\.ret \+= '';/g, '');
+	      /* eslint-enable max-len, quotes */
+	      var func = new Function(body);
+	      var map = {
+	        '&': '&amp;',
+	        '<': '&lt;',
+	        '>': '&gt;',
+	        '\x22': '&#x22;',
+	        '\x27': '&#x27;'
+	      };
+	      var escapeHTML = function(string) {
+	        return ('' + string).replace(/[&<>\'\"]/g, function(_) {
+	          return map[_];
+	        });
+	      };
+
+	      return function(stash) {
+	        return func.call(me.context = {
+	          escapeHTML: escapeHTML,
+	          line: 1,
+	          ret: '',
+	          stash: stash
+	        });
+	      };
+	    })();
+	  }
+
+	  return data ? me.cache[id](data) : me.cache[id];
+	};
+
+	UI.template.cache = {};
+
+	UI.template.get = function(id) {
+	  if (id) {
+	    var element = document.getElementById(id);
+	    return element && element.innerHTML || '';
+	  }
+	};
+
+	// Dom mutation watchers
+	UI.DOMWatchers = [];
+	UI.DOMReady = false;
+	UI.ready = function(callback) {
+	  UI.DOMWatchers.push(callback);
+	  if (UI.DOMReady) {
+	    // console.log('Ready call');
+	    callback(document);
+	  }
+	};
+
+	UI.DOMObserve = function(elements, options, callback) {
+	  var Observer = UI.support.mutationobserver;
+	  if (!Observer) {
+	    return;
+	  }
+
+	  options = $.isPlainObject(options) ?
+	    options : {childList: true, subtree: true};
+
+	  callback = typeof callback === 'function' && callback || function() {
+	  };
+
+	  $(elements).each(function() {
+	    var element = this;
+	    var $element = $(element);
+
+	    if ($element.data('am.observer')) {
+	      return;
+	    }
+
+	    try {
+	      var observer = new Observer(UI.utils.debounce(
+	        function(mutations, instance) {
+	          callback.call(element, mutations, instance);
+	          // trigger this event manually if MutationObserver not supported
+	          $element.trigger('changed.dom.amui');
+	        }, 50));
+
+	      observer.observe(element, options);
+
+	      $element.data('am.observer', observer);
+	    } catch (e) {
+	    }
+	  });
+	};
+
+	$.fn.DOMObserve = function(options, callback) {
+	  return this.each(function() {
+	    /* eslint-disable new-cap */
+	    UI.DOMObserve(this, options, callback);
+	    /* eslint-enable new-cap */
+	  });
+	};
+
+	if (UI.support.touch) {
+	  $html.addClass('am-touch');
+	}
+
+	$(document).on('changed.dom.amui', function(e) {
+	  var element = e.target;
+
+	  // TODO: just call changed element's watcher
+	  //       every watcher callback should have a key
+	  //       use like this: <div data-am-observe='key1, key2'>
+	  //       get keys via $(element).data('amObserve')
+	  //       call functions store with these keys
+	  $.each(UI.DOMWatchers, function(i, watcher) {
+	    watcher(element);
+	  });
+	});
+
+	$(function() {
+	  var $body = $(document.body);
+
+	  UI.DOMReady = true;
+
+	  // Run default init
+	  $.each(UI.DOMWatchers, function(i, watcher) {
+	    watcher(document);
+	  });
+
+	  // watches DOM
+	  /* eslint-disable new-cap */
+	  UI.DOMObserve('[data-am-observe]');
+	  /* eslint-enable */
+
+	  $html.removeClass('no-js').addClass('js');
+
+	  UI.support.animation && $html.addClass('cssanimations');
+
+	  // iOS standalone mode
+	  if (window.navigator.standalone) {
+	    $html.addClass('am-standalone');
+	  }
+
+	  $('.am-topbar-fixed-top').length &&
+	  $body.addClass('am-with-topbar-fixed-top');
+
+	  $('.am-topbar-fixed-bottom').length &&
+	  $body.addClass('am-with-topbar-fixed-bottom');
+
+	  // Remove responsive classes in .am-layout
+	  var $layout = $('.am-layout');
+	  $layout.find('[class*="md-block-grid"]').alterClass('md-block-grid-*');
+	  $layout.find('[class*="lg-block-grid"]').alterClass('lg-block-grid');
+
+	  // widgets not in .am-layout
+	  $('[data-am-widget]').each(function() {
+	    var $widget = $(this);
+	    // console.log($widget.parents('.am-layout').length)
+	    if ($widget.parents('.am-layout').length === 0) {
+	      $widget.addClass('am-no-layout');
+	    }
+	  });
+	});
+
+	module.exports = UI;
+
+
+/***/ },
+/* 3 */
+/***/ function(module, exports, __webpack_require__) {
+
+	/*! Hammer.JS - v2.0.8 - 2016-04-22
+	 * http://hammerjs.github.io/
+	 *
+	 * Copyright (c) 2016 Jorik Tangelder;
+	 * Licensed under the MIT license */
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
+	var TEST_ELEMENT = document.createElement('div');
+
+	var TYPE_FUNCTION = 'function';
+
+	var round = Math.round;
+	var abs = Math.abs;
+	var now = Date.now;
+
+	/**
+	 * set a timeout with a given scope
+	 * @param {Function} fn
+	 * @param {Number} timeout
+	 * @param {Object} context
+	 * @returns {number}
+	 */
+	function setTimeoutContext(fn, timeout, context) {
+	  return setTimeout(bindFn(fn, context), timeout);
+	}
+
+	/**
+	 * if the argument is an array, we want to execute the fn on each entry
+	 * if it aint an array we don't want to do a thing.
+	 * this is used by all the methods that accept a single and array argument.
+	 * @param {*|Array} arg
+	 * @param {String} fn
+	 * @param {Object} [context]
+	 * @returns {Boolean}
+	 */
+	function invokeArrayArg(arg, fn, context) {
+	  if (Array.isArray(arg)) {
+	    each(arg, context[fn], context);
+	    return true;
+	  }
+	  return false;
+	}
+
+	/**
+	 * walk objects and arrays
+	 * @param {Object} obj
+	 * @param {Function} iterator
+	 * @param {Object} context
+	 */
+	function each(obj, iterator, context) {
+	  var i;
+
+	  if (!obj) {
+	    return;
+	  }
+
+	  if (obj.forEach) {
+	    obj.forEach(iterator, context);
+	  } else if (obj.length !== undefined) {
+	    i = 0;
+	    while (i < obj.length) {
+	      iterator.call(context, obj[i], i, obj);
+	      i++;
+	    }
+	  } else {
+	    for (i in obj) {
+	      obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
+	    }
+	  }
+	}
+
+	/**
+	 * wrap a method with a deprecation warning and stack trace
+	 * @param {Function} method
+	 * @param {String} name
+	 * @param {String} message
+	 * @returns {Function} A new function wrapping the supplied method.
+	 */
+	function deprecate(method, name, message) {
+	  var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
+	  return function() {
+	    var e = new Error('get-stack-trace');
+	    var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
+	      .replace(/^\s+at\s+/gm, '')
+	      .replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
+
+	    var log = window.console && (window.console.warn || window.console.log);
+	    if (log) {
+	      log.call(window.console, deprecationMessage, stack);
+	    }
+	    return method.apply(this, arguments);
+	  };
+	}
+
+	/**
+	 * extend object.
+	 * means that properties in dest will be overwritten by the ones in src.
+	 * @param {Object} target
+	 * @param {...Object} objects_to_assign
+	 * @returns {Object} target
+	 */
+	var assign;
+	if (typeof Object.assign !== 'function') {
+	  assign = function assign(target) {
+	    if (target === undefined || target === null) {
+	      throw new TypeError('Cannot convert undefined or null to object');
+	    }
+
+	    var output = Object(target);
+	    for (var index = 1; index < arguments.length; index++) {
+	      var source = arguments[index];
+	      if (source !== undefined && source !== null) {
+	        for (var nextKey in source) {
+	          if (source.hasOwnProperty(nextKey)) {
+	            output[nextKey] = source[nextKey];
+	          }
+	        }
+	      }
+	    }
+	    return output;
+	  };
+	} else {
+	  assign = Object.assign;
+	}
+
+	/**
+	 * extend object.
+	 * means that properties in dest will be overwritten by the ones in src.
+	 * @param {Object} dest
+	 * @param {Object} src
+	 * @param {Boolean} [merge=false]
+	 * @returns {Object} dest
+	 */
+	var extend = deprecate(function extend(dest, src, merge) {
+	  var keys = Object.keys(src);
+	  var i = 0;
+	  while (i < keys.length) {
+	    if (!merge || (merge && dest[keys[i]] === undefined)) {
+	      dest[keys[i]] = src[keys[i]];
+	    }
+	    i++;
+	  }
+	  return dest;
+	}, 'extend', 'Use `assign`.');
+
+	/**
+	 * merge the values from src in the dest.
+	 * means that properties that exist in dest will not be overwritten by src
+	 * @param {Object} dest
+	 * @param {Object} src
+	 * @returns {Object} dest
+	 */
+	var merge = deprecate(function merge(dest, src) {
+	  return extend(dest, src, true);
+	}, 'merge', 'Use `assign`.');
+
+	/**
+	 * simple class inheritance
+	 * @param {Function} child
+	 * @param {Function} base
+	 * @param {Object} [properties]
+	 */
+	function inherit(child, base, properties) {
+	  var baseP = base.prototype,
+	    childP;
+
+	  childP = child.prototype = Object.create(baseP);
+	  childP.constructor = child;
+	  childP._super = baseP;
+
+	  if (properties) {
+	    assign(childP, properties);
+	  }
+	}
+
+	/**
+	 * simple function bind
+	 * @param {Function} fn
+	 * @param {Object} context
+	 * @returns {Function}
+	 */
+	function bindFn(fn, context) {
+	  return function boundFn() {
+	    return fn.apply(context, arguments);
+	  };
+	}
+
+	/**
+	 * let a boolean value also be a function that must return a boolean
+	 * this first item in args will be used as the context
+	 * @param {Boolean|Function} val
+	 * @param {Array} [args]
+	 * @returns {Boolean}
+	 */
+	function boolOrFn(val, args) {
+	  if (typeof val == TYPE_FUNCTION) {
+	    return val.apply(args ? args[0] || undefined : undefined, args);
+	  }
+	  return val;
+	}
+
+	/**
+	 * use the val2 when val1 is undefined
+	 * @param {*} val1
+	 * @param {*} val2
+	 * @returns {*}
+	 */
+	function ifUndefined(val1, val2) {
+	  return (val1 === undefined) ? val2 : val1;
+	}
+
+	/**
+	 * addEventListener with multiple events at once
+	 * @param {EventTarget} target
+	 * @param {String} types
+	 * @param {Function} handler
+	 */
+	function addEventListeners(target, types, handler) {
+	  each(splitStr(types), function(type) {
+	    target.addEventListener(type, handler, false);
+	  });
+	}
+
+	/**
+	 * removeEventListener with multiple events at once
+	 * @param {EventTarget} target
+	 * @param {String} types
+	 * @param {Function} handler
+	 */
+	function removeEventListeners(target, types, handler) {
+	  each(splitStr(types), function(type) {
+	    target.removeEventListener(type, handler, false);
+	  });
+	}
+
+	/**
+	 * find if a node is in the given parent
+	 * @method hasParent
+	 * @param {HTMLElement} node
+	 * @param {HTMLElement} parent
+	 * @return {Boolean} found
+	 */
+	function hasParent(node, parent) {
+	  while (node) {
+	    if (node == parent) {
+	      return true;
+	    }
+	    node = node.parentNode;
+	  }
+	  return false;
+	}
+
+	/**
+	 * small indexOf wrapper
+	 * @param {String} str
+	 * @param {String} find
+	 * @returns {Boolean} found
+	 */
+	function inStr(str, find) {
+	  return str.indexOf(find) > -1;
+	}
+
+	/**
+	 * split string on whitespace
+	 * @param {String} str
+	 * @returns {Array} words
+	 */
+	function splitStr(str) {
+	  return str.trim().split(/\s+/g);
+	}
+
+	/**
+	 * find if a array contains the object using indexOf or a simple polyFill
+	 * @param {Array} src
+	 * @param {String} find
+	 * @param {String} [findByKey]
+	 * @return {Boolean|Number} false when not found, or the index
+	 */
+	function inArray(src, find, findByKey) {
+	  if (src.indexOf && !findByKey) {
+	    return src.indexOf(find);
+	  } else {
+	    var i = 0;
+	    while (i < src.length) {
+	      if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
+	        return i;
+	      }
+	      i++;
+	    }
+	    return -1;
+	  }
+	}
+
+	/**
+	 * convert array-like objects to real arrays
+	 * @param {Object} obj
+	 * @returns {Array}
+	 */
+	function toArray(obj) {
+	  return Array.prototype.slice.call(obj, 0);
+	}
+
+	/**
+	 * unique array with objects based on a key (like 'id') or just by the array's value
+	 * @param {Array} src [{id:1},{id:2},{id:1}]
+	 * @param {String} [key]
+	 * @param {Boolean} [sort=False]
+	 * @returns {Array} [{id:1},{id:2}]
+	 */
+	function uniqueArray(src, key, sort) {
+	  var results = [];
+	  var values = [];
+	  var i = 0;
+
+	  while (i < src.length) {
+	    var val = key ? src[i][key] : src[i];
+	    if (inArray(values, val) < 0) {
+	      results.push(src[i]);
+	    }
+	    values[i] = val;
+	    i++;
+	  }
+
+	  if (sort) {
+	    if (!key) {
+	      results = results.sort();
+	    } else {
+	      results = results.sort(function sortUniqueArray(a, b) {
+	        return a[key] > b[key];
+	      });
+	    }
+	  }
+
+	  return results;
+	}
+
+	/**
+	 * get the prefixed property
+	 * @param {Object} obj
+	 * @param {String} property
+	 * @returns {String|Undefined} prefixed
+	 */
+	function prefixed(obj, property) {
+	  var prefix, prop;
+	  var camelProp = property[0].toUpperCase() + property.slice(1);
+
+	  var i = 0;
+	  while (i < VENDOR_PREFIXES.length) {
+	    prefix = VENDOR_PREFIXES[i];
+	    prop = (prefix) ? prefix + camelProp : property;
+
+	    if (prop in obj) {
+	      return prop;
+	    }
+	    i++;
+	  }
+	  return undefined;
+	}
+
+	/**
+	 * get a unique id
+	 * @returns {number} uniqueId
+	 */
+	var _uniqueId = 1;
+	function uniqueId() {
+	  return _uniqueId++;
+	}
+
+	/**
+	 * get the window object of an element
+	 * @param {HTMLElement} element
+	 * @returns {DocumentView|Window}
+	 */
+	function getWindowForElement(element) {
+	  var doc = element.ownerDocument || element;
+	  return (doc.defaultView || doc.parentWindow || window);
+	}
+
+	var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
+
+	var SUPPORT_TOUCH = ('ontouchstart' in window);
+	var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
+	var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
+
+	var INPUT_TYPE_TOUCH = 'touch';
+	var INPUT_TYPE_PEN = 'pen';
+	var INPUT_TYPE_MOUSE = 'mouse';
+	var INPUT_TYPE_KINECT = 'kinect';
+
+	var COMPUTE_INTERVAL = 25;
+
+	var INPUT_START = 1;
+	var INPUT_MOVE = 2;
+	var INPUT_END = 4;
+	var INPUT_CANCEL = 8;
+
+	var DIRECTION_NONE = 1;
+	var DIRECTION_LEFT = 2;
+	var DIRECTION_RIGHT = 4;
+	var DIRECTION_UP = 8;
+	var DIRECTION_DOWN = 16;
+
+	var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
+	var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
+	var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
+
+	var PROPS_XY = ['x', 'y'];
+	var PROPS_CLIENT_XY = ['clientX', 'clientY'];
+
+	/**
+	 * create new input type manager
+	 * @param {Manager} manager
+	 * @param {Function} callback
+	 * @returns {Input}
+	 * @constructor
+	 */
+	function Input(manager, callback) {
+	  var self = this;
+	  this.manager = manager;
+	  this.callback = callback;
+	  this.element = manager.element;
+	  this.target = manager.options.inputTarget;
+
+	  // smaller wrapper around the handler, for the scope and the enabled state of the manager,
+	  // so when disabled the input events are completely bypassed.
+	  this.domHandler = function(ev) {
+	    if (boolOrFn(manager.options.enable, [manager])) {
+	      self.handler(ev);
+	    }
+	  };
+
+	  this.init();
+
+	}
+
+	Input.prototype = {
+	  /**
+	   * should handle the inputEvent data and trigger the callback
+	   * @virtual
+	   */
+	  handler: function() { },
+
+	  /**
+	   * bind the events
+	   */
+	  init: function() {
+	    this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
+	    this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
+	    this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
+	  },
+
+	  /**
+	   * unbind the events
+	   */
+	  destroy: function() {
+	    this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
+	    this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
+	    this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
+	  }
+	};
+
+	/**
+	 * create new input type manager
+	 * called by the Manager constructor
+	 * @param {Hammer} manager
+	 * @returns {Input}
+	 */
+	function createInputInstance(manager) {
+	  var Type;
+	  var inputClass = manager.options.inputClass;
+
+	  if (inputClass) {
+	    Type = inputClass;
+	  } else if (SUPPORT_POINTER_EVENTS) {
+	    Type = PointerEventInput;
+	  } else if (SUPPORT_ONLY_TOUCH) {
+	    Type = TouchInput;
+	  } else if (!SUPPORT_TOUCH) {
+	    Type = MouseInput;
+	  } else {
+	    Type = TouchMouseInput;
+	  }
+	  return new (Type)(manager, inputHandler);
+	}
+
+	/**
+	 * handle input events
+	 * @param {Manager} manager
+	 * @param {String} eventType
+	 * @param {Object} input
+	 */
+	function inputHandler(manager, eventType, input) {
+	  var pointersLen = input.pointers.length;
+	  var changedPointersLen = input.changedPointers.length;
+	  var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
+	  var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));
+
+	  input.isFirst = !!isFirst;
+	  input.isFinal = !!isFinal;
+
+	  if (isFirst) {
+	    manager.session = {};
+	  }
+
+	  // source event is the normalized value of the domEvents
+	  // like 'touchstart, mouseup, pointerdown'
+	  input.eventType = eventType;
+
+	  // compute scale, rotation etc
+	  computeInputData(manager, input);
+
+	  // emit secret event
+	  manager.emit('hammer.input', input);
+
+	  manager.recognize(input);
+	  manager.session.prevInput = input;
+	}
+
+	/**
+	 * extend the data with some usable properties like scale, rotate, velocity etc
+	 * @param {Object} manager
+	 * @param {Object} input
+	 */
+	function computeInputData(manager, input) {
+	  var session = manager.session;
+	  var pointers = input.pointers;
+	  var pointersLength = pointers.length;
+
+	  // store the first input to calculate the distance and direction
+	  if (!session.firstInput) {
+	    session.firstInput = simpleCloneInputData(input);
+	  }
+
+	  // to compute scale and rotation we need to store the multiple touches
+	  if (pointersLength > 1 && !session.firstMultiple) {
+	    session.firstMultiple = simpleCloneInputData(input);
+	  } else if (pointersLength === 1) {
+	    session.firstMultiple = false;
+	  }
+
+	  var firstInput = session.firstInput;
+	  var firstMultiple = session.firstMultiple;
+	  var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
+
+	  var center = input.center = getCenter(pointers);
+	  input.timeStamp = now();
+	  input.deltaTime = input.timeStamp - firstInput.timeStamp;
+
+	  input.angle = getAngle(offsetCenter, center);
+	  input.distance = getDistance(offsetCenter, center);
+
+	  computeDeltaXY(session, input);
+	  input.offsetDirection = getDirection(input.deltaX, input.deltaY);
+
+	  var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
+	  input.overallVelocityX = overallVelocity.x;
+	  input.overallVelocityY = overallVelocity.y;
+	  input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;
+
+	  input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
+	  input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
+
+	  input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >
+	  session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);
+
+	  computeIntervalInputData(session, input);
+
+	  // find the correct target
+	  var target = manager.element;
+	  if (hasParent(input.srcEvent.target, target)) {
+	    target = input.srcEvent.target;
+	  }
+	  input.target = target;
+	}
+
+	function computeDeltaXY(session, input) {
+	  var center = input.center;
+	  var offset = session.offsetDelta || {};
+	  var prevDelta = session.prevDelta || {};
+	  var prevInput = session.prevInput || {};
+
+	  if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
+	    prevDelta = session.prevDelta = {
+	      x: prevInput.deltaX || 0,
+	      y: prevInput.deltaY || 0
+	    };
+
+	    offset = session.offsetDelta = {
+	      x: center.x,
+	      y: center.y
+	    };
+	  }
+
+	  input.deltaX = prevDelta.x + (center.x - offset.x);
+	  input.deltaY = prevDelta.y + (center.y - offset.y);
+	}
+
+	/**
+	 * velocity is calculated every x ms
+	 * @param {Object} session
+	 * @param {Object} input
+	 */
+	function computeIntervalInputData(session, input) {
+	  var last = session.lastInterval || input,
+	    deltaTime = input.timeStamp - last.timeStamp,
+	    velocity, velocityX, velocityY, direction;
+
+	  if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
+	    var deltaX = input.deltaX - last.deltaX;
+	    var deltaY = input.deltaY - last.deltaY;
+
+	    var v = getVelocity(deltaTime, deltaX, deltaY);
+	    velocityX = v.x;
+	    velocityY = v.y;
+	    velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;
+	    direction = getDirection(deltaX, deltaY);
+
+	    session.lastInterval = input;
+	  } else {
+	    // use latest velocity info if it doesn't overtake a minimum period
+	    velocity = last.velocity;
+	    velocityX = last.velocityX;
+	    velocityY = last.velocityY;
+	    direction = last.direction;
+	  }
+
+	  input.velocity = velocity;
+	  input.velocityX = velocityX;
+	  input.velocityY = velocityY;
+	  input.direction = direction;
+	}
+
+	/**
+	 * create a simple clone from the input used for storage of firstInput and firstMultiple
+	 * @param {Object} input
+	 * @returns {Object} clonedInputData
+	 */
+	function simpleCloneInputData(input) {
+	  // make a simple copy of the pointers because we will get a reference if we don't
+	  // we only need clientXY for the calculations
+	  var pointers = [];
+	  var i = 0;
+	  while (i < input.pointers.length) {
+	    pointers[i] = {
+	      clientX: round(input.pointers[i].clientX),
+	      clientY: round(input.pointers[i].clientY)
+	    };
+	    i++;
+	  }
+
+	  return {
+	    timeStamp: now(),
+	    pointers: pointers,
+	    center: getCenter(pointers),
+	    deltaX: input.deltaX,
+	    deltaY: input.deltaY
+	  };
+	}
+
+	/**
+	 * get the center of all the pointers
+	 * @param {Array} pointers
+	 * @return {Object} center contains `x` and `y` properties
+	 */
+	function getCenter(pointers) {
+	  var pointersLength = pointers.length;
+
+	  // no need to loop when only one touch
+	  if (pointersLength === 1) {
+	    return {
+	      x: round(pointers[0].clientX),
+	      y: round(pointers[0].clientY)
+	    };
+	  }
+
+	  var x = 0, y = 0, i = 0;
+	  while (i < pointersLength) {
+	    x += pointers[i].clientX;
+	    y += pointers[i].clientY;
+	    i++;
+	  }
+
+	  return {
+	    x: round(x / pointersLength),
+	    y: round(y / pointersLength)
+	  };
+	}
+
+	/**
+	 * calculate the velocity between two points. unit is in px per ms.
+	 * @param {Number} deltaTime
+	 * @param {Number} x
+	 * @param {Number} y
+	 * @return {Object} velocity `x` and `y`
+	 */
+	function getVelocity(deltaTime, x, y) {
+	  return {
+	    x: x / deltaTime || 0,
+	    y: y / deltaTime || 0
+	  };
+	}
+
+	/**
+	 * get the direction between two points
+	 * @param {Number} x
+	 * @param {Number} y
+	 * @return {Number} direction
+	 */
+	function getDirection(x, y) {
+	  if (x === y) {
+	    return DIRECTION_NONE;
+	  }
+
+	  if (abs(x) >= abs(y)) {
+	    return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
+	  }
+	  return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
+	}
+
+	/**
+	 * calculate the absolute distance between two points
+	 * @param {Object} p1 {x, y}
+	 * @param {Object} p2 {x, y}
+	 * @param {Array} [props] containing x and y keys
+	 * @return {Number} distance
+	 */
+	function getDistance(p1, p2, props) {
+	  if (!props) {
+	    props = PROPS_XY;
+	  }
+	  var x = p2[props[0]] - p1[props[0]],
+	    y = p2[props[1]] - p1[props[1]];
+
+	  return Math.sqrt((x * x) + (y * y));
+	}
+
+	/**
+	 * calculate the angle between two coordinates
+	 * @param {Object} p1
+	 * @param {Object} p2
+	 * @param {Array} [props] containing x and y keys
+	 * @return {Number} angle
+	 */
+	function getAngle(p1, p2, props) {
+	  if (!props) {
+	    props = PROPS_XY;
+	  }
+	  var x = p2[props[0]] - p1[props[0]],
+	    y = p2[props[1]] - p1[props[1]];
+	  return Math.atan2(y, x) * 180 / Math.PI;
+	}
+
+	/**
+	 * calculate the rotation degrees between two pointersets
+	 * @param {Array} start array of pointers
+	 * @param {Array} end array of pointers
+	 * @return {Number} rotation
+	 */
+	function getRotation(start, end) {
+	  return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
+	}
+
+	/**
+	 * calculate the scale factor between two pointersets
+	 * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
+	 * @param {Array} start array of pointers
+	 * @param {Array} end array of pointers
+	 * @return {Number} scale
+	 */
+	function getScale(start, end) {
+	  return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
+	}
+
+	var MOUSE_INPUT_MAP = {
+	  mousedown: INPUT_START,
+	  mousemove: INPUT_MOVE,
+	  mouseup: INPUT_END
+	};
+
+	var MOUSE_ELEMENT_EVENTS = 'mousedown';
+	var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
+
+	/**
+	 * Mouse events input
+	 * @constructor
+	 * @extends Input
+	 */
+	function MouseInput() {
+	  this.evEl = MOUSE_ELEMENT_EVENTS;
+	  this.evWin = MOUSE_WINDOW_EVENTS;
+
+	  this.pressed = false; // mousedown state
+
+	  Input.apply(this, arguments);
+	}
+
+	inherit(MouseInput, Input, {
+	  /**
+	   * handle mouse events
+	   * @param {Object} ev
+	   */
+	  handler: function MEhandler(ev) {
+	    var eventType = MOUSE_INPUT_MAP[ev.type];
+
+	    // on start we want to have the left mouse button down
+	    if (eventType & INPUT_START && ev.button === 0) {
+	      this.pressed = true;
+	    }
+
+	    if (eventType & INPUT_MOVE && ev.which !== 1) {
+	      eventType = INPUT_END;
+	    }
+
+	    // mouse must be down
+	    if (!this.pressed) {
+	      return;
+	    }
+
+	    if (eventType & INPUT_END) {
+	      this.pressed = false;
+	    }
+
+	    this.callback(this.manager, eventType, {
+	      pointers: [ev],
+	      changedPointers: [ev],
+	      pointerType: INPUT_TYPE_MOUSE,
+	      srcEvent: ev
+	    });
+	  }
+	});
+
+	var POINTER_INPUT_MAP = {
+	  pointerdown: INPUT_START,
+	  pointermove: INPUT_MOVE,
+	  pointerup: INPUT_END,
+	  pointercancel: INPUT_CANCEL,
+	  pointerout: INPUT_CANCEL
+	};
+
+	// in IE10 the pointer types is defined as an enum
+	var IE10_POINTER_TYPE_ENUM = {
+	  2: INPUT_TYPE_TOUCH,
+	  3: INPUT_TYPE_PEN,
+	  4: INPUT_TYPE_MOUSE,
+	  5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
+	};
+
+	var POINTER_ELEMENT_EVENTS = 'pointerdown';
+	var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
+
+	// IE10 has prefixed support, and case-sensitive
+	if (window.MSPointerEvent && !window.PointerEvent) {
+	  POINTER_ELEMENT_EVENTS = 'MSPointerDown';
+	  POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
+	}
+
+	/**
+	 * Pointer events input
+	 * @constructor
+	 * @extends Input
+	 */
+	function PointerEventInput() {
+	  this.evEl = POINTER_ELEMENT_EVENTS;
+	  this.evWin = POINTER_WINDOW_EVENTS;
+
+	  Input.apply(this, arguments);
+
+	  this.store = (this.manager.session.pointerEvents = []);
+	}
+
+	inherit(PointerEventInput, Input, {
+	  /**
+	   * handle mouse events
+	   * @param {Object} ev
+	   */
+	  handler: function PEhandler(ev) {
+	    var store = this.store;
+	    var removePointer = false;
+
+	    var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
+	    var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
+	    var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
+
+	    var isTouch = (pointerType == INPUT_TYPE_TOUCH);
+
+	    // get index of the event in the store
+	    var storeIndex = inArray(store, ev.pointerId, 'pointerId');
+
+	    // start and mouse must be down
+	    if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
+	      if (storeIndex < 0) {
+	        store.push(ev);
+	        storeIndex = store.length - 1;
+	      }
+	    } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
+	      removePointer = true;
+	    }
+
+	    // it not found, so the pointer hasn't been down (so it's probably a hover)
+	    if (storeIndex < 0) {
+	      return;
+	    }
+
+	    // update the event in the store
+	    store[storeIndex] = ev;
+
+	    this.callback(this.manager, eventType, {
+	      pointers: store,
+	      changedPointers: [ev],
+	      pointerType: pointerType,
+	      srcEvent: ev
+	    });
+
+	    if (removePointer) {
+	      // remove from the store
+	      store.splice(storeIndex, 1);
+	    }
+	  }
+	});
+
+	var SINGLE_TOUCH_INPUT_MAP = {
+	  touchstart: INPUT_START,
+	  touchmove: INPUT_MOVE,
+	  touchend: INPUT_END,
+	  touchcancel: INPUT_CANCEL
+	};
+
+	var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
+	var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
+
+	/**
+	 * Touch events input
+	 * @constructor
+	 * @extends Input
+	 */
+	function SingleTouchInput() {
+	  this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
+	  this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
+	  this.started = false;
+
+	  Input.apply(this, arguments);
+	}
+
+	inherit(SingleTouchInput, Input, {
+	  handler: function TEhandler(ev) {
+	    var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
+
+	    // should we handle the touch events?
+	    if (type === INPUT_START) {
+	      this.started = true;
+	    }
+
+	    if (!this.started) {
+	      return;
+	    }
+
+	    var touches = normalizeSingleTouches.call(this, ev, type);
+
+	    // when done, reset the started state
+	    if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
+	      this.started = false;
+	    }
+
+	    this.callback(this.manager, type, {
+	      pointers: touches[0],
+	      changedPointers: touches[1],
+	      pointerType: INPUT_TYPE_TOUCH,
+	      srcEvent: ev
+	    });
+	  }
+	});
+
+	/**
+	 * @this {TouchInput}
+	 * @param {Object} ev
+	 * @param {Number} type flag
+	 * @returns {undefined|Array} [all, changed]
+	 */
+	function normalizeSingleTouches(ev, type) {
+	  var all = toArray(ev.touches);
+	  var changed = toArray(ev.changedTouches);
+
+	  if (type & (INPUT_END | INPUT_CANCEL)) {
+	    all = uniqueArray(all.concat(changed), 'identifier', true);
+	  }
+
+	  return [all, changed];
+	}
+
+	var TOUCH_INPUT_MAP = {
+	  touchstart: INPUT_START,
+	  touchmove: INPUT_MOVE,
+	  touchend: INPUT_END,
+	  touchcancel: INPUT_CANCEL
+	};
+
+	var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
+
+	/**
+	 * Multi-user touch events input
+	 * @constructor
+	 * @extends Input
+	 */
+	function TouchInput() {
+	  this.evTarget = TOUCH_TARGET_EVENTS;
+	  this.targetIds = {};
+
+	  Input.apply(this, arguments);
+	}
+
+	inherit(TouchInput, Input, {
+	  handler: function MTEhandler(ev) {
+	    var type = TOUCH_INPUT_MAP[ev.type];
+	    var touches = getTouches.call(this, ev, type);
+	    if (!touches) {
+	      return;
+	    }
+
+	    this.callback(this.manager, type, {
+	      pointers: touches[0],
+	      changedPointers: touches[1],
+	      pointerType: INPUT_TYPE_TOUCH,
+	      srcEvent: ev
+	    });
+	  }
+	});
+
+	/**
+	 * @this {TouchInput}
+	 * @param {Object} ev
+	 * @param {Number} type flag
+	 * @returns {undefined|Array} [all, changed]
+	 */
+	function getTouches(ev, type) {
+	  var allTouches = toArray(ev.touches);
+	  var targetIds = this.targetIds;
+
+	  // when there is only one touch, the process can be simplified
+	  if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
+	    targetIds[allTouches[0].identifier] = true;
+	    return [allTouches, allTouches];
+	  }
+
+	  var i,
+	    targetTouches,
+	    changedTouches = toArray(ev.changedTouches),
+	    changedTargetTouches = [],
+	    target = this.target;
+
+	  // get target touches from touches
+	  targetTouches = allTouches.filter(function(touch) {
+	    return hasParent(touch.target, target);
+	  });
+
+	  // collect touches
+	  if (type === INPUT_START) {
+	    i = 0;
+	    while (i < targetTouches.length) {
+	      targetIds[targetTouches[i].identifier] = true;
+	      i++;
+	    }
+	  }
+
+	  // filter changed touches to only contain touches that exist in the collected target ids
+	  i = 0;
+	  while (i < changedTouches.length) {
+	    if (targetIds[changedTouches[i].identifier]) {
+	      changedTargetTouches.push(changedTouches[i]);
+	    }
+
+	    // cleanup removed touches
+	    if (type & (INPUT_END | INPUT_CANCEL)) {
+	      delete targetIds[changedTouches[i].identifier];
+	    }
+	    i++;
+	  }
+
+	  if (!changedTargetTouches.length) {
+	    return;
+	  }
+
+	  return [
+	    // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
+	    uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),
+	    changedTargetTouches
+	  ];
+	}
+
+	/**
+	 * Combined touch and mouse input
+	 *
+	 * Touch has a higher priority then mouse, and while touching no mouse events are allowed.
+	 * This because touch devices also emit mouse events while doing a touch.
+	 *
+	 * @constructor
+	 * @extends Input
+	 */
+
+	var DEDUP_TIMEOUT = 2500;
+	var DEDUP_DISTANCE = 25;
+
+	function TouchMouseInput() {
+	  Input.apply(this, arguments);
+
+	  var handler = bindFn(this.handler, this);
+	  this.touch = new TouchInput(this.manager, handler);
+	  this.mouse = new MouseInput(this.manager, handler);
+
+	  this.primaryTouch = null;
+	  this.lastTouches = [];
+	}
+
+	inherit(TouchMouseInput, Input, {
+	  /**
+	   * handle mouse and touch events
+	   * @param {Hammer} manager
+	   * @param {String} inputEvent
+	   * @param {Object} inputData
+	   */
+	  handler: function TMEhandler(manager, inputEvent, inputData) {
+	    var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
+	      isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);
+
+	    if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
+	      return;
+	    }
+
+	    // when we're in a touch event, record touches to  de-dupe synthetic mouse event
+	    if (isTouch) {
+	      recordTouches.call(this, inputEvent, inputData);
+	    } else if (isMouse && isSyntheticEvent.call(this, inputData)) {
+	      return;
+	    }
+
+	    this.callback(manager, inputEvent, inputData);
+	  },
+
+	  /**
+	   * remove the event listeners
+	   */
+	  destroy: function destroy() {
+	    this.touch.destroy();
+	    this.mouse.destroy();
+	  }
+	});
+
+	function recordTouches(eventType, eventData) {
+	  if (eventType & INPUT_START) {
+	    this.primaryTouch = eventData.changedPointers[0].identifier;
+	    setLastTouch.call(this, eventData);
+	  } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
+	    setLastTouch.call(this, eventData);
+	  }
+	}
+
+	function setLastTouch(eventData) {
+	  var touch = eventData.changedPointers[0];
+
+	  if (touch.identifier === this.primaryTouch) {
+	    var lastTouch = {x: touch.clientX, y: touch.clientY};
+	    this.lastTouches.push(lastTouch);
+	    var lts = this.lastTouches;
+	    var removeLastTouch = function() {
+	      var i = lts.indexOf(lastTouch);
+	      if (i > -1) {
+	        lts.splice(i, 1);
+	      }
+	    };
+	    setTimeout(removeLastTouch, DEDUP_TIMEOUT);
+	  }
+	}
+
+	function isSyntheticEvent(eventData) {
+	  var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;
+	  for (var i = 0; i < this.lastTouches.length; i++) {
+	    var t = this.lastTouches[i];
+	    var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
+	    if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
+	      return true;
+	    }
+	  }
+	  return false;
+	}
+
+	var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
+	var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
+
+	// magical touchAction value
+	var TOUCH_ACTION_COMPUTE = 'compute';
+	var TOUCH_ACTION_AUTO = 'auto';
+	var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
+	var TOUCH_ACTION_NONE = 'none';
+	var TOUCH_ACTION_PAN_X = 'pan-x';
+	var TOUCH_ACTION_PAN_Y = 'pan-y';
+	var TOUCH_ACTION_MAP = getTouchActionProps();
+
+	/**
+	 * Touch Action
+	 * sets the touchAction property or uses the js alternative
+	 * @param {Manager} manager
+	 * @param {String} value
+	 * @constructor
+	 */
+	function TouchAction(manager, value) {
+	  this.manager = manager;
+	  this.set(value);
+	}
+
+	TouchAction.prototype = {
+	  /**
+	   * set the touchAction value on the element or enable the polyfill
+	   * @param {String} value
+	   */
+	  set: function(value) {
+	    // find out the touch-action by the event handlers
+	    if (value == TOUCH_ACTION_COMPUTE) {
+	      value = this.compute();
+	    }
+
+	    if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
+	      this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
+	    }
+	    this.actions = value.toLowerCase().trim();
+	  },
+
+	  /**
+	   * just re-set the touchAction value
+	   */
+	  update: function() {
+	    this.set(this.manager.options.touchAction);
+	  },
+
+	  /**
+	   * compute the value for the touchAction property based on the recognizer's settings
+	   * @returns {String} value
+	   */
+	  compute: function() {
+	    var actions = [];
+	    each(this.manager.recognizers, function(recognizer) {
+	      if (boolOrFn(recognizer.options.enable, [recognizer])) {
+	        actions = actions.concat(recognizer.getTouchAction());
+	      }
+	    });
+	    return cleanTouchActions(actions.join(' '));
+	  },
+
+	  /**
+	   * this method is called on each input cycle and provides the preventing of the browser behavior
+	   * @param {Object} input
+	   */
+	  preventDefaults: function(input) {
+	    var srcEvent = input.srcEvent;
+	    var direction = input.offsetDirection;
+
+	    // if the touch action did prevented once this session
+	    if (this.manager.session.prevented) {
+	      srcEvent.preventDefault();
+	      return;
+	    }
+
+	    var actions = this.actions;
+	    var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
+	    var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
+	    var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
+
+	    if (hasNone) {
+	      //do not prevent defaults if this is a tap gesture
+
+	      var isTapPointer = input.pointers.length === 1;
+	      var isTapMovement = input.distance < 2;
+	      var isTapTouchTime = input.deltaTime < 250;
+
+	      if (isTapPointer && isTapMovement && isTapTouchTime) {
+	        return;
+	      }
+	    }
+
+	    if (hasPanX && hasPanY) {
+	      // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
+	      return;
+	    }
+
+	    if (hasNone ||
+	      (hasPanY && direction & DIRECTION_HORIZONTAL) ||
+	      (hasPanX && direction & DIRECTION_VERTICAL)) {
+	      return this.preventSrc(srcEvent);
+	    }
+	  },
+
+	  /**
+	   * call preventDefault to prevent the browser's default behavior (scrolling in most cases)
+	   * @param {Object} srcEvent
+	   */
+	  preventSrc: function(srcEvent) {
+	    this.manager.session.prevented = true;
+	    srcEvent.preventDefault();
+	  }
+	};
+
+	/**
+	 * when the touchActions are collected they are not a valid value, so we need to clean things up. *
+	 * @param {String} actions
+	 * @returns {*}
+	 */
+	function cleanTouchActions(actions) {
+	  // none
+	  if (inStr(actions, TOUCH_ACTION_NONE)) {
+	    return TOUCH_ACTION_NONE;
+	  }
+
+	  var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
+	  var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
+
+	  // if both pan-x and pan-y are set (different recognizers
+	  // for different directions, e.g. horizontal pan but vertical swipe?)
+	  // we need none (as otherwise with pan-x pan-y combined none of these
+	  // recognizers will work, since the browser would handle all panning
+	  if (hasPanX && hasPanY) {
+	    return TOUCH_ACTION_NONE;
+	  }
+
+	  // pan-x OR pan-y
+	  if (hasPanX || hasPanY) {
+	    return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
+	  }
+
+	  // manipulation
+	  if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
+	    return TOUCH_ACTION_MANIPULATION;
+	  }
+
+	  return TOUCH_ACTION_AUTO;
+	}
+
+	function getTouchActionProps() {
+	  if (!NATIVE_TOUCH_ACTION) {
+	    return false;
+	  }
+	  var touchMap = {};
+	  var cssSupports = window.CSS && window.CSS.supports;
+	  ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) {
+
+	    // If css.supports is not supported but there is native touch-action assume it supports
+	    // all values. This is the case for IE 10 and 11.
+	    touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
+	  });
+	  return touchMap;
+	}
+
+	/**
+	 * Recognizer flow explained; *
+	 * All recognizers have the initial state of POSSIBLE when a input session starts.
+	 * The definition of a input session is from the first input until the last input, with all it's movement in it. *
+	 * Example session for mouse-input: mousedown -> mousemove -> mouseup
+	 *
+	 * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
+	 * which determines with state it should be.
+	 *
+	 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
+	 * POSSIBLE to give it another change on the next cycle.
+	 *
+	 *               Possible
+	 *                  |
+	 *            +-----+---------------+
+	 *            |                     |
+	 *      +-----+-----+               |
+	 *      |           |               |
+	 *   Failed      Cancelled          |
+	 *                          +-------+------+
+	 *                          |              |
+	 *                      Recognized       Began
+	 *                                         |
+	 *                                      Changed
+	 *                                         |
+	 *                                  Ended/Recognized
+	 */
+	var STATE_POSSIBLE = 1;
+	var STATE_BEGAN = 2;
+	var STATE_CHANGED = 4;
+	var STATE_ENDED = 8;
+	var STATE_RECOGNIZED = STATE_ENDED;
+	var STATE_CANCELLED = 16;
+	var STATE_FAILED = 32;
+
+	/**
+	 * Recognizer
+	 * Every recognizer needs to extend from this class.
+	 * @constructor
+	 * @param {Object} options
+	 */
+	function Recognizer(options) {
+	  this.options = assign({}, this.defaults, options || {});
+
+	  this.id = uniqueId();
+
+	  this.manager = null;
+
+	  // default is enable true
+	  this.options.enable = ifUndefined(this.options.enable, true);
+
+	  this.state = STATE_POSSIBLE;
+
+	  this.simultaneous = {};
+	  this.requireFail = [];
+	}
+
+	Recognizer.prototype = {
+	  /**
+	   * @virtual
+	   * @type {Object}
+	   */
+	  defaults: {},
+
+	  /**
+	   * set options
+	   * @param {Object} options
+	   * @return {Recognizer}
+	   */
+	  set: function(options) {
+	    assign(this.options, options);
+
+	    // also update the touchAction, in case something changed about the directions/enabled state
+	    this.manager && this.manager.touchAction.update();
+	    return this;
+	  },
+
+	  /**
+	   * recognize simultaneous with an other recognizer.
+	   * @param {Recognizer} otherRecognizer
+	   * @returns {Recognizer} this
+	   */
+	  recognizeWith: function(otherRecognizer) {
+	    if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
+	      return this;
+	    }
+
+	    var simultaneous = this.simultaneous;
+	    otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
+	    if (!simultaneous[otherRecognizer.id]) {
+	      simultaneous[otherRecognizer.id] = otherRecognizer;
+	      otherRecognizer.recognizeWith(this);
+	    }
+	    return this;
+	  },
+
+	  /**
+	   * drop the simultaneous link. it doesnt remove the link on the other recognizer.
+	   * @param {Recognizer} otherRecognizer
+	   * @returns {Recognizer} this
+	   */
+	  dropRecognizeWith: function(otherRecognizer) {
+	    if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
+	      return this;
+	    }
+
+	    otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
+	    delete this.simultaneous[otherRecognizer.id];
+	    return this;
+	  },
+
+	  /**
+	   * recognizer can only run when an other is failing
+	   * @param {Recognizer} otherRecognizer
+	   * @returns {Recognizer} this
+	   */
+	  requireFailure: function(otherRecognizer) {
+	    if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
+	      return this;
+	    }
+
+	    var requireFail = this.requireFail;
+	    otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
+	    if (inArray(requireFail, otherRecognizer) === -1) {
+	      requireFail.push(otherRecognizer);
+	      otherRecognizer.requireFailure(this);
+	    }
+	    return this;
+	  },
+
+	  /**
+	   * drop the requireFailure link. it does not remove the link on the other recognizer.
+	   * @param {Recognizer} otherRecognizer
+	   * @returns {Recognizer} this
+	   */
+	  dropRequireFailure: function(otherRecognizer) {
+	    if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
+	      return this;
+	    }
+
+	    otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
+	    var index = inArray(this.requireFail, otherRecognizer);
+	    if (index > -1) {
+	      this.requireFail.splice(index, 1);
+	    }
+	    return this;
+	  },
+
+	  /**
+	   * has require failures boolean
+	   * @returns {boolean}
+	   */
+	  hasRequireFailures: function() {
+	    return this.requireFail.length > 0;
+	  },
+
+	  /**
+	   * if the recognizer can recognize simultaneous with an other recognizer
+	   * @param {Recognizer} otherRecognizer
+	   * @returns {Boolean}
+	   */
+	  canRecognizeWith: function(otherRecognizer) {
+	    return !!this.simultaneous[otherRecognizer.id];
+	  },
+
+	  /**
+	   * You should use `tryEmit` instead of `emit` directly to check
+	   * that all the needed recognizers has failed before emitting.
+	   * @param {Object} input
+	   */
+	  emit: function(input) {
+	    var self = this;
+	    var state = this.state;
+
+	    function emit(event) {
+	      self.manager.emit(event, input);
+	    }
+
+	    // 'panstart' and 'panmove'
+	    if (state < STATE_ENDED) {
+	      emit(self.options.event + stateStr(state));
+	    }
+
+	    emit(self.options.event); // simple 'eventName' events
+
+	    if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)
+	      emit(input.additionalEvent);
+	    }
+
+	    // panend and pancancel
+	    if (state >= STATE_ENDED) {
+	      emit(self.options.event + stateStr(state));
+	    }
+	  },
+
+	  /**
+	   * Check that all the require failure recognizers has failed,
+	   * if true, it emits a gesture event,
+	   * otherwise, setup the state to FAILED.
+	   * @param {Object} input
+	   */
+	  tryEmit: function(input) {
+	    if (this.canEmit()) {
+	      return this.emit(input);
+	    }
+	    // it's failing anyway
+	    this.state = STATE_FAILED;
+	  },
+
+	  /**
+	   * can we emit?
+	   * @returns {boolean}
+	   */
+	  canEmit: function() {
+	    var i = 0;
+	    while (i < this.requireFail.length) {
+	      if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
+	        return false;
+	      }
+	      i++;
+	    }
+	    return true;
+	  },
+
+	  /**
+	   * update the recognizer
+	   * @param {Object} inputData
+	   */
+	  recognize: function(inputData) {
+	    // make a new copy of the inputData
+	    // so we can change the inputData without messing up the other recognizers
+	    var inputDataClone = assign({}, inputData);
+
+	    // is is enabled and allow recognizing?
+	    if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
+	      this.reset();
+	      this.state = STATE_FAILED;
+	      return;
+	    }
+
+	    // reset when we've reached the end
+	    if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
+	      this.state = STATE_POSSIBLE;
+	    }
+
+	    this.state = this.process(inputDataClone);
+
+	    // the recognizer has recognized a gesture
+	    // so trigger an event
+	    if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
+	      this.tryEmit(inputDataClone);
+	    }
+	  },
+
+	  /**
+	   * return the state of the recognizer
+	   * the actual recognizing happens in this method
+	   * @virtual
+	   * @param {Object} inputData
+	   * @returns {Const} STATE
+	   */
+	  process: function(inputData) { }, // jshint ignore:line
+
+	  /**
+	   * return the preferred touch-action
+	   * @virtual
+	   * @returns {Array}
+	   */
+	  getTouchAction: function() { },
+
+	  /**
+	   * called when the gesture isn't allowed to recognize
+	   * like when another is being recognized or it is disabled
+	   * @virtual
+	   */
+	  reset: function() { }
+	};
+
+	/**
+	 * get a usable string, used as event postfix
+	 * @param {Const} state
+	 * @returns {String} state
+	 */
+	function stateStr(state) {
+	  if (state & STATE_CANCELLED) {
+	    return 'cancel';
+	  } else if (state & STATE_ENDED) {
+	    return 'end';
+	  } else if (state & STATE_CHANGED) {
+	    return 'move';
+	  } else if (state & STATE_BEGAN) {
+	    return 'start';
+	  }
+	  return '';
+	}
+
+	/**
+	 * direction cons to string
+	 * @param {Const} direction
+	 * @returns {String}
+	 */
+	function directionStr(direction) {
+	  if (direction == DIRECTION_DOWN) {
+	    return 'down';
+	  } else if (direction == DIRECTION_UP) {
+	    return 'up';
+	  } else if (direction == DIRECTION_LEFT) {
+	    return 'left';
+	  } else if (direction == DIRECTION_RIGHT) {
+	    return 'right';
+	  }
+	  return '';
+	}
+
+	/**
+	 * get a recognizer by name if it is bound to a manager
+	 * @param {Recognizer|String} otherRecognizer
+	 * @param {Recognizer} recognizer
+	 * @returns {Recognizer}
+	 */
+	function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
+	  var manager = recognizer.manager;
+	  if (manager) {
+	    return manager.get(otherRecognizer);
+	  }
+	  return otherRecognizer;
+	}
+
+	/**
+	 * This recognizer is just used as a base for the simple attribute recognizers.
+	 * @constructor
+	 * @extends Recognizer
+	 */
+	function AttrRecognizer() {
+	  Recognizer.apply(this, arguments);
+	}
+
+	inherit(AttrRecognizer, Recognizer, {
+	  /**
+	   * @namespace
+	   * @memberof AttrRecognizer
+	   */
+	  defaults: {
+	    /**
+	     * @type {Number}
+	     * @default 1
+	     */
+	    pointers: 1
+	  },
+
+	  /**
+	   * Used to check if it the recognizer receives valid input, like input.distance > 10.
+	   * @memberof AttrRecognizer
+	   * @param {Object} input
+	   * @returns {Boolean} recognized
+	   */
+	  attrTest: function(input) {
+	    var optionPointers = this.options.pointers;
+	    return optionPointers === 0 || input.pointers.length === optionPointers;
+	  },
+
+	  /**
+	   * Process the input and return the state for the recognizer
+	   * @memberof AttrRecognizer
+	   * @param {Object} input
+	   * @returns {*} State
+	   */
+	  process: function(input) {
+	    var state = this.state;
+	    var eventType = input.eventType;
+
+	    var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
+	    var isValid = this.attrTest(input);
+
+	    // on cancel input and we've recognized before, return STATE_CANCELLED
+	    if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
+	      return state | STATE_CANCELLED;
+	    } else if (isRecognized || isValid) {
+	      if (eventType & INPUT_END) {
+	        return state | STATE_ENDED;
+	      } else if (!(state & STATE_BEGAN)) {
+	        return STATE_BEGAN;
+	      }
+	      return state | STATE_CHANGED;
+	    }
+	    return STATE_FAILED;
+	  }
+	});
+
+	/**
+	 * Pan
+	 * Recognized when the pointer is down and moved in the allowed direction.
+	 * @constructor
+	 * @extends AttrRecognizer
+	 */
+	function PanRecognizer() {
+	  AttrRecognizer.apply(this, arguments);
+
+	  this.pX = null;
+	  this.pY = null;
+	}
+
+	inherit(PanRecognizer, AttrRecognizer, {
+	  /**
+	   * @namespace
+	   * @memberof PanRecognizer
+	   */
+	  defaults: {
+	    event: 'pan',
+	    threshold: 10,
+	    pointers: 1,
+	    direction: DIRECTION_ALL
+	  },
+
+	  getTouchAction: function() {
+	    var direction = this.options.direction;
+	    var actions = [];
+	    if (direction & DIRECTION_HORIZONTAL) {
+	      actions.push(TOUCH_ACTION_PAN_Y);
+	    }
+	    if (direction & DIRECTION_VERTICAL) {
+	      actions.push(TOUCH_ACTION_PAN_X);
+	    }
+	    return actions;
+	  },
+
+	  directionTest: function(input) {
+	    var options = this.options;
+	    var hasMoved = true;
+	    var distance = input.distance;
+	    var direction = input.direction;
+	    var x = input.deltaX;
+	    var y = input.deltaY;
+
+	    // lock to axis?
+	    if (!(direction & options.direction)) {
+	      if (options.direction & DIRECTION_HORIZONTAL) {
+	        direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
+	        hasMoved = x != this.pX;
+	        distance = Math.abs(input.deltaX);
+	      } else {
+	        direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
+	        hasMoved = y != this.pY;
+	        distance = Math.abs(input.deltaY);
+	      }
+	    }
+	    input.direction = direction;
+	    return hasMoved && distance > options.threshold && direction & options.direction;
+	  },
+
+	  attrTest: function(input) {
+	    return AttrRecognizer.prototype.attrTest.call(this, input) &&
+	      (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));
+	  },
+
+	  emit: function(input) {
+
+	    this.pX = input.deltaX;
+	    this.pY = input.deltaY;
+
+	    var direction = directionStr(input.direction);
+
+	    if (direction) {
+	      input.additionalEvent = this.options.event + direction;
+	    }
+	    this._super.emit.call(this, input);
+	  }
+	});
+
+	/**
+	 * Pinch
+	 * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
+	 * @constructor
+	 * @extends AttrRecognizer
+	 */
+	function PinchRecognizer() {
+	  AttrRecognizer.apply(this, arguments);
+	}
+
+	inherit(PinchRecognizer, AttrRecognizer, {
+	  /**
+	   * @namespace
+	   * @memberof PinchRecognizer
+	   */
+	  defaults: {
+	    event: 'pinch',
+	    threshold: 0,
+	    pointers: 2
+	  },
+
+	  getTouchAction: function() {
+	    return [TOUCH_ACTION_NONE];
+	  },
+
+	  attrTest: function(input) {
+	    return this._super.attrTest.call(this, input) &&
+	      (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
+	  },
+
+	  emit: function(input) {
+	    if (input.scale !== 1) {
+	      var inOut = input.scale < 1 ? 'in' : 'out';
+	      input.additionalEvent = this.options.event + inOut;
+	    }
+	    this._super.emit.call(this, input);
+	  }
+	});
+
+	/**
+	 * Press
+	 * Recognized when the pointer is down for x ms without any movement.
+	 * @constructor
+	 * @extends Recognizer
+	 */
+	function PressRecognizer() {
+	  Recognizer.apply(this, arguments);
+
+	  this._timer = null;
+	  this._input = null;
+	}
+
+	inherit(PressRecognizer, Recognizer, {
+	  /**
+	   * @namespace
+	   * @memberof PressRecognizer
+	   */
+	  defaults: {
+	    event: 'press',
+	    pointers: 1,
+	    time: 251, // minimal time of the pointer to be pressed
+	    threshold: 9 // a minimal movement is ok, but keep it low
+	  },
+
+	  getTouchAction: function() {
+	    return [TOUCH_ACTION_AUTO];
+	  },
+
+	  process: function(input) {
+	    var options = this.options;
+	    var validPointers = input.pointers.length === options.pointers;
+	    var validMovement = input.distance < options.threshold;
+	    var validTime = input.deltaTime > options.time;
+
+	    this._input = input;
+
+	    // we only allow little movement
+	    // and we've reached an end event, so a tap is possible
+	    if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {
+	      this.reset();
+	    } else if (input.eventType & INPUT_START) {
+	      this.reset();
+	      this._timer = setTimeoutContext(function() {
+	        this.state = STATE_RECOGNIZED;
+	        this.tryEmit();
+	      }, options.time, this);
+	    } else if (input.eventType & INPUT_END) {
+	      return STATE_RECOGNIZED;
+	    }
+	    return STATE_FAILED;
+	  },
+
+	  reset: function() {
+	    clearTimeout(this._timer);
+	  },
+
+	  emit: function(input) {
+	    if (this.state !== STATE_RECOGNIZED) {
+	      return;
+	    }
+
+	    if (input && (input.eventType & INPUT_END)) {
+	      this.manager.emit(this.options.event + 'up', input);
+	    } else {
+	      this._input.timeStamp = now();
+	      this.manager.emit(this.options.event, this._input);
+	    }
+	  }
+	});
+
+	/**
+	 * Rotate
+	 * Recognized when two or more pointer are moving in a circular motion.
+	 * @constructor
+	 * @extends AttrRecognizer
+	 */
+	function RotateRecognizer() {
+	  AttrRecognizer.apply(this, arguments);
+	}
+
+	inherit(RotateRecognizer, AttrRecognizer, {
+	  /**
+	   * @namespace
+	   * @memberof RotateRecognizer
+	   */
+	  defaults: {
+	    event: 'rotate',
+	    threshold: 0,
+	    pointers: 2
+	  },
+
+	  getTouchAction: function() {
+	    return [TOUCH_ACTION_NONE];
+	  },
+
+	  attrTest: function(input) {
+	    return this._super.attrTest.call(this, input) &&
+	      (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
+	  }
+	});
+
+	/**
+	 * Swipe
+	 * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
+	 * @constructor
+	 * @extends AttrRecognizer
+	 */
+	function SwipeRecognizer() {
+	  AttrRecognizer.apply(this, arguments);
+	}
+
+	inherit(SwipeRecognizer, AttrRecognizer, {
+	  /**
+	   * @namespace
+	   * @memberof SwipeRecognizer
+	   */
+	  defaults: {
+	    event: 'swipe',
+	    threshold: 10,
+	    velocity: 0.3,
+	    direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
+	    pointers: 1
+	  },
+
+	  getTouchAction: function() {
+	    return PanRecognizer.prototype.getTouchAction.call(this);
+	  },
+
+	  attrTest: function(input) {
+	    var direction = this.options.direction;
+	    var velocity;
+
+	    if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
+	      velocity = input.overallVelocity;
+	    } else if (direction & DIRECTION_HORIZONTAL) {
+	      velocity = input.overallVelocityX;
+	    } else if (direction & DIRECTION_VERTICAL) {
+	      velocity = input.overallVelocityY;
+	    }
+
+	    return this._super.attrTest.call(this, input) &&
+	      direction & input.offsetDirection &&
+	      input.distance > this.options.threshold &&
+	      input.maxPointers == this.options.pointers &&
+	      abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
+	  },
+
+	  emit: function(input) {
+	    var direction = directionStr(input.offsetDirection);
+	    if (direction) {
+	      this.manager.emit(this.options.event + direction, input);
+	    }
+
+	    this.manager.emit(this.options.event, input);
+	  }
+	});
+
+	/**
+	 * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
+	 * between the given interval and position. The delay option can be used to recognize multi-taps without firing
+	 * a single tap.
+	 *
+	 * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
+	 * multi-taps being recognized.
+	 * @constructor
+	 * @extends Recognizer
+	 */
+	function TapRecognizer() {
+	  Recognizer.apply(this, arguments);
+
+	  // previous time and center,
+	  // used for tap counting
+	  this.pTime = false;
+	  this.pCenter = false;
+
+	  this._timer = null;
+	  this._input = null;
+	  this.count = 0;
+	}
+
+	inherit(TapRecognizer, Recognizer, {
+	  /**
+	   * @namespace
+	   * @memberof PinchRecognizer
+	   */
+	  defaults: {
+	    event: 'tap',
+	    pointers: 1,
+	    taps: 1,
+	    interval: 300, // max time between the multi-tap taps
+	    time: 250, // max time of the pointer to be down (like finger on the screen)
+	    threshold: 9, // a minimal movement is ok, but keep it low
+	    posThreshold: 10 // a multi-tap can be a bit off the initial position
+	  },
+
+	  getTouchAction: function() {
+	    return [TOUCH_ACTION_MANIPULATION];
+	  },
+
+	  process: function(input) {
+	    var options = this.options;
+
+	    var validPointers = input.pointers.length === options.pointers;
+	    var validMovement = input.distance < options.threshold;
+	    var validTouchTime = input.deltaTime < options.time;
+
+	    this.reset();
+
+	    if ((input.eventType & INPUT_START) && (this.count === 0)) {
+	      return this.failTimeout();
+	    }
+
+	    // we only allow little movement
+	    // and we've reached an end event, so a tap is possible
+	    if (validMovement && validTouchTime && validPointers) {
+	      if (input.eventType != INPUT_END) {
+	        return this.failTimeout();
+	      }
+
+	      var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;
+	      var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
+
+	      this.pTime = input.timeStamp;
+	      this.pCenter = input.center;
+
+	      if (!validMultiTap || !validInterval) {
+	        this.count = 1;
+	      } else {
+	        this.count += 1;
+	      }
+
+	      this._input = input;
+
+	      // if tap count matches we have recognized it,
+	      // else it has began recognizing...
+	      var tapCount = this.count % options.taps;
+	      if (tapCount === 0) {
+	        // no failing requirements, immediately trigger the tap event
+	        // or wait as long as the multitap interval to trigger
+	        if (!this.hasRequireFailures()) {
+	          return STATE_RECOGNIZED;
+	        } else {
+	          this._timer = setTimeoutContext(function() {
+	            this.state = STATE_RECOGNIZED;
+	            this.tryEmit();
+	          }, options.interval, this);
+	          return STATE_BEGAN;
+	        }
+	      }
+	    }
+	    return STATE_FAILED;
+	  },
+
+	  failTimeout: function() {
+	    this._timer = setTimeoutContext(function() {
+	      this.state = STATE_FAILED;
+	    }, this.options.interval, this);
+	    return STATE_FAILED;
+	  },
+
+	  reset: function() {
+	    clearTimeout(this._timer);
+	  },
+
+	  emit: function() {
+	    if (this.state == STATE_RECOGNIZED) {
+	      this._input.tapCount = this.count;
+	      this.manager.emit(this.options.event, this._input);
+	    }
+	  }
+	});
+
+	/**
+	 * Simple way to create a manager with a default set of recognizers.
+	 * @param {HTMLElement} element
+	 * @param {Object} [options]
+	 * @constructor
+	 */
+	function Hammer(element, options) {
+	  options = options || {};
+	  options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
+	  return new Manager(element, options);
+	}
+
+	/**
+	 * @const {string}
+	 */
+	Hammer.VERSION = '2.0.7';
+
+	/**
+	 * default settings
+	 * @namespace
+	 */
+	Hammer.defaults = {
+	  /**
+	   * set if DOM events are being triggered.
+	   * But this is slower and unused by simple implementations, so disabled by default.
+	   * @type {Boolean}
+	   * @default false
+	   */
+	  domEvents: false,
+
+	  /**
+	   * The value for the touchAction property/fallback.
+	   * When set to `compute` it will magically set the correct value based on the added recognizers.
+	   * @type {String}
+	   * @default compute
+	   */
+	  touchAction: TOUCH_ACTION_COMPUTE,
+
+	  /**
+	   * @type {Boolean}
+	   * @default true
+	   */
+	  enable: true,
+
+	  /**
+	   * EXPERIMENTAL FEATURE -- can be removed/changed
+	   * Change the parent input target element.
+	   * If Null, then it is being set the to main element.
+	   * @type {Null|EventTarget}
+	   * @default null
+	   */
+	  inputTarget: null,
+
+	  /**
+	   * force an input class
+	   * @type {Null|Function}
+	   * @default null
+	   */
+	  inputClass: null,
+
+	  /**
+	   * Default recognizer setup when calling `Hammer()`
+	   * When creating a new Manager these will be skipped.
+	   * @type {Array}
+	   */
+	  preset: [
+	    // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
+	    [RotateRecognizer, {enable: false}],
+	    [PinchRecognizer, {enable: false}, ['rotate']],
+	    [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],
+	    [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],
+	    [TapRecognizer],
+	    [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],
+	    [PressRecognizer]
+	  ],
+
+	  /**
+	   * Some CSS properties can be used to improve the working of Hammer.
+	   * Add them to this method and they will be set when creating a new Manager.
+	   * @namespace
+	   */
+	  cssProps: {
+	    /**
+	     * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
+	     * @type {String}
+	     * @default 'none'
+	     */
+	    userSelect: 'none',
+
+	    /**
+	     * Disable the Windows Phone grippers when pressing an element.
+	     * @type {String}
+	     * @default 'none'
+	     */
+	    touchSelect: 'none',
+
+	    /**
+	     * Disables the default callout shown when you touch and hold a touch target.
+	     * On iOS, when you touch and hold a touch target such as a link, Safari displays
+	     * a callout containing information about the link. This property allows you to disable that callout.
+	     * @type {String}
+	     * @default 'none'
+	     */
+	    touchCallout: 'none',
+
+	    /**
+	     * Specifies whether zooming is enabled. Used by IE10>
+	     * @type {String}
+	     * @default 'none'
+	     */
+	    contentZooming: 'none',
+
+	    /**
+	     * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
+	     * @type {String}
+	     * @default 'none'
+	     */
+	    userDrag: 'none',
+
+	    /**
+	     * Overrides the highlight color shown when the user taps a link or a JavaScript
+	     * clickable element in iOS. This property obeys the alpha value, if specified.
+	     * @type {String}
+	     * @default 'rgba(0,0,0,0)'
+	     */
+	    tapHighlightColor: 'rgba(0,0,0,0)'
+	  }
+	};
+
+	var STOP = 1;
+	var FORCED_STOP = 2;
+
+	/**
+	 * Manager
+	 * @param {HTMLElement} element
+	 * @param {Object} [options]
+	 * @constructor
+	 */
+	function Manager(element, options) {
+	  this.options = assign({}, Hammer.defaults, options || {});
+
+	  this.options.inputTarget = this.options.inputTarget || element;
+
+	  this.handlers = {};
+	  this.session = {};
+	  this.recognizers = [];
+	  this.oldCssProps = {};
+
+	  this.element = element;
+	  this.input = createInputInstance(this);
+	  this.touchAction = new TouchAction(this, this.options.touchAction);
+
+	  toggleCssProps(this, true);
+
+	  each(this.options.recognizers, function(item) {
+	    var recognizer = this.add(new (item[0])(item[1]));
+	    item[2] && recognizer.recognizeWith(item[2]);
+	    item[3] && recognizer.requireFailure(item[3]);
+	  }, this);
+	}
+
+	Manager.prototype = {
+	  /**
+	   * set options
+	   * @param {Object} options
+	   * @returns {Manager}
+	   */
+	  set: function(options) {
+	    assign(this.options, options);
+
+	    // Options that need a little more setup
+	    if (options.touchAction) {
+	      this.touchAction.update();
+	    }
+	    if (options.inputTarget) {
+	      // Clean up existing event listeners and reinitialize
+	      this.input.destroy();
+	      this.input.target = options.inputTarget;
+	      this.input.init();
+	    }
+	    return this;
+	  },
+
+	  /**
+	   * stop recognizing for this session.
+	   * This session will be discarded, when a new [input]start event is fired.
+	   * When forced, the recognizer cycle is stopped immediately.
+	   * @param {Boolean} [force]
+	   */
+	  stop: function(force) {
+	    this.session.stopped = force ? FORCED_STOP : STOP;
+	  },
+
+	  /**
+	   * run the recognizers!
+	   * called by the inputHandler function on every movement of the pointers (touches)
+	   * it walks through all the recognizers and tries to detect the gesture that is being made
+	   * @param {Object} inputData
+	   */
+	  recognize: function(inputData) {
+	    var session = this.session;
+	    if (session.stopped) {
+	      return;
+	    }
+
+	    // run the touch-action polyfill
+	    this.touchAction.preventDefaults(inputData);
+
+	    var recognizer;
+	    var recognizers = this.recognizers;
+
+	    // this holds the recognizer that is being recognized.
+	    // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
+	    // if no recognizer is detecting a thing, it is set to `null`
+	    var curRecognizer = session.curRecognizer;
+
+	    // reset when the last recognizer is recognized
+	    // or when we're in a new session
+	    if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {
+	      curRecognizer = session.curRecognizer = null;
+	    }
+
+	    var i = 0;
+	    while (i < recognizers.length) {
+	      recognizer = recognizers[i];
+
+	      // find out if we are allowed try to recognize the input for this one.
+	      // 1.   allow if the session is NOT forced stopped (see the .stop() method)
+	      // 2.   allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
+	      //      that is being recognized.
+	      // 3.   allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
+	      //      this can be setup with the `recognizeWith()` method on the recognizer.
+	      if (session.stopped !== FORCED_STOP && ( // 1
+	        !curRecognizer || recognizer == curRecognizer || // 2
+	        recognizer.canRecognizeWith(curRecognizer))) { // 3
+	        recognizer.recognize(inputData);
+	      } else {
+	        recognizer.reset();
+	      }
+
+	      // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
+	      // current active recognizer. but only if we don't already have an active recognizer
+	      if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
+	        curRecognizer = session.curRecognizer = recognizer;
+	      }
+	      i++;
+	    }
+	  },
+
+	  /**
+	   * get a recognizer by its event name.
+	   * @param {Recognizer|String} recognizer
+	   * @returns {Recognizer|Null}
+	   */
+	  get: function(recognizer) {
+	    if (recognizer instanceof Recognizer) {
+	      return recognizer;
+	    }
+
+	    var recognizers = this.recognizers;
+	    for (var i = 0; i < recognizers.length; i++) {
+	      if (recognizers[i].options.event == recognizer) {
+	        return recognizers[i];
+	      }
+	    }
+	    return null;
+	  },
+
+	  /**
+	   * add a recognizer to the manager
+	   * existing recognizers with the same event name will be removed
+	   * @param {Recognizer} recognizer
+	   * @returns {Recognizer|Manager}
+	   */
+	  add: function(recognizer) {
+	    if (invokeArrayArg(recognizer, 'add', this)) {
+	      return this;
+	    }
+
+	    // remove existing
+	    var existing = this.get(recognizer.options.event);
+	    if (existing) {
+	      this.remove(existing);
+	    }
+
+	    this.recognizers.push(recognizer);
+	    recognizer.manager = this;
+
+	    this.touchAction.update();
+	    return recognizer;
+	  },
+
+	  /**
+	   * remove a recognizer by name or instance
+	   * @param {Recognizer|String} recognizer
+	   * @returns {Manager}
+	   */
+	  remove: function(recognizer) {
+	    if (invokeArrayArg(recognizer, 'remove', this)) {
+	      return this;
+	    }
+
+	    recognizer = this.get(recognizer);
+
+	    // let's make sure this recognizer exists
+	    if (recognizer) {
+	      var recognizers = this.recognizers;
+	      var index = inArray(recognizers, recognizer);
+
+	      if (index !== -1) {
+	        recognizers.splice(index, 1);
+	        this.touchAction.update();
+	      }
+	    }
+
+	    return this;
+	  },
+
+	  /**
+	   * bind event
+	   * @param {String} events
+	   * @param {Function} handler
+	   * @returns {EventEmitter} this
+	   */
+	  on: function(events, handler) {
+	    if (events === undefined) {
+	      return;
+	    }
+	    if (handler === undefined) {
+	      return;
+	    }
+
+	    var handlers = this.handlers;
+	    each(splitStr(events), function(event) {
+	      handlers[event] = handlers[event] || [];
+	      handlers[event].push(handler);
+	    });
+	    return this;
+	  },
+
+	  /**
+	   * unbind event, leave emit blank to remove all handlers
+	   * @param {String} events
+	   * @param {Function} [handler]
+	   * @returns {EventEmitter} this
+	   */
+	  off: function(events, handler) {
+	    if (events === undefined) {
+	      return;
+	    }
+
+	    var handlers = this.handlers;
+	    each(splitStr(events), function(event) {
+	      if (!handler) {
+	        delete handlers[event];
+	      } else {
+	        handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
+	      }
+	    });
+	    return this;
+	  },
+
+	  /**
+	   * emit event to the listeners
+	   * @param {String} event
+	   * @param {Object} data
+	   */
+	  emit: function(event, data) {
+	    // we also want to trigger dom events
+	    if (this.options.domEvents) {
+	      triggerDomEvent(event, data);
+	    }
+
+	    // no handlers, so skip it all
+	    var handlers = this.handlers[event] && this.handlers[event].slice();
+	    if (!handlers || !handlers.length) {
+	      return;
+	    }
+
+	    data.type = event;
+	    data.preventDefault = function() {
+	      data.srcEvent.preventDefault();
+	    };
+
+	    var i = 0;
+	    while (i < handlers.length) {
+	      handlers[i](data);
+	      i++;
+	    }
+	  },
+
+	  /**
+	   * destroy the manager and unbinds all events
+	   * it doesn't unbind dom events, that is the user own responsibility
+	   */
+	  destroy: function() {
+	    this.element && toggleCssProps(this, false);
+
+	    this.handlers = {};
+	    this.session = {};
+	    this.input.destroy();
+	    this.element = null;
+	  }
+	};
+
+	/**
+	 * add/remove the css properties as defined in manager.options.cssProps
+	 * @param {Manager} manager
+	 * @param {Boolean} add
+	 */
+	function toggleCssProps(manager, add) {
+	  var element = manager.element;
+	  if (!element.style) {
+	    return;
+	  }
+	  var prop;
+	  each(manager.options.cssProps, function(value, name) {
+	    prop = prefixed(element.style, name);
+	    if (add) {
+	      manager.oldCssProps[prop] = element.style[prop];
+	      element.style[prop] = value;
+	    } else {
+	      element.style[prop] = manager.oldCssProps[prop] || '';
+	    }
+	  });
+	  if (!add) {
+	    manager.oldCssProps = {};
+	  }
+	}
+
+	/**
+	 * trigger dom event
+	 * @param {String} event
+	 * @param {Object} data
+	 */
+	function triggerDomEvent(event, data) {
+	  var gestureEvent = document.createEvent('Event');
+	  gestureEvent.initEvent(event, true, true);
+	  gestureEvent.gesture = data;
+	  data.target.dispatchEvent(gestureEvent);
+	}
+
+	assign(Hammer, {
+	  INPUT_START: INPUT_START,
+	  INPUT_MOVE: INPUT_MOVE,
+	  INPUT_END: INPUT_END,
+	  INPUT_CANCEL: INPUT_CANCEL,
+
+	  STATE_POSSIBLE: STATE_POSSIBLE,
+	  STATE_BEGAN: STATE_BEGAN,
+	  STATE_CHANGED: STATE_CHANGED,
+	  STATE_ENDED: STATE_ENDED,
+	  STATE_RECOGNIZED: STATE_RECOGNIZED,
+	  STATE_CANCELLED: STATE_CANCELLED,
+	  STATE_FAILED: STATE_FAILED,
+
+	  DIRECTION_NONE: DIRECTION_NONE,
+	  DIRECTION_LEFT: DIRECTION_LEFT,
+	  DIRECTION_RIGHT: DIRECTION_RIGHT,
+	  DIRECTION_UP: DIRECTION_UP,
+	  DIRECTION_DOWN: DIRECTION_DOWN,
+	  DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
+	  DIRECTION_VERTICAL: DIRECTION_VERTICAL,
+	  DIRECTION_ALL: DIRECTION_ALL,
+
+	  Manager: Manager,
+	  Input: Input,
+	  TouchAction: TouchAction,
+
+	  TouchInput: TouchInput,
+	  MouseInput: MouseInput,
+	  PointerEventInput: PointerEventInput,
+	  TouchMouseInput: TouchMouseInput,
+	  SingleTouchInput: SingleTouchInput,
+
+	  Recognizer: Recognizer,
+	  AttrRecognizer: AttrRecognizer,
+	  Tap: TapRecognizer,
+	  Pan: PanRecognizer,
+	  Swipe: SwipeRecognizer,
+	  Pinch: PinchRecognizer,
+	  Rotate: RotateRecognizer,
+	  Press: PressRecognizer,
+
+	  on: addEventListeners,
+	  off: removeEventListeners,
+	  each: each,
+	  merge: merge,
+	  extend: extend,
+	  assign: assign,
+	  inherit: inherit,
+	  bindFn: bindFn,
+	  prefixed: prefixed
+	});
+
+	// jquery.hammer.js
+	// This jQuery plugin is just a small wrapper around the Hammer() class.
+	// It also extends the Manager.emit method by triggering jQuery events.
+	// $(element).hammer(options).bind("pan", myPanHandler);
+	// The Hammer instance is stored at $element.data("hammer").
+	// https://github.com/hammerjs/jquery.hammer.js
+
+	(function($, Hammer) {
+	  function hammerify(el, options) {
+	    var $el = $(el);
+	    if (!$el.data('hammer')) {
+	      $el.data('hammer', new Hammer($el[0], options));
+	    }
+	  }
+
+	  $.fn.hammer = function(options) {
+	    return this.each(function() {
+	      hammerify(this, options);
+	    });
+	  };
+
+	  // extend the emit method to also trigger jQuery events
+	  Hammer.Manager.prototype.emit = (function(originalEmit) {
+	    return function(type, data) {
+	      originalEmit.call(this, type, data);
+	      $(this.element).trigger({
+	        type: type,
+	        gesture: data
+	      });
+	    };
+	  })(Hammer.Manager.prototype.emit);
+	})($, Hammer);
+
+	module.exports = UI.Hammer = Hammer;
+
+
+/***/ },
+/* 4 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var UI = __webpack_require__(2);
+
+	/**
+	 * Add to Homescreen v3.2.2
+	 * (c) 2015 Matteo Spinelli
+	 * @license: http://cubiq.org/license
+	 */
+
+	// Check for addEventListener browser support (prevent errors in IE<9)
+	var _eventListener = 'addEventListener' in window;
+
+	// Check if document is loaded, needed by autostart
+	var _DOMReady = false;
+	if (document.readyState === 'complete') {
+	  _DOMReady = true;
+	} else if (_eventListener) {
+	  window.addEventListener('load', loaded, false);
+	}
+
+	function loaded() {
+	  window.removeEventListener('load', loaded, false);
+	  _DOMReady = true;
+	}
+
+	// regex used to detect if app has been added to the homescreen
+	var _reSmartURL = /\/ath(\/)?$/;
+	var _reQueryString = /([\?&]ath=[^&]*$|&ath=[^&]*(&))/;
+
+	// singleton
+	var _instance;
+	function ath(options) {
+	  _instance = _instance || new ath.Class(options);
+
+	  return _instance;
+	}
+
+	// message in all supported languages
+	ath.intl = {
+	  en_us: {
+	    ios: 'To add this web app to the home screen: tap %icon and then <strong>Add to Home Screen</strong>.',
+	    android: 'To add this web app to the home screen open the browser option menu and tap on <strong>Add to homescreen</strong>. <small>The menu can be accessed by pressing the menu hardware button if your device has one, or by tapping the top right menu icon <span class="ath-action-icon">icon</span>.</small>'
+	  },
+
+	  zh_cn: {
+	    ios: '如要把应用程式加至主屏幕,请点击%icon, 然后<strong>加至主屏幕</strong>',
+	    android: 'To add this web app to the home screen open the browser option menu and tap on <strong>Add to homescreen</strong>. <small>The menu can be accessed by pressing the menu hardware button if your device has one, or by tapping the top right menu icon <span class="ath-action-icon">icon</span>.</small>'
+	  },
+
+	  zh_tw: {
+	    ios: '如要把應用程式加至主屏幕, 請點擊%icon, 然後<strong>加至主屏幕</strong>.',
+	    android: 'To add this web app to the home screen open the browser option menu and tap on <strong>Add to homescreen</strong>. <small>The menu can be accessed by pressing the menu hardware button if your device has one, or by tapping the top right menu icon <span class="ath-action-icon">icon</span>.</small>'
+	  }
+	};
+
+	// Add 2 characters language support (Android mostly)
+	for (var lang in ath.intl) {
+	  ath.intl[lang.substr(0, 2)] = ath.intl[lang];
+	}
+
+	// default options
+	ath.defaults = {
+	  appID: 'org.cubiq.addtohome',		// local storage name (no need to change)
+	  fontSize: 15,				// base font size, used to properly resize the popup based on viewport scale factor
+	  debug: false,				// override browser checks
+	  logging: false,				// log reasons for showing or not showing to js console; defaults to true when debug is true
+	  modal: false,				// prevent further actions until the message is closed
+	  mandatory: false,			// you can't proceed if you don't add the app to the homescreen
+	  autostart: true,			// show the message automatically
+	  skipFirstVisit: false,		// show only to returning visitors (ie: skip the first time you visit)
+	  startDelay: 1,				// display the message after that many seconds from page load
+	  lifespan: 15,				// life of the message in seconds
+	  displayPace: 1440,			// minutes before the message is shown again (0: display every time, default 24 hours)
+	  maxDisplayCount: 0,			// absolute maximum number of times the message will be shown to the user (0: no limit)
+	  icon: true,					// add touch icon to the message
+	  message: '',				// the message can be customized
+	  validLocation: [],			// list of pages where the message will be shown (array of regexes)
+	  onInit: null,				// executed on instance creation
+	  onShow: null,				// executed when the message is shown
+	  onRemove: null,				// executed when the message is removed
+	  onAdd: null,				// when the application is launched the first time from the homescreen (guesstimate)
+	  onPrivate: null,			// executed if user is in private mode
+	  privateModeOverride: false,	// show the message even in private mode (very rude)
+	  detectHomescreen: false		// try to detect if the site has been added to the homescreen (false | true | 'hash' | 'queryString' | 'smartURL')
+	};
+
+	// browser info and capability
+	var _ua = window.navigator.userAgent;
+
+	var _nav = window.navigator;
+	_extend(ath, {
+	  hasToken: document.location.hash == '#ath' || _reSmartURL.test(document.location.href) || _reQueryString.test(document.location.search),
+	  isRetina: window.devicePixelRatio && window.devicePixelRatio > 1,
+	  isIDevice: (/iphone|ipod|ipad/i).test(_ua),
+	  isMobileChrome: _ua.indexOf('Android') > -1 && (/Chrome\/[.0-9]*/).test(_ua) && _ua.indexOf("Version") == -1,
+	  isMobileIE: _ua.indexOf('Windows Phone') > -1,
+	  language: _nav.language && _nav.language.toLowerCase().replace('-', '_') || ''
+	});
+
+	// falls back to en_us if language is unsupported
+	ath.language = ath.language && ath.language in ath.intl ? ath.language : 'en_us';
+
+	ath.isMobileSafari = ath.isIDevice && _ua.indexOf('Safari') > -1 && _ua.indexOf('CriOS') < 0;
+	ath.OS = ath.isIDevice ? 'ios' : ath.isMobileChrome ? 'android' : ath.isMobileIE ? 'windows' : 'unsupported';
+
+	ath.OSVersion = _ua.match(/(OS|Android) (\d+[_\.]\d+)/);
+	ath.OSVersion = ath.OSVersion && ath.OSVersion[2] ? +ath.OSVersion[2].replace('_', '.') : 0;
+
+	ath.isStandalone = 'standalone' in window.navigator && window.navigator.standalone;
+	ath.isTablet = (ath.isMobileSafari && _ua.indexOf('iPad') > -1) || (ath.isMobileChrome && _ua.indexOf('Mobile') < 0);
+
+	ath.isCompatible = (ath.isMobileSafari && ath.OSVersion >= 6) || ath.isMobileChrome;	// TODO: add winphone
+
+	var _defaultSession = {
+	  lastDisplayTime: 0,			// last time we displayed the message
+	  returningVisitor: false,	// is this the first time you visit
+	  displayCount: 0,			// number of times the message has been shown
+	  optedout: false,			// has the user opted out
+	  added: false				// has been actually added to the homescreen
+	};
+
+	ath.removeSession = function(appID) {
+	  try {
+	    if (!localStorage) {
+	      throw new Error('localStorage is not defined');
+	    }
+
+	    localStorage.removeItem(appID || ath.defaults.appID);
+	  } catch (e) {
+	    // we are most likely in private mode
+	  }
+	};
+
+	ath.doLog = function(logStr) {
+	  if (this.options.logging) {
+	    console.log(logStr);
+	  }
+	};
+
+	ath.Class = function(options) {
+	  // class methods
+	  this.doLog = ath.doLog;
+
+	  // merge default options with user config
+	  this.options = _extend({}, ath.defaults);
+	  _extend(this.options, options);
+	  // override defaults that are dependent on each other
+	  if (this.options.debug) {
+	    this.options.logging = true;
+	  }
+
+	  // IE<9 so exit (I hate you, really)
+	  if (!_eventListener) {
+	    return;
+	  }
+
+	  // normalize some options
+	  this.options.mandatory = this.options.mandatory && ( 'standalone' in window.navigator || this.options.debug );
+	  this.options.modal = this.options.modal || this.options.mandatory;
+	  if (this.options.mandatory) {
+	    this.options.startDelay = -0.5;		// make the popup hasty
+	  }
+	  this.options.detectHomescreen = this.options.detectHomescreen === true ? 'hash' : this.options.detectHomescreen;
+
+	  // setup the debug environment
+	  if (this.options.debug) {
+	    ath.isCompatible = true;
+	    ath.OS = typeof this.options.debug == 'string' ? this.options.debug : ath.OS == 'unsupported' ? 'android' : ath.OS;
+	    ath.OSVersion = ath.OS == 'ios' ? '8' : '4';
+	  }
+
+	  // the element the message will be appended to
+	  this.container = document.documentElement;
+
+	  // load session
+	  this.session = this.getItem(this.options.appID);
+	  this.session = this.session ? JSON.parse(this.session) : undefined;
+
+	  // user most likely came from a direct link containing our token, we don't need it and we remove it
+	  if (ath.hasToken && ( !ath.isCompatible || !this.session )) {
+	    ath.hasToken = false;
+	    _removeToken();
+	  }
+
+	  // the device is not supported
+	  if (!ath.isCompatible) {
+	    this.doLog("Add to homescreen: not displaying callout because device not supported");
+	    return;
+	  }
+
+	  this.session = this.session || _defaultSession;
+
+	  // check if we can use the local storage
+	  try {
+	    if (!localStorage) {
+	      throw new Error('localStorage is not defined');
+	    }
+
+	    localStorage.setItem(this.options.appID, JSON.stringify(this.session));
+	    ath.hasLocalStorage = true;
+	  } catch (e) {
+	    // we are most likely in private mode
+	    ath.hasLocalStorage = false;
+
+	    if (this.options.onPrivate) {
+	      this.options.onPrivate.call(this);
+	    }
+	  }
+
+	  // check if this is a valid location
+	  var isValidLocation = !this.options.validLocation.length;
+	  for (var i = this.options.validLocation.length; i--;) {
+	    if (this.options.validLocation[i].test(document.location.href)) {
+	      isValidLocation = true;
+	      break;
+	    }
+	  }
+
+	  // check compatibility with old versions of add to homescreen. Opt-out if an old session is found
+	  if (this.getItem('addToHome')) {
+	    this.optOut();
+	  }
+
+	  // critical errors:
+	  if (this.session.optedout) {
+	    this.doLog("Add to homescreen: not displaying callout because user opted out");
+	    return;
+	  }
+	  if (this.session.added) {
+	    this.doLog("Add to homescreen: not displaying callout because already added to the homescreen");
+	    return;
+	  }
+	  if (!isValidLocation) {
+	    this.doLog("Add to homescreen: not displaying callout because not a valid location");
+	    return;
+	  }
+
+	  // check if the app is in stand alone mode
+	  if (ath.isStandalone) {
+	    // execute the onAdd event if we haven't already
+	    if (!this.session.added) {
+	      this.session.added = true;
+	      this.updateSession();
+
+	      if (this.options.onAdd && ath.hasLocalStorage) {	// double check on localstorage to avoid multiple calls to the custom event
+	        this.options.onAdd.call(this);
+	      }
+	    }
+
+	    this.doLog("Add to homescreen: not displaying callout because in standalone mode");
+	    return;
+	  }
+
+	  // (try to) check if the page has been added to the homescreen
+	  if (this.options.detectHomescreen) {
+	    // the URL has the token, we are likely coming from the homescreen
+	    if (ath.hasToken) {
+	      _removeToken();		// we don't actually need the token anymore, we remove it to prevent redistribution
+
+	      // this is called the first time the user opens the app from the homescreen
+	      if (!this.session.added) {
+	        this.session.added = true;
+	        this.updateSession();
+
+	        if (this.options.onAdd && ath.hasLocalStorage) {	// double check on localstorage to avoid multiple calls to the custom event
+	          this.options.onAdd.call(this);
+	        }
+	      }
+
+	      this.doLog("Add to homescreen: not displaying callout because URL has token, so we are likely coming from homescreen");
+	      return;
+	    }
+
+	    // URL doesn't have the token, so add it
+	    if (this.options.detectHomescreen == 'hash') {
+	      history.replaceState('', window.document.title, document.location.href + '#ath');
+	    } else if (this.options.detectHomescreen == 'smartURL') {
+	      history.replaceState('', window.document.title, document.location.href.replace(/(\/)?$/, '/ath$1'));
+	    } else {
+	      history.replaceState('', window.document.title, document.location.href + (document.location.search ? '&' : '?' ) + 'ath=');
+	    }
+	  }
+
+	  // check if this is a returning visitor
+	  if (!this.session.returningVisitor) {
+	    this.session.returningVisitor = true;
+	    this.updateSession();
+
+	    // we do not show the message if this is your first visit
+	    if (this.options.skipFirstVisit) {
+	      this.doLog("Add to homescreen: not displaying callout because skipping first visit");
+	      return;
+	    }
+	  }
+
+	  // we do no show the message in private mode
+	  if (!this.options.privateModeOverride && !ath.hasLocalStorage) {
+	    this.doLog("Add to homescreen: not displaying callout because browser is in private mode");
+	    return;
+	  }
+
+	  // all checks passed, ready to display
+	  this.ready = true;
+
+	  if (this.options.onInit) {
+	    this.options.onInit.call(this);
+	  }
+
+	  if (this.options.autostart) {
+	    this.doLog("Add to homescreen: autostart displaying callout");
+	    this.show();
+	  }
+	};
+
+	ath.Class.prototype = {
+	  // event type to method conversion
+	  events: {
+	    load: '_delayedShow',
+	    error: '_delayedShow',
+	    orientationchange: 'resize',
+	    resize: 'resize',
+	    scroll: 'resize',
+	    click: 'remove',
+	    touchmove: '_preventDefault',
+	    transitionend: '_removeElements',
+	    webkitTransitionEnd: '_removeElements',
+	    MSTransitionEnd: '_removeElements'
+	  },
+
+	  handleEvent: function(e) {
+	    var type = this.events[e.type];
+	    if (type) {
+	      this[type](e);
+	    }
+	  },
+
+	  show: function(force) {
+	    // in autostart mode wait for the document to be ready
+	    if (this.options.autostart && !_DOMReady) {
+	      setTimeout(this.show.bind(this), 50);
+	      // we are not displaying callout because DOM not ready, but don't log that because
+	      // it would log too frequently
+	      return;
+	    }
+
+	    // message already on screen
+	    if (this.shown) {
+	      this.doLog("Add to homescreen: not displaying callout because already shown on screen");
+	      return;
+	    }
+
+	    var now = Date.now();
+	    var lastDisplayTime = this.session.lastDisplayTime;
+
+	    if (force !== true) {
+	      // this is needed if autostart is disabled and you programmatically call the show() method
+	      if (!this.ready) {
+	        this.doLog("Add to homescreen: not displaying callout because not ready");
+	        return;
+	      }
+
+	      // we obey the display pace (prevent the message to popup too often)
+	      if (now - lastDisplayTime < this.options.displayPace * 60000) {
+	        this.doLog("Add to homescreen: not displaying callout because displayed recently");
+	        return;
+	      }
+
+	      // obey the maximum number of display count
+	      if (this.options.maxDisplayCount && this.session.displayCount >= this.options.maxDisplayCount) {
+	        this.doLog("Add to homescreen: not displaying callout because displayed too many times already");
+	        return;
+	      }
+	    }
+
+	    this.shown = true;
+
+	    // increment the display count
+	    this.session.lastDisplayTime = now;
+	    this.session.displayCount++;
+	    this.updateSession();
+
+	    // try to get the highest resolution application icon
+	    if (!this.applicationIcon) {
+	      if (ath.OS == 'ios') {
+	        this.applicationIcon = document.querySelector('head link[rel^=apple-touch-icon][sizes="152x152"],head link[rel^=apple-touch-icon][sizes="144x144"],head link[rel^=apple-touch-icon][sizes="120x120"],head link[rel^=apple-touch-icon][sizes="114x114"],head link[rel^=apple-touch-icon]');
+	      } else {
+	        this.applicationIcon = document.querySelector('head link[rel^="shortcut icon"][sizes="196x196"],head link[rel^=apple-touch-icon]');
+	      }
+	    }
+
+	    var message = '';
+
+	    if (typeof this.options.message == 'object' && ath.language in this.options.message) {		// use custom language message
+	      message = this.options.message[ath.language][ath.OS];
+	    } else if (typeof this.options.message == 'object' && ath.OS in this.options.message) {		// use custom os message
+	      message = this.options.message[ath.OS];
+	    } else if (this.options.message in ath.intl) {				// you can force the locale
+	      message = ath.intl[this.options.message][ath.OS];
+	    } else if (this.options.message !== '') {						// use a custom message
+	      message = this.options.message;
+	    } else if (ath.OS in ath.intl[ath.language]) {				// otherwise we use our message
+	      message = ath.intl[ath.language][ath.OS];
+	    }
+
+	    // add the action icon
+	    message = '<p>' + message.replace('%icon', '<span class="ath-action-icon">icon</span>') + '</p>';
+
+	    // create the message container
+	    this.viewport = document.createElement('div');
+	    this.viewport.className = 'ath-viewport';
+	    if (this.options.modal) {
+	      this.viewport.className += ' ath-modal';
+	    }
+	    if (this.options.mandatory) {
+	      this.viewport.className += ' ath-mandatory';
+	    }
+	    this.viewport.style.position = 'absolute';
+
+	    // create the actual message element
+	    this.element = document.createElement('div');
+	    this.element.className = 'ath-container ath-' + ath.OS + ' ath-' + ath.OS + (ath.OSVersion + '').substr(0, 1) + ' ath-' + (ath.isTablet ? 'tablet' : 'phone');
+	    this.element.style.cssText = '-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0s;-webkit-transition-timing-function:ease-out;transition-property:transform,opacity;transition-duration:0s;transition-timing-function:ease-out;';
+	    this.element.style.webkitTransform = 'translate3d(0,-' + window.innerHeight + 'px,0)';
+	    this.element.style.transform = 'translate3d(0,-' + window.innerHeight + 'px,0)';
+
+	    // add the application icon
+	    if (this.options.icon && this.applicationIcon) {
+	      this.element.className += ' ath-icon';
+	      this.img = document.createElement('img');
+	      this.img.className = 'ath-application-icon';
+	      this.img.addEventListener('load', this, false);
+	      this.img.addEventListener('error', this, false);
+
+	      this.img.src = this.applicationIcon.href;
+	      this.element.appendChild(this.img);
+	    }
+
+	    this.element.innerHTML += message;
+
+	    // we are not ready to show, place the message out of sight
+	    this.viewport.style.left = '-99999em';
+
+	    // attach all elements to the DOM
+	    this.viewport.appendChild(this.element);
+	    this.container.appendChild(this.viewport);
+
+	    // if we don't have to wait for an image to load, show the message right away
+	    if (this.img) {
+	      this.doLog("Add to homescreen: not displaying callout because waiting for img to load");
+	    } else {
+	      this._delayedShow();
+	    }
+	  },
+
+	  _delayedShow: function(e) {
+	    setTimeout(this._show.bind(this), this.options.startDelay * 1000 + 500);
+	  },
+
+	  _show: function() {
+	    var that = this;
+
+	    // update the viewport size and orientation
+	    this.updateViewport();
+
+	    // reposition/resize the message on orientation change
+	    window.addEventListener('resize', this, false);
+	    window.addEventListener('scroll', this, false);
+	    window.addEventListener('orientationchange', this, false);
+
+	    if (this.options.modal) {
+	      // lock any other interaction
+	      document.addEventListener('touchmove', this, true);
+	    }
+
+	    // Enable closing after 1 second
+	    if (!this.options.mandatory) {
+	      setTimeout(function() {
+	        that.element.addEventListener('click', that, true);
+	      }, 1000);
+	    }
+
+	    // kick the animation
+	    setTimeout(function() {
+	      that.element.style.webkitTransitionDuration = '1.2s';
+	      that.element.style.transitionDuration = '1.2s';
+	      that.element.style.webkitTransform = 'translate3d(0,0,0)';
+	      that.element.style.transform = 'translate3d(0,0,0)';
+	    }, 0);
+
+	    // set the destroy timer
+	    if (this.options.lifespan) {
+	      this.removeTimer = setTimeout(this.remove.bind(this), this.options.lifespan * 1000);
+	    }
+
+	    // fire the custom onShow event
+	    if (this.options.onShow) {
+	      this.options.onShow.call(this);
+	    }
+	  },
+
+	  remove: function() {
+	    clearTimeout(this.removeTimer);
+
+	    // clear up the event listeners
+	    if (this.img) {
+	      this.img.removeEventListener('load', this, false);
+	      this.img.removeEventListener('error', this, false);
+	    }
+
+	    window.removeEventListener('resize', this, false);
+	    window.removeEventListener('scroll', this, false);
+	    window.removeEventListener('orientationchange', this, false);
+	    document.removeEventListener('touchmove', this, true);
+	    this.element.removeEventListener('click', this, true);
+
+	    // remove the message element on transition end
+	    this.element.addEventListener('transitionend', this, false);
+	    this.element.addEventListener('webkitTransitionEnd', this, false);
+	    this.element.addEventListener('MSTransitionEnd', this, false);
+
+	    // start the fade out animation
+	    this.element.style.webkitTransitionDuration = '0.3s';
+	    this.element.style.opacity = '0';
+	  },
+
+	  _removeElements: function() {
+	    this.element.removeEventListener('transitionend', this, false);
+	    this.element.removeEventListener('webkitTransitionEnd', this, false);
+	    this.element.removeEventListener('MSTransitionEnd', this, false);
+
+	    // remove the message from the DOM
+	    this.container.removeChild(this.viewport);
+
+	    this.shown = false;
+
+	    // fire the custom onRemove event
+	    if (this.options.onRemove) {
+	      this.options.onRemove.call(this);
+	    }
+	  },
+
+	  updateViewport: function() {
+	    if (!this.shown) {
+	      return;
+	    }
+
+	    this.viewport.style.width = window.innerWidth + 'px';
+	    this.viewport.style.height = window.innerHeight + 'px';
+	    this.viewport.style.left = window.scrollX + 'px';
+	    this.viewport.style.top = window.scrollY + 'px';
+
+	    var clientWidth = document.documentElement.clientWidth;
+
+	    this.orientation = clientWidth > document.documentElement.clientHeight ? 'landscape' : 'portrait';
+
+	    var screenWidth = ath.OS == 'ios' ? this.orientation == 'portrait' ? screen.width : screen.height : screen.width;
+	    this.scale = screen.width > clientWidth ? 1 : screenWidth / window.innerWidth;
+
+	    this.element.style.fontSize = this.options.fontSize / this.scale + 'px';
+	  },
+
+	  resize: function() {
+	    clearTimeout(this.resizeTimer);
+	    this.resizeTimer = setTimeout(this.updateViewport.bind(this), 100);
+	  },
+
+	  updateSession: function() {
+	    if (ath.hasLocalStorage === false) {
+	      return;
+	    }
+
+	    if (localStorage) {
+	      localStorage.setItem(this.options.appID, JSON.stringify(this.session));
+	    }
+	  },
+
+	  clearSession: function() {
+	    this.session = _defaultSession;
+	    this.updateSession();
+	  },
+
+	  getItem: function(item) {
+	    try {
+	      if (!localStorage) {
+	        throw new Error('localStorage is not defined');
+	      }
+
+	      return localStorage.getItem(item);
+	    } catch (e) {
+	      // Preventing exception for some browsers when fetching localStorage key
+	      ath.hasLocalStorage = false;
+	    }
+	  },
+
+	  optOut: function() {
+	    this.session.optedout = true;
+	    this.updateSession();
+	  },
+
+	  optIn: function() {
+	    this.session.optedout = false;
+	    this.updateSession();
+	  },
+
+	  clearDisplayCount: function() {
+	    this.session.displayCount = 0;
+	    this.updateSession();
+	  },
+
+	  _preventDefault: function(e) {
+	    e.preventDefault();
+	    e.stopPropagation();
+	  }
+	};
+
+	// utility
+	function _extend(target, obj) {
+	  for (var i in obj) {
+	    target[i] = obj[i];
+	  }
+
+	  return target;
+	}
+
+	function _removeToken() {
+	  if (document.location.hash == '#ath') {
+	    history.replaceState('', window.document.title, document.location.href.split('#')[0]);
+	  }
+
+	  if (_reSmartURL.test(document.location.href)) {
+	    history.replaceState('', window.document.title, document.location.href.replace(_reSmartURL, '$1'));
+	  }
+
+	  if (_reQueryString.test(document.location.search)) {
+	    history.replaceState('', window.document.title, document.location.href.replace(_reQueryString, '$2'));
+	  }
+	}
+
+	/* jshint +W101, +W106 */
+
+	ath.VERSION = '3.2.2';
+
+	module.exports = UI.addToHomescreen = ath;
+
+
+/***/ },
+/* 5 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	/**
+	 * @via https://github.com/Minwe/bootstrap/blob/master/js/alert.js
+	 * @copyright Copyright 2013 Twitter, Inc.
+	 * @license Apache 2.0
+	 */
+
+	// Alert Class
+	// NOTE: removeElement option is unavailable now
+	var Alert = function(element, options) {
+	  var _this = this;
+	  this.options = $.extend({}, Alert.DEFAULTS, options);
+	  this.$element = $(element);
+
+	  this.$element
+	    .addClass('am-fade am-in')
+	    .on('click.alert.amui', '.am-close', function() {
+	      _this.close();
+	    });
+	};
+
+	Alert.DEFAULTS = {
+	  removeElement: true
+	};
+
+	Alert.prototype.close = function() {
+	  var $element = this.$element;
+
+	  $element.trigger('close.alert.amui').removeClass('am-in');
+
+	  function processAlert() {
+	    $element.trigger('closed.alert.amui').remove();
+	  }
+
+	  UI.support.transition && $element.hasClass('am-fade') ?
+	    $element
+	      .one(UI.support.transition.end, processAlert)
+	      .emulateTransitionEnd(200) :
+	    processAlert();
+	};
+
+	// plugin
+	UI.plugin('alert', Alert);
+
+	// Init code
+	$(document).on('click.alert.amui.data-api', '[data-am-alert]', function(e) {
+	  var $target = $(e.target);
+	  $target.is('.am-close') && $(this).alert('close');
+	});
+
+	module.exports = Alert;
+
+
+/***/ },
+/* 6 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	/**
+	 * @via https://github.com/twbs/bootstrap/blob/master/js/button.js
+	 * @copyright (c) 2011-2014 Twitter, Inc
+	 * @license The MIT License
+	 */
+
+	var Button = function(element, options) {
+	  this.$element = $(element);
+	  this.options = $.extend({}, Button.DEFAULTS, options);
+	  this.isLoading = false;
+	  this.hasSpinner = false;
+	};
+
+	Button.DEFAULTS = {
+	  loadingText: 'loading...',
+	  disabledClassName: 'am-disabled',
+	  activeClassName: 'am-active',
+	  spinner: undefined
+	};
+
+	Button.prototype.setState = function(state, stateText) {
+	  var $element = this.$element;
+	  var disabled = 'disabled';
+	  var data = $element.data();
+	  var options = this.options;
+	  var val = $element.is('input') ? 'val' : 'html';
+	  var stateClassName = 'am-btn-' + state + ' ' + options.disabledClassName;
+
+	  state += 'Text';
+
+	  if (!options.resetText) {
+	    options.resetText = $element[val]();
+	  }
+
+	  // add spinner for element with html()
+	  if (UI.support.animation && options.spinner &&
+	    val === 'html' && !this.hasSpinner) {
+	    options.loadingText = '<span class="am-icon-' + options.spinner +
+	      ' am-icon-spin"></span>' + options.loadingText;
+
+	    this.hasSpinner = true;
+	  }
+
+	  stateText = stateText ||
+	    (data[state] === undefined ? options[state] : data[state]);
+
+	  $element[val](stateText);
+
+	  // push to event loop to allow forms to submit
+	  setTimeout($.proxy(function() {
+	    // TODO: add stateClass for other states
+	    if (state === 'loadingText') {
+	      $element.addClass(stateClassName).attr(disabled, disabled);
+	      this.isLoading = true;
+	    } else if (this.isLoading) {
+	      $element.removeClass(stateClassName).removeAttr(disabled);
+	      this.isLoading = false;
+	    }
+	  }, this), 0);
+	};
+
+	Button.prototype.toggle = function() {
+	  var changed = true;
+	  var $element = this.$element;
+	  var $parent = this.$element.parent('[class*="am-btn-group"]');
+	  var activeClassName = Button.DEFAULTS.activeClassName;
+
+	  if ($parent.length) {
+	    var $input = this.$element.find('input');
+
+	    if ($input.prop('type') == 'radio') {
+	      if ($input.prop('checked') && $element.hasClass(activeClassName)) {
+	        changed = false;
+	      } else {
+	        $parent.find('.' + activeClassName).removeClass(activeClassName);
+	      }
+	    }
+
+	    if (changed) {
+	      $input.prop('checked',
+	        !$element.hasClass(activeClassName)).trigger('change');
+	    }
+	  }
+
+	  if (changed) {
+	    $element.toggleClass(activeClassName);
+	    if (!$element.hasClass(activeClassName)) {
+	      $element.blur();
+	    }
+	  }
+	};
+
+	UI.plugin('button', Button, {
+	  dataOptions: 'data-am-loading',
+	  methodCall: function(args, instance) {
+	    if (args[0] === 'toggle') {
+	      instance.toggle();
+	    } else if (typeof args[0] === 'string') {
+	      instance.setState.apply(instance, args);
+	    }
+	  }
+	});
+
+	// Init code
+	$(document).on('click.button.amui.data-api', '[data-am-button]', function(e) {
+	  e.preventDefault();
+	  var $btn = $(e.target);
+
+	  if (!$btn.hasClass('am-btn')) {
+	    $btn = $btn.closest('.am-btn');
+	  }
+
+	  $btn.button('toggle');
+	});
+
+	UI.ready(function(context) {
+	  $('[data-am-loading]', context).button();
+
+	  // resolves #866
+	  $('[data-am-button]', context).find('input:checked').each(function() {
+	    $(this).parent('label').addClass(Button.DEFAULTS.activeClassName);
+	  });
+	});
+
+	module.exports = UI.button = Button;
+
+
+/***/ },
+/* 7 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	/**
+	 * @via https://github.com/twbs/bootstrap/blob/master/js/collapse.js
+	 * @copyright (c) 2011-2014 Twitter, Inc
+	 * @license The MIT License
+	 */
+
+	var Collapse = function(element, options) {
+	  this.$element = $(element);
+	  this.options = $.extend({}, Collapse.DEFAULTS, options);
+	  this.transitioning = null;
+
+	  if (this.options.parent) {
+	    this.$parent = $(this.options.parent);
+	  }
+
+	  if (this.options.toggle) {
+	    this.toggle();
+	  }
+	};
+
+	Collapse.DEFAULTS = {
+	  toggle: true
+	};
+
+	Collapse.prototype.open = function() {
+	  if (this.transitioning || this.$element.hasClass('am-in')) {
+	    return;
+	  }
+
+	  var startEvent = $.Event('open.collapse.amui');
+	  this.$element.trigger(startEvent);
+
+	  if (startEvent.isDefaultPrevented()) {
+	    return;
+	  }
+
+	  var actives = this.$parent && this.$parent.find('> .am-panel > .am-in');
+
+	  if (actives && actives.length) {
+	    var hasData = actives.data('amui.collapse');
+
+	    if (hasData && hasData.transitioning) {
+	      return;
+	    }
+
+	    Plugin.call(actives, 'close');
+
+	    hasData || actives.data('amui.collapse', null);
+	  }
+
+	  this.$element
+	    .removeClass('am-collapse')
+	    .addClass('am-collapsing').height(0);
+
+	  this.transitioning = 1;
+
+	  var complete = function() {
+	    this.$element
+	      .removeClass('am-collapsing')
+	      .addClass('am-collapse am-in')
+	      .height('')
+	      .trigger('opened.collapse.amui');
+	    this.transitioning = 0;
+	  };
+
+	  if (!UI.support.transition) {
+	    return complete.call(this);
+	  }
+
+	  var scrollHeight = this.$element[0].scrollHeight;
+
+	  this.$element
+	    .one(UI.support.transition.end, $.proxy(complete, this))
+	    .emulateTransitionEnd(300)
+	    .css({height: scrollHeight}); // 当折叠的容器有 padding 时,如果用 height() 只能设置内容的宽度
+	};
+
+	Collapse.prototype.close = function() {
+	  if (this.transitioning || !this.$element.hasClass('am-in')) {
+	    return;
+	  }
+
+	  var startEvent = $.Event('close.collapse.amui');
+	  this.$element.trigger(startEvent);
+
+	  if (startEvent.isDefaultPrevented()) {
+	    return;
+	  }
+
+	  this.$element.height(this.$element.height()).redraw();
+
+	  this.$element.addClass('am-collapsing').
+	    removeClass('am-collapse am-in');
+
+	  this.transitioning = 1;
+
+	  var complete = function() {
+	    this.transitioning = 0;
+	    this.$element
+	      .trigger('closed.collapse.amui')
+	      .removeClass('am-collapsing')
+	      .addClass('am-collapse');
+	    // css({height: '0'});
+	  };
+
+	  if (!UI.support.transition) {
+	    return complete.call(this);
+	  }
+
+	  this.$element.height(0)
+	    .one(UI.support.transition.end, $.proxy(complete, this))
+	    .emulateTransitionEnd(300);
+	};
+
+	Collapse.prototype.toggle = function() {
+	  this[this.$element.hasClass('am-in') ? 'close' : 'open']();
+	};
+
+	// Collapse Plugin
+	function Plugin(option) {
+	  return this.each(function() {
+	    var $this = $(this);
+	    var data = $this.data('amui.collapse');
+	    var options = $.extend({}, Collapse.DEFAULTS,
+	      UI.utils.options($this.attr('data-am-collapse')),
+	      typeof option == 'object' && option);
+
+	    if (!data && options.toggle && option === 'open') {
+	      option = !option;
+	    }
+
+	    if (!data) {
+	      $this.data('amui.collapse', (data = new Collapse(this, options)));
+	    }
+
+	    if (typeof option == 'string') {
+	      data[option]();
+	    }
+	  });
+	}
+
+	$.fn.collapse = Plugin;
+
+	// Init code
+	$(document).on('click.collapse.amui.data-api', '[data-am-collapse]',
+	  function(e) {
+	    var href;
+	    var $this = $(this);
+	    var options = UI.utils.options($this.attr('data-am-collapse'));
+	    var target = options.target ||
+	      e.preventDefault() ||
+	      (href = $this.attr('href')) &&
+	      href.replace(/.*(?=#[^\s]+$)/, '');
+	    var $target = $(target);
+	    var data = $target.data('amui.collapse');
+	    var option = data ? 'toggle' : options;
+	    var parent = options.parent;
+	    var $parent = parent && $(parent);
+
+	    if (!data || !data.transitioning) {
+	      if ($parent) {
+	        // '[data-am-collapse*="{parent: \'' + parent + '"]
+	        $parent.find('[data-am-collapse]').not($this).addClass('am-collapsed');
+	      }
+
+	      $this[$target.hasClass('am-in') ?
+	        'addClass' : 'removeClass']('am-collapsed');
+	    }
+
+	    Plugin.call($target, option);
+	  });
+
+	module.exports = UI.collapse = Collapse;
+
+	// TODO: 更好的 target 选择方式
+	//       折叠的容器必须没有 border/padding 才能正常处理,否则动画会有一些小问题
+	//       寻找更好的未知高度 transition 动画解决方案,max-height 之类的就算了
+
+
+/***/ },
+/* 8 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var $doc = $(document);
+
+	/**
+	 * bootstrap-datepicker.js
+	 * @via http://www.eyecon.ro/bootstrap-datepicker
+	 * @license http://www.apache.org/licenses/LICENSE-2.0
+	 */
+	var Datepicker = function(element, options) {
+	  this.$element = $(element);
+	  this.options = $.extend({}, Datepicker.DEFAULTS, options);
+	  this.format = DPGlobal.parseFormat(this.options.format);
+
+	  this.$element.data('date', this.options.date);
+	  this.language = this.getLocale(this.options.locale);
+	  this.theme = this.options.theme;
+	  this.$picker = $(DPGlobal.template).appendTo('body').on({
+	    click: $.proxy(this.click, this)
+	    // mousedown: $.proxy(this.mousedown, this)
+	  });
+
+	  this.isInput = this.$element.is('input');
+	  this.component = this.$element.is('.am-datepicker-date') ?
+	    this.$element.find('.am-datepicker-add-on') : false;
+
+	  if (this.isInput) {
+	    this.$element.on({
+	      'click.datepicker.amui': $.proxy(this.open, this),
+	      // blur: $.proxy(this.close, this),
+	      'keyup.datepicker.amui': $.proxy(this.update, this)
+	    });
+	  } else {
+	    if (this.component) {
+	      this.component.on('click.datepicker.amui', $.proxy(this.open, this));
+	    } else {
+	      this.$element.on('click.datepicker.amui', $.proxy(this.open, this));
+	    }
+	  }
+
+	  this.minViewMode = this.options.minViewMode;
+
+	  if (typeof this.minViewMode === 'string') {
+	    switch (this.minViewMode) {
+	      case 'months':
+	        this.minViewMode = 1;
+	        break;
+	      case 'years':
+	        this.minViewMode = 2;
+	        break;
+	      default:
+	        this.minViewMode = 0;
+	        break;
+	    }
+	  }
+
+	  this.viewMode = this.options.viewMode;
+
+	  if (typeof this.viewMode === 'string') {
+	    switch (this.viewMode) {
+	      case 'months':
+	        this.viewMode = 1;
+	        break;
+	      case 'years':
+	        this.viewMode = 2;
+	        break;
+	      default:
+	        this.viewMode = 0;
+	        break;
+	    }
+	  }
+
+	  this.startViewMode = this.viewMode;
+	  this.weekStart = ((this.options.weekStart ||
+	  Datepicker.locales[this.language].weekStart || 0) % 7);
+	  this.weekEnd = ((this.weekStart + 6) % 7);
+	  this.onRender = this.options.onRender;
+
+	  this.setTheme();
+	  this.fillDow();
+	  this.fillMonths();
+	  this.update();
+	  this.showMode();
+	};
+
+	Datepicker.DEFAULTS = {
+	  locale: 'zh_CN',
+	  format: 'yyyy-mm-dd',
+	  weekStart: undefined,
+	  viewMode: 0,
+	  minViewMode: 0,
+	  date: '',
+	  theme: '',
+	  autoClose: 1,
+	  onRender: function(date) {
+	    return '';
+	  }
+	};
+
+	Datepicker.prototype.open = function(e) {
+	  this.$picker.show();
+	  this.height = this.component ?
+	    this.component.outerHeight() : this.$element.outerHeight();
+
+	  this.place();
+	  $(window).on('resize.datepicker.amui', $.proxy(this.place, this));
+	  if (e) {
+	    e.stopPropagation();
+	    e.preventDefault();
+	  }
+	  var that = this;
+	  $doc.on('mousedown.datapicker.amui touchstart.datepicker.amui', function(ev) {
+	    if ($(ev.target).closest('.am-datepicker').length === 0) {
+	      that.close();
+	    }
+	  });
+	  this.$element.trigger({
+	    type: 'open.datepicker.amui',
+	    date: this.date
+	  });
+	};
+
+	Datepicker.prototype.close = function() {
+	  this.$picker.hide();
+	  $(window).off('resize.datepicker.amui', this.place);
+	  this.viewMode = this.startViewMode;
+	  this.showMode();
+	  if (!this.isInput) {
+	    $(document).off('mousedown.datapicker.amui touchstart.datepicker.amui',
+	      this.close);
+	  }
+	  // this.set();
+	  this.$element.trigger({
+	    type: 'close.datepicker.amui',
+	    date: this.date
+	  });
+	};
+
+	Datepicker.prototype.set = function() {
+	  var formatted = DPGlobal.formatDate(this.date, this.format);
+	  var $input;
+
+	  if (!this.isInput) {
+	    if (this.component) {
+	      $input = this.$element.find('input').attr('value', formatted);
+	    }
+
+	    this.$element.data('date', formatted);
+	  } else {
+	    $input = this.$element.attr('value', formatted);
+	  }
+
+	  // fixes https://github.com/amazeui/amazeui/issues/711
+	  $input && $input.trigger('change');
+	};
+
+	Datepicker.prototype.setValue = function(newDate) {
+	  if (typeof newDate === 'string') {
+	    this.date = DPGlobal.parseDate(newDate, this.format);
+	  } else {
+	    this.date = new Date(newDate);
+	  }
+	  this.set();
+
+	  this.viewDate = new Date(this.date.getFullYear(),
+	    this.date.getMonth(), 1, 0, 0, 0, 0);
+
+	  this.fill();
+	};
+
+	Datepicker.prototype.place = function() {
+	  var offset = this.component ?
+	    this.component.offset() : this.$element.offset();
+	  var $width = this.component ?
+	    this.component.width() : this.$element.width();
+	  var top = offset.top + this.height;
+	  var left = offset.left;
+	  var right = $doc.width() - offset.left - $width;
+	  var isOutView = this.isOutView();
+
+	  this.$picker.removeClass('am-datepicker-right');
+	  this.$picker.removeClass('am-datepicker-up');
+
+	  if ($doc.width() > 640) {
+	    if (isOutView.outRight) {
+	      this.$picker.addClass('am-datepicker-right');
+	      this.$picker.css({
+	        top: top,
+	        left: 'auto',
+	        right: right
+	      });
+	      return;
+	    }
+	    if (isOutView.outBottom) {
+	      this.$picker.addClass('am-datepicker-up');
+	      top = offset.top - this.$picker.outerHeight(true);
+	    }
+	  } else {
+	    left = 0;
+	  }
+
+	  this.$picker.css({
+	    top: top,
+	    left: left
+	  });
+	};
+
+	Datepicker.prototype.update = function(newDate) {
+	  this.date = DPGlobal.parseDate(
+	    typeof newDate === 'string' ? newDate : (this.isInput ?
+	      this.$element.prop('value') : this.$element.data('date')),
+	    this.format
+	  );
+	  this.viewDate = new Date(this.date.getFullYear(),
+	    this.date.getMonth(), 1, 0, 0, 0, 0);
+	  this.fill();
+	};
+
+	// Days of week
+	Datepicker.prototype.fillDow = function() {
+	  var dowCount = this.weekStart;
+	  var html = '<tr>';
+	  while (dowCount < this.weekStart + 7) {
+	    // NOTE: do % then add 1
+	    html += '<th class="am-datepicker-dow">' +
+	    Datepicker.locales[this.language].daysMin[(dowCount++) % 7] +
+	    '</th>';
+	  }
+	  html += '</tr>';
+
+	  this.$picker.find('.am-datepicker-days thead').append(html);
+	};
+
+	Datepicker.prototype.fillMonths = function() {
+	  var html = '';
+	  var i = 0;
+	  while (i < 12) {
+	    html += '<span class="am-datepicker-month">' +
+	    Datepicker.locales[this.language].monthsShort[i++] + '</span>';
+	  }
+	  this.$picker.find('.am-datepicker-months td').append(html);
+	};
+
+	Datepicker.prototype.fill = function() {
+	  var d = new Date(this.viewDate);
+	  var year = d.getFullYear();
+	  var month = d.getMonth();
+	  var currentDate = this.date.valueOf();
+
+	  var prevMonth = new Date(year, month - 1, 28, 0, 0, 0, 0);
+	  var day = DPGlobal
+	    .getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
+
+	  var daysSelect = this.$picker
+	    .find('.am-datepicker-days .am-datepicker-select');
+
+	  if (this.language === 'zh_CN') {
+	    daysSelect.text(year + Datepicker.locales[this.language].year[0] +
+	    ' ' + Datepicker.locales[this.language].months[month]);
+	  } else {
+	    daysSelect.text(Datepicker.locales[this.language].months[month] +
+	    ' ' + year);
+	  }
+
+	  prevMonth.setDate(day);
+	  prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7) % 7);
+
+	  var nextMonth = new Date(prevMonth);
+	  nextMonth.setDate(nextMonth.getDate() + 42);
+	  nextMonth = nextMonth.valueOf();
+	  var html = [];
+
+	  var className;
+	  var prevY;
+	  var prevM;
+
+	  while (prevMonth.valueOf() < nextMonth) {
+	    if (prevMonth.getDay() === this.weekStart) {
+	      html.push('<tr>');
+	    }
+
+	    className = this.onRender(prevMonth, 0);
+	    prevY = prevMonth.getFullYear();
+	    prevM = prevMonth.getMonth();
+
+	    if ((prevM < month && prevY === year) || prevY < year) {
+	      className += ' am-datepicker-old';
+	    } else if ((prevM > month && prevY === year) || prevY > year) {
+	      className += ' am-datepicker-new';
+	    }
+
+	    if (prevMonth.valueOf() === currentDate) {
+	      className += ' am-active';
+	    }
+	    html.push('<td class="am-datepicker-day ' +
+	    className + '">' + prevMonth.getDate() + '</td>');
+
+	    if (prevMonth.getDay() === this.weekEnd) {
+	      html.push('</tr>');
+	    }
+
+	    prevMonth.setDate(prevMonth.getDate() + 1);
+	  }
+
+	  this.$picker.find('.am-datepicker-days tbody')
+	    .empty().append(html.join(''));
+
+	  var currentYear = this.date.getFullYear();
+	  var months = this.$picker.find('.am-datepicker-months')
+	    .find('.am-datepicker-select')
+	    .text(year);
+	  months = months.end()
+	    .find('span').removeClass('am-active').removeClass('am-disabled');
+
+	  var monthLen = 0;
+
+	  while (monthLen < 12) {
+	    if (this.onRender(d.setFullYear(year, monthLen), 1)) {
+	      months.eq(monthLen).addClass('am-disabled');
+	    }
+	    monthLen++;
+	  }
+
+	  if (currentYear === year) {
+	    months.eq(this.date.getMonth())
+	        .removeClass('am-disabled')
+	        .addClass('am-active');
+	  }
+
+	  html = '';
+	  year = parseInt(year / 10, 10) * 10;
+	  var yearCont = this.$picker
+	    .find('.am-datepicker-years')
+	    .find('.am-datepicker-select')
+	    .text(year + '-' + (year + 9))
+	    .end()
+	    .find('td');
+	  var yearClassName;
+	  // fixes https://github.com/amazeui/amazeui/issues/770
+	  // maybe not need now
+	  var viewDate = new Date(this.viewDate);
+
+	  year -= 1;
+
+	  for (var i = -1; i < 11; i++) {
+	    yearClassName = this.onRender(viewDate.setFullYear(year), 2);
+	    html += '<span class="' + yearClassName + '' +
+	    (i === -1 || i === 10 ? ' am-datepicker-old' : '') +
+	    (currentYear === year ? ' am-active' : '') + '">' + year + '</span>';
+	    year += 1;
+	  }
+	  yearCont.html(html);
+	};
+
+	Datepicker.prototype.click = function(event) {
+	  event.stopPropagation();
+	  event.preventDefault();
+	  var month;
+	  var year;
+	  var $dayActive = this.$picker.find('.am-datepicker-days').find('.am-active');
+	  var $months = this.$picker.find('.am-datepicker-months');
+	  var $monthIndex = $months.find('.am-active').index();
+
+	  var $target = $(event.target).closest('span, td, th');
+	  if ($target.length === 1) {
+	    switch ($target[0].nodeName.toLowerCase()) {
+	      case 'th':
+	        switch ($target[0].className) {
+	          case 'am-datepicker-switch':
+	            this.showMode(1);
+	            break;
+	          case 'am-datepicker-prev':
+	          case 'am-datepicker-next':
+	            this.viewDate['set' + DPGlobal.modes[this.viewMode].navFnc].call(
+	              this.viewDate,
+	              this.viewDate
+	                ['get' + DPGlobal.modes[this.viewMode].navFnc]
+	                .call(this.viewDate) +
+	              DPGlobal.modes[this.viewMode].navStep *
+	              ($target[0].className === 'am-datepicker-prev' ? -1 : 1)
+	            );
+	            this.fill();
+	            this.set();
+	            break;
+	        }
+	        break;
+	      case 'span':
+	        if ($target.is('.am-disabled')) {
+	          return;
+	        }
+
+	        if ($target.is('.am-datepicker-month')) {
+	          month = $target.parent().find('span').index($target);
+
+	          if ($target.is('.am-active')) {
+	            this.viewDate.setMonth(month, $dayActive.text());
+	          } else {
+	            this.viewDate.setMonth(month);
+	          }
+
+	        } else {
+	          year = parseInt($target.text(), 10) || 0;
+	          if ($target.is('.am-active')) {
+	            this.viewDate.setFullYear(year, $monthIndex, $dayActive.text());
+	          } else {
+	            this.viewDate.setFullYear(year);
+	          }
+
+	        }
+
+	        if (this.viewMode !== 0) {
+	          this.date = new Date(this.viewDate);
+	          this.$element.trigger({
+	            type: 'changeDate.datepicker.amui',
+	            date: this.date,
+	            viewMode: DPGlobal.modes[this.viewMode].clsName
+	          });
+	        }
+
+	        this.showMode(-1);
+	        this.fill();
+	        this.set();
+	        break;
+	      case 'td':
+	        if ($target.is('.am-datepicker-day') && !$target.is('.am-disabled')) {
+	          var day = parseInt($target.text(), 10) || 1;
+	          month = this.viewDate.getMonth();
+	          if ($target.is('.am-datepicker-old')) {
+	            month -= 1;
+	          } else if ($target.is('.am-datepicker-new')) {
+	            month += 1;
+	          }
+	          year = this.viewDate.getFullYear();
+	          this.date = new Date(year, month, day, 0, 0, 0, 0);
+	          this.viewDate = new Date(year, month, Math.min(28, day), 0, 0, 0, 0);
+	          this.fill();
+	          this.set();
+	          this.$element.trigger({
+	            type: 'changeDate.datepicker.amui',
+	            date: this.date,
+	            viewMode: DPGlobal.modes[this.viewMode].clsName
+	          });
+
+	          this.options.autoClose && this.close();
+	        }
+	        break;
+	    }
+	  }
+	};
+
+	Datepicker.prototype.mousedown = function(event) {
+	  event.stopPropagation();
+	  event.preventDefault();
+	};
+
+	Datepicker.prototype.showMode = function(dir) {
+	  if (dir) {
+	    this.viewMode = Math.max(this.minViewMode,
+	      Math.min(2, this.viewMode + dir));
+	  }
+
+	  this.$picker.find('>div').hide().
+	    filter('.am-datepicker-' + DPGlobal.modes[this.viewMode].clsName).show();
+	};
+
+	Datepicker.prototype.isOutView = function() {
+	  var offset = this.component ?
+	    this.component.offset() : this.$element.offset();
+	  var isOutView = {
+	    outRight: false,
+	    outBottom: false
+	  };
+	  var $picker = this.$picker;
+	  var width = offset.left + $picker.outerWidth(true);
+	  var height = offset.top + $picker.outerHeight(true) +
+	    this.$element.innerHeight();
+
+	  if (width > $doc.width()) {
+	    isOutView.outRight = true;
+	  }
+	  if (height > $doc.height()) {
+	    isOutView.outBottom = true;
+	  }
+	  return isOutView;
+	};
+
+	Datepicker.prototype.getLocale = function(locale) {
+	  if (!locale) {
+	    locale = navigator.language && navigator.language.split('-');
+	    locale[1] = locale[1].toUpperCase();
+	    locale = locale.join('_');
+	  }
+
+	  if (!Datepicker.locales[locale]) {
+	    locale = 'en_US';
+	  }
+	  return locale;
+	};
+
+	Datepicker.prototype.setTheme = function() {
+	  if (this.theme) {
+	    this.$picker.addClass('am-datepicker-' + this.theme);
+	  }
+	};
+
+	// Datepicker locales
+	Datepicker.locales = {
+	  en_US: {
+	    days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
+	      'Friday', 'Saturday'],
+	    daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+	    daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+	    months: ['January', 'February', 'March', 'April', 'May', 'June',
+	      'July', 'August', 'September', 'October', 'November', 'December'],
+	    monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+	      'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+	    weekStart: 0
+	  },
+	  zh_CN: {
+	    days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
+	    daysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
+	    daysMin: ['日', '一', '二', '三', '四', '五', '六'],
+	    months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月',
+	      '八月', '九月', '十月', '十一月', '十二月'],
+	    monthsShort: ['一月', '二月', '三月', '四月', '五月', '六月',
+	      '七月', '八月', '九月', '十月', '十一月', '十二月'],
+	    weekStart: 1,
+	    year: ['年']
+	  }
+	};
+
+	var DPGlobal = {
+	  modes: [
+	    {
+	      clsName: 'days',
+	      navFnc: 'Month',
+	      navStep: 1
+	    },
+	    {
+	      clsName: 'months',
+	      navFnc: 'FullYear',
+	      navStep: 1
+	    },
+	    {
+	      clsName: 'years',
+	      navFnc: 'FullYear',
+	      navStep: 10
+	    }
+	  ],
+
+	  isLeapYear: function(year) {
+	    return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
+	  },
+
+	  getDaysInMonth: function(year, month) {
+	    return [31, (DPGlobal.isLeapYear(year) ? 29 : 28),
+	      31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
+	  },
+
+	  parseFormat: function(format) {
+	    var separator = format.match(/[.\/\-\s].*?/);
+	    var parts = format.split(/\W+/);
+
+	    if (!separator || !parts || parts.length === 0) {
+	      throw new Error('Invalid date format.');
+	    }
+
+	    return {
+	      separator: separator,
+	      parts: parts
+	    };
+	  },
+
+	  parseDate: function(date, format) {
+	    var parts = date.split(format.separator);
+	    var val;
+	    date = new Date();
+
+	    date.setHours(0);
+	    date.setMinutes(0);
+	    date.setSeconds(0);
+	    date.setMilliseconds(0);
+
+	    if (parts.length === format.parts.length) {
+	      var year = date.getFullYear();
+	      var day = date.getDate();
+	      var month = date.getMonth();
+
+	      for (var i = 0, cnt = format.parts.length; i < cnt; i++) {
+	        val = parseInt(parts[i], 10) || 1;
+	        switch (format.parts[i]) {
+	          case 'dd':
+	          case 'd':
+	            day = val;
+	            date.setDate(val);
+	            break;
+	          case 'mm':
+	          case 'm':
+	            month = val - 1;
+	            date.setMonth(val - 1);
+	            break;
+	          case 'yy':
+	            year = 2000 + val;
+	            date.setFullYear(2000 + val);
+	            break;
+	          case 'yyyy':
+	            year = val;
+	            date.setFullYear(val);
+	            break;
+	        }
+	      }
+	      date = new Date(year, month, day, 0, 0, 0);
+	    }
+	    return date;
+	  },
+
+	  formatDate: function(date, format) {
+	    var val = {
+	      d: date.getDate(),
+	      m: date.getMonth() + 1,
+	      yy: date.getFullYear().toString().substring(2),
+	      yyyy: date.getFullYear()
+	    };
+	    var dateArray = [];
+
+	    val.dd = (val.d < 10 ? '0' : '') + val.d;
+	    val.mm = (val.m < 10 ? '0' : '') + val.m;
+
+	    for (var i = 0, cnt = format.parts.length; i < cnt; i++) {
+	      dateArray.push(val[format.parts[i]]);
+	    }
+	    return dateArray.join(format.separator);
+	  },
+
+	  headTemplate: '<thead>' +
+	  '<tr class="am-datepicker-header">' +
+	  '<th class="am-datepicker-prev">' +
+	  '<i class="am-datepicker-prev-icon"></i></th>' +
+	  '<th colspan="5" class="am-datepicker-switch">' +
+	  '<div class="am-datepicker-select"></div></th>' +
+	  '<th class="am-datepicker-next"><i class="am-datepicker-next-icon"></i>' +
+	  '</th></tr></thead>',
+
+	  contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
+	};
+
+	DPGlobal.template = '<div class="am-datepicker am-datepicker-dropdown">' +
+	'<div class="am-datepicker-caret"></div>' +
+	'<div class="am-datepicker-days">' +
+	'<table class="am-datepicker-table">' +
+	DPGlobal.headTemplate +
+	'<tbody></tbody>' +
+	'</table>' +
+	'</div>' +
+	'<div class="am-datepicker-months">' +
+	'<table class="am-datepicker-table">' +
+	DPGlobal.headTemplate +
+	DPGlobal.contTemplate +
+	'</table>' +
+	'</div>' +
+	'<div class="am-datepicker-years">' +
+	'<table class="am-datepicker-table">' +
+	DPGlobal.headTemplate +
+	DPGlobal.contTemplate +
+	'</table>' +
+	'</div>' +
+	'</div>';
+
+	// jQuery plugin
+	UI.plugin('datepicker', Datepicker);
+
+	// Init code
+	UI.ready(function(context) {
+	  $('[data-am-datepicker]').datepicker();
+	});
+
+	module.exports = UI.datepicker = Datepicker;
+
+	// TODO: 1. 载入动画
+	//       2. less 优化
+
+
+/***/ },
+/* 9 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var $doc = $(document);
+	var transition = UI.support.transition;
+
+	var Dimmer = function() {
+	  this.id = UI.utils.generateGUID('am-dimmer');
+	  this.$element = $(Dimmer.DEFAULTS.tpl, {
+	    id: this.id
+	  });
+
+	  this.inited = false;
+	  this.scrollbarWidth = 0;
+	  this.$used = $([]);
+	};
+
+	Dimmer.DEFAULTS = {
+	  tpl: '<div class="am-dimmer" data-am-dimmer></div>'
+	};
+
+	Dimmer.prototype.init = function() {
+	  if (!this.inited) {
+	    $(document.body).append(this.$element);
+	    this.inited = true;
+	    $doc.trigger('init.dimmer.amui');
+	    this.$element.on('touchmove.dimmer.amui', function(e) {
+	      e.preventDefault();
+	    });
+	  }
+
+	  return this;
+	};
+
+	Dimmer.prototype.open = function(relatedElement) {
+	  if (!this.inited) {
+	    this.init();
+	  }
+
+	  var $element = this.$element;
+
+	  // 用于多重调用
+	  if (relatedElement) {
+	    this.$used = this.$used.add($(relatedElement));
+	  }
+
+	  this.checkScrollbar().setScrollbar();
+
+	  $element.show().trigger('open.dimmer.amui');
+
+	  transition && $element.off(transition.end);
+
+	  setTimeout(function() {
+	    $element.addClass('am-active');
+	  }, 0);
+
+	  return this;
+	};
+
+	Dimmer.prototype.close = function(relatedElement, force) {
+	  this.$used = this.$used.not($(relatedElement));
+
+	  if (!force && this.$used.length) {
+	    return this;
+	  }
+
+	  var $element = this.$element;
+
+	  $element.removeClass('am-active').trigger('close.dimmer.amui');
+
+	  function complete() {
+	    $element.hide();
+	    this.resetScrollbar();
+	  }
+
+	  // transition ? $element.one(transition.end, $.proxy(complete, this)) :
+	  complete.call(this);
+
+	  return this;
+	};
+
+	Dimmer.prototype.checkScrollbar = function() {
+	  this.scrollbarWidth = UI.utils.measureScrollbar();
+
+	  return this;
+	};
+
+	Dimmer.prototype.setScrollbar = function() {
+	  var $body = $(document.body);
+	  var bodyPaddingRight = parseInt(($body.css('padding-right') || 0), 10);
+
+	  if (this.scrollbarWidth) {
+	    $body.css('padding-right', bodyPaddingRight + this.scrollbarWidth);
+	  }
+
+	  $body.addClass('am-dimmer-active');
+
+	  return this;
+	};
+
+	Dimmer.prototype.resetScrollbar = function() {
+	  $(document.body).css('padding-right', '').removeClass('am-dimmer-active');
+
+	  return this;
+	};
+
+	module.exports = UI.dimmer = new Dimmer();
+
+
+/***/ },
+/* 10 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var animation = UI.support.animation;
+
+	/**
+	 * @via https://github.com/Minwe/bootstrap/blob/master/js/dropdown.js
+	 * @copyright (c) 2011-2014 Twitter, Inc
+	 * @license The MIT License
+	 */
+
+	// var toggle = '[data-am-dropdown] > .am-dropdown-toggle';
+
+	var Dropdown = function(element, options) {
+	  this.options = $.extend({}, Dropdown.DEFAULTS, options);
+
+	  options = this.options;
+
+	  this.$element = $(element);
+	  this.$toggle = this.$element.find(options.selector.toggle);
+	  this.$dropdown = this.$element.find(options.selector.dropdown);
+	  this.$boundary = (options.boundary === window) ? $(window) :
+	    this.$element.closest(options.boundary);
+	  this.$justify = (options.justify && $(options.justify).length &&
+	  $(options.justify)) || undefined;
+
+	  !this.$boundary.length && (this.$boundary = $(window));
+
+	  this.active = this.$element.hasClass('am-active') ? true : false;
+	  this.animating = null;
+
+	  this.events();
+	};
+
+	Dropdown.DEFAULTS = {
+	  animation: 'am-animation-slide-top-fixed',
+	  boundary: window,
+	  justify: undefined,
+	  selector: {
+	    dropdown: '.am-dropdown-content',
+	    toggle: '.am-dropdown-toggle'
+	  },
+	  trigger: 'click'
+	};
+
+	Dropdown.prototype.toggle = function() {
+	  this.clear();
+
+	  if (this.animating) {
+	    return;
+	  }
+
+	  this[this.active ? 'close' : 'open']();
+	};
+
+	Dropdown.prototype.open = function(e) {
+	  var $toggle = this.$toggle;
+	  var $element = this.$element;
+	  var $dropdown = this.$dropdown;
+
+	  if ($toggle.is('.am-disabled, :disabled')) {
+	    return;
+	  }
+
+	  if (this.active) {
+	    return;
+	  }
+
+	  $element.trigger('open.dropdown.amui').addClass('am-active');
+
+	  $toggle.trigger('focus');
+
+	  this.checkDimensions(e);
+
+	  var complete = $.proxy(function() {
+	    $element.trigger('opened.dropdown.amui');
+	    this.active = true;
+	    this.animating = 0;
+	  }, this);
+
+	  if (animation) {
+	    this.animating = 1;
+	    $dropdown.addClass(this.options.animation).
+	      on(animation.end + '.open.dropdown.amui', $.proxy(function() {
+	        complete();
+	        $dropdown.removeClass(this.options.animation);
+	      }, this));
+	  } else {
+	    complete();
+	  }
+	};
+
+	Dropdown.prototype.close = function() {
+	  if (!this.active) {
+	    return;
+	  }
+
+	  // fix #165
+	  // var animationName = this.options.animation + ' am-animation-reverse';
+	  var animationName = 'am-dropdown-animation';
+	  var $element = this.$element;
+	  var $dropdown = this.$dropdown;
+
+	  $element.trigger('close.dropdown.amui');
+
+	  var complete = $.proxy(function complete() {
+	    $element.
+	      removeClass('am-active').
+	      trigger('closed.dropdown.amui');
+	    this.active = false;
+	    this.animating = 0;
+	    this.$toggle.blur();
+	  }, this);
+
+	  if (animation) {
+	    $dropdown.removeClass(this.options.animation);
+	    $dropdown.addClass(animationName);
+	    this.animating = 1;
+	    // animation
+	    $dropdown.one(animation.end + '.close.dropdown.amui', function() {
+	      $dropdown.removeClass(animationName);
+	      complete();
+	    });
+	  } else {
+	    complete();
+	  }
+	};
+
+	Dropdown.prototype.enable = function() {
+	  this.$toggle.prop('disabled', false);
+	},
+
+	Dropdown.prototype.disable = function() {
+	  this.$toggle.prop('disabled', true);
+	},
+
+	Dropdown.prototype.checkDimensions = function(e) {
+	  if (!this.$dropdown.length) {
+	    return;
+	  }
+
+	  var $dropdown = this.$dropdown;
+	  
+	  // @see #873
+	  if (e && e.offset) {
+	    $dropdown.offset(e.offset);
+	  }
+
+	  var offset = $dropdown.offset();
+	  var width = $dropdown.outerWidth();
+	  var boundaryWidth = this.$boundary.width();
+	  var boundaryOffset = $.isWindow(this.boundary) && this.$boundary.offset() ?
+	    this.$boundary.offset().left : 0;
+
+	  if (this.$justify) {
+	    // jQuery.fn.width() is really...
+	    $dropdown.css({'min-width': this.$justify.css('width')});
+	  }
+
+	  if ((width + (offset.left - boundaryOffset)) > boundaryWidth) {
+	    this.$element.addClass('am-dropdown-flip');
+	  }
+	};
+
+	Dropdown.prototype.clear = function() {
+	  $('[data-am-dropdown]').not(this.$element).each(function() {
+	    var data = $(this).data('amui.dropdown');
+	    data && data.close();
+	  });
+	};
+
+	Dropdown.prototype.events = function() {
+	  var eventNS = 'dropdown.amui';
+	  // triggers = this.options.trigger.split(' '),
+	  var $toggle = this.$toggle;
+
+	  $toggle.on('click.' + eventNS, $.proxy(function(e) {
+	    e.preventDefault();
+	    this.toggle();
+	  }, this));
+
+	  /*for (var i = triggers.length; i--;) {
+	   var trigger = triggers[i];
+
+	   if (trigger === 'click') {
+	   $toggle.on('click.' + eventNS, $.proxy(this.toggle, this))
+	   }
+
+	   if (trigger === 'focus' || trigger === 'hover') {
+	   var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin';
+	   var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout';
+
+	   this.$element.on(eventIn + '.' + eventNS, $.proxy(this.open, this))
+	   .on(eventOut + '.' + eventNS, $.proxy(this.close, this));
+	   }
+	   }*/
+
+	  $(document).on('keydown.dropdown.amui', $.proxy(function(e) {
+	    e.keyCode === 27 && this.active && this.close();
+	  }, this)).on('click.outer.dropdown.amui', $.proxy(function(e) {
+	    // var $target = $(e.target);
+
+	    if (this.active &&
+	      (this.$element[0] === e.target || !this.$element.find(e.target).length)) {
+	      this.close();
+	    }
+	  }, this));
+	};
+
+	// Dropdown Plugin
+	UI.plugin('dropdown', Dropdown);
+
+	// Init code
+	UI.ready(function(context) {
+	  $('[data-am-dropdown]', context).dropdown();
+	});
+
+	$(document).on('click.dropdown.amui.data-api', '.am-dropdown form',
+	  function(e) {
+	    e.stopPropagation();
+	  });
+
+	module.exports = UI.dropdown = Dropdown;
+
+	// TODO: 1. 处理链接 focus
+	//       2. 增加 mouseenter / mouseleave 选项
+	//       3. 宽度适应
+
+
+/***/ },
+/* 11 */
+/***/ function(module, exports, __webpack_require__) {
+
+	/* WEBPACK VAR INJECTION */(function(setImmediate) {var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	// MODIFIED:
+	// - LINE 252: add `<i></i>`
+	// - namespace
+	// - Init code
+	// TODO: start after x ms when pause on actions
+
+	/*
+	 * jQuery FlexSlider v2.6.1
+	 * Copyright 2012 WooThemes
+	 * Contributing Author: Tyler Smith
+	 */
+
+	var focused = true;
+
+	// FlexSlider: Object Instance
+	$.flexslider = function(el, options) {
+	  var slider = $(el);
+
+	  // making variables public
+	  slider.vars = $.extend({}, $.flexslider.defaults, options);
+
+	  var namespace = slider.vars.namespace,
+	    msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
+	    touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
+	  // depricating this idea, as devices are being released with both of these events
+	    eventType = "click touchend MSPointerUp keyup",
+	    watchedEvent = "",
+	    watchedEventClearTimer,
+	    vertical = slider.vars.direction === "vertical",
+	    reverse = slider.vars.reverse,
+	    carousel = (slider.vars.itemWidth > 0),
+	    fade = slider.vars.animation === "fade",
+	    asNav = slider.vars.asNavFor !== "",
+	    methods = {};
+
+	  // Store a reference to the slider object
+	  $.data(el, 'flexslider', slider);
+
+	  // Private slider methods
+	  methods = {
+	    init: function() {
+	      slider.animating = false;
+	      // Get current slide and make sure it is a number
+	      slider.currentSlide = parseInt((slider.vars.startAt ? slider.vars.startAt : 0), 10);
+	      if (isNaN(slider.currentSlide)) {
+	        slider.currentSlide = 0;
+	      }
+	      slider.animatingTo = slider.currentSlide;
+	      slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
+	      slider.containerSelector = slider.vars.selector.substr(0, slider.vars.selector.search(' '));
+	      slider.slides = $(slider.vars.selector, slider);
+	      slider.container = $(slider.containerSelector, slider);
+	      slider.count = slider.slides.length;
+	      // SYNC:
+	      slider.syncExists = $(slider.vars.sync).length > 0;
+	      // SLIDE:
+	      if (slider.vars.animation === "slide") {
+	        slider.vars.animation = "swing";
+	      }
+	      slider.prop = (vertical) ? "top" : "marginLeft";
+	      slider.args = {};
+	      // SLIDESHOW:
+	      slider.manualPause = false;
+	      slider.stopped = false;
+	      //PAUSE WHEN INVISIBLE
+	      slider.started = false;
+	      slider.startTimeout = null;
+	      // TOUCH/USECSS:
+	      slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
+	        var obj = document.createElement('div'),
+	          props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
+	        for (var i in props) {
+	          if (obj.style[props[i]] !== undefined) {
+	            slider.pfx = props[i].replace('Perspective', '').toLowerCase();
+	            slider.prop = "-" + slider.pfx + "-transform";
+	            return true;
+	          }
+	        }
+	        return false;
+	      }());
+	      slider.ensureAnimationEnd = '';
+	      // CONTROLSCONTAINER:
+	      if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
+	      // MANUAL:
+	      if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
+
+	      // CUSTOM DIRECTION NAV:
+	      if (slider.vars.customDirectionNav !== "") slider.customDirectionNav = $(slider.vars.customDirectionNav).length === 2 && $(slider.vars.customDirectionNav);
+
+	      // RANDOMIZE:
+	      if (slider.vars.randomize) {
+	        slider.slides.sort(function() {
+	          return (Math.round(Math.random()) - 0.5);
+	        });
+	        slider.container.empty().append(slider.slides);
+	      }
+
+	      slider.doMath();
+
+	      // INIT
+	      slider.setup("init");
+
+	      // CONTROLNAV:
+	      if (slider.vars.controlNav) {
+	        methods.controlNav.setup();
+	      }
+
+	      // DIRECTIONNAV:
+	      if (slider.vars.directionNav) {
+	        methods.directionNav.setup();
+	      }
+
+	      // KEYBOARD:
+	      if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
+	        $(document).bind('keyup', function(event) {
+	          var keycode = event.keyCode;
+	          if (!slider.animating && (keycode === 39 || keycode === 37)) {
+	            var target = (keycode === 39) ? slider.getTarget('next') :
+	              (keycode === 37) ? slider.getTarget('prev') : false;
+	            slider.flexAnimate(target, slider.vars.pauseOnAction);
+	          }
+	        });
+	      }
+	      // MOUSEWHEEL:
+	      if (slider.vars.mousewheel) {
+	        slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
+	          event.preventDefault();
+	          var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
+	          slider.flexAnimate(target, slider.vars.pauseOnAction);
+	        });
+	      }
+
+	      // PAUSEPLAY
+	      if (slider.vars.pausePlay) {
+	        methods.pausePlay.setup();
+	      }
+
+	      //PAUSE WHEN INVISIBLE
+	      if (slider.vars.slideshow && slider.vars.pauseInvisible) {
+	        methods.pauseInvisible.init();
+	      }
+
+	      // SLIDSESHOW
+	      if (slider.vars.slideshow) {
+	        if (slider.vars.pauseOnHover) {
+	          slider.hover(function() {
+	            if (!slider.manualPlay && !slider.manualPause) {slider.pause();}
+	          }, function() {
+	            if (!slider.manualPause && !slider.manualPlay && !slider.stopped) {slider.play();}
+	          });
+	        }
+	        // initialize animation
+	        // If we're visible, or we don't use PageVisibility API
+	        if (!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
+	          (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
+	        }
+	      }
+
+	      // ASNAV:
+	      if (asNav) {methods.asNav.setup();}
+
+	      // TOUCH
+	      if (touch && slider.vars.touch) {methods.touch();}
+
+	      // FADE&&SMOOTHHEIGHT || SLIDE:
+	      if (!fade || (fade && slider.vars.smoothHeight)) {$(window).bind("resize orientationchange focus", methods.resize);}
+
+	      slider.find("img").attr("draggable", "false");
+
+	      // API: start() Callback
+	      setTimeout(function() {
+	        slider.vars.start(slider);
+	      }, 200);
+	    },
+	    asNav: {
+	      setup: function() {
+	        slider.asNav = true;
+	        slider.animatingTo = Math.floor(slider.currentSlide / slider.move);
+	        slider.currentItem = slider.currentSlide;
+	        slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
+	        if (!msGesture) {
+	          slider.slides.on(eventType, function(e) {
+	            e.preventDefault();
+	            var $slide = $(this),
+	              target = $slide.index();
+	            var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
+	            if (posFromLeft <= 0 && $slide.hasClass(namespace + 'active-slide')) {
+	              slider.flexAnimate(slider.getTarget("prev"), true);
+	            } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
+	              slider.direction = (slider.currentItem < target) ? "next" : "prev";
+	              slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
+	            }
+	          });
+	        } else {
+	          el._slider = slider;
+	          slider.slides.each(function() {
+	            var that = this;
+	            that._gesture = new MSGesture();
+	            that._gesture.target = that;
+	            that.addEventListener("MSPointerDown", function(e) {
+	              e.preventDefault();
+	              if (e.currentTarget._gesture) {
+	                e.currentTarget._gesture.addPointer(e.pointerId);
+	              }
+	            }, false);
+	            that.addEventListener("MSGestureTap", function(e) {
+	              e.preventDefault();
+	              var $slide = $(this),
+	                target = $slide.index();
+	              if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
+	                slider.direction = (slider.currentItem < target) ? "next" : "prev";
+	                slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
+	              }
+	            });
+	          });
+	        }
+	      }
+	    },
+	    controlNav: {
+	      setup: function() {
+	        if (!slider.manualControls) {
+	          methods.controlNav.setupPaging();
+	        } else { // MANUALCONTROLS:
+	          methods.controlNav.setupManual();
+	        }
+	      },
+	      setupPaging: function() {
+	        var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
+	          j = 1,
+	          item,
+	          slide;
+
+	        slider.controlNavScaffold = $('<ol class="' + namespace + 'control-nav ' + namespace + type + '"></ol>');
+
+	        if (slider.pagingCount > 1) {
+	          for (var i = 0; i < slider.pagingCount; i++) {
+	            slide = slider.slides.eq(i);
+	            if (undefined === slide.attr('data-thumb-alt')) {
+	              slide.attr('data-thumb-alt', '');
+	            }
+	            var altText = ('' !== slide.attr('data-thumb-alt')) ? altText = ' alt="' + slide.attr('data-thumb-alt') + '"' : '';
+	            item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr( 'data-thumb' ) + '"' + altText + '/>' : '<a href="#">' + j + '</a>';
+	            if ('thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions) {
+	              var captn = slide.attr('data-thumbcaption');
+	              if ('' !== captn && undefined !== captn) {item += '<span class="' + namespace + 'caption">' + captn + '</span>';}
+	            }
+	            // slider.controlNavScaffold.append('<li>' + item + '</li>');
+	            slider.controlNavScaffold.append('<li>' + item + '<i></i></li>');
+	            j++;
+	          }
+	        }
+
+	        // CONTROLSCONTAINER:
+	        (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
+	        methods.controlNav.set();
+
+	        methods.controlNav.active();
+
+	        slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
+	          event.preventDefault();
+
+	          if (watchedEvent === "" || watchedEvent === event.type) {
+	            var $this = $(this),
+	              target = slider.controlNav.index($this);
+
+	            if (!$this.hasClass(namespace + 'active')) {
+	              slider.direction = (target > slider.currentSlide) ? "next" : "prev";
+	              slider.flexAnimate(target, slider.vars.pauseOnAction);
+	            }
+	          }
+
+	          // setup flags to prevent event duplication
+	          if (watchedEvent === "") {
+	            watchedEvent = event.type;
+	          }
+	          methods.setToClearWatchedEvent();
+
+	        });
+	      },
+	      setupManual: function() {
+	        slider.controlNav = slider.manualControls;
+	        methods.controlNav.active();
+
+	        slider.controlNav.bind(eventType, function(event) {
+	          event.preventDefault();
+
+	          if (watchedEvent === "" || watchedEvent === event.type) {
+	            var $this = $(this),
+	              target = slider.controlNav.index($this);
+
+	            if (!$this.hasClass(namespace + 'active')) {
+	              (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
+	              slider.flexAnimate(target, slider.vars.pauseOnAction);
+	            }
+	          }
+
+	          // setup flags to prevent event duplication
+	          if (watchedEvent === "") {
+	            watchedEvent = event.type;
+	          }
+	          methods.setToClearWatchedEvent();
+	        });
+	      },
+	      set: function() {
+	        var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
+	        slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
+	      },
+	      active: function() {
+	        slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
+	      },
+	      update: function(action, pos) {
+	        if (slider.pagingCount > 1 && action === "add") {
+	          slider.controlNavScaffold.append($('<li><a href="#">' + slider.count + '</a></li>'));
+	        } else if (slider.pagingCount === 1) {
+	          slider.controlNavScaffold.find('li').remove();
+	        } else {
+	          slider.controlNav.eq(pos).closest('li').remove();
+	        }
+	        methods.controlNav.set();
+	        (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
+	      }
+	    },
+	    directionNav: {
+	      setup: function() {
+	        var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li class="' + namespace + 'nav-prev"><a class="' + namespace + 'prev" href="#">' + slider.vars.prevText + '</a></li><li class="' + namespace + 'nav-next"><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>');
+
+	        // CUSTOM DIRECTION NAV:
+	        if (slider.customDirectionNav) {
+	          slider.directionNav = slider.customDirectionNav;
+	        } else if (slider.controlsContainer) { // CONTROLSCONTAINER:
+	          $(slider.controlsContainer).append(directionNavScaffold);
+	          slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
+	        } else {
+	          slider.append(directionNavScaffold);
+	          slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
+	        }
+
+	        methods.directionNav.update();
+
+	        slider.directionNav.bind(eventType, function(event) {
+	          event.preventDefault();
+	          var target;
+
+	          if (watchedEvent === "" || watchedEvent === event.type) {
+	            target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
+	            slider.flexAnimate(target, slider.vars.pauseOnAction);
+	          }
+
+	          // setup flags to prevent event duplication
+	          if (watchedEvent === "") {
+	            watchedEvent = event.type;
+	          }
+	          methods.setToClearWatchedEvent();
+	        });
+	      },
+	      update: function() {
+	        var disabledClass = namespace + 'disabled';
+	        if (slider.pagingCount === 1) {
+	          slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
+	        } else if (!slider.vars.animationLoop) {
+	          if (slider.animatingTo === 0) {
+	            slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
+	          } else if (slider.animatingTo === slider.last) {
+	            slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
+	          } else {
+	            slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
+	          }
+	        } else {
+	          slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
+	        }
+	      }
+	    },
+	    pausePlay: {
+	      setup: function() {
+	        var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a href="#"></a></div>');
+
+	        // CONTROLSCONTAINER:
+	        if (slider.controlsContainer) {
+	          slider.controlsContainer.append(pausePlayScaffold);
+	          slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
+	        } else {
+	          slider.append(pausePlayScaffold);
+	          slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
+	        }
+
+	        methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
+
+	        slider.pausePlay.bind(eventType, function(event) {
+	          event.preventDefault();
+
+	          if (watchedEvent === "" || watchedEvent === event.type) {
+	            if ($(this).hasClass(namespace + 'pause')) {
+	              slider.manualPause = true;
+	              slider.manualPlay = false;
+	              slider.pause();
+	            } else {
+	              slider.manualPause = false;
+	              slider.manualPlay = true;
+	              slider.play();
+	            }
+	          }
+
+	          // setup flags to prevent event duplication
+	          if (watchedEvent === "") {
+	            watchedEvent = event.type;
+	          }
+	          methods.setToClearWatchedEvent();
+	        });
+	      },
+	      update: function(state) {
+	        (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);
+	      }
+	    },
+	    touch: function() {
+	      var startX,
+	        startY,
+	        offset,
+	        cwidth,
+	        dx,
+	        startT,
+	        onTouchStart,
+	        onTouchMove,
+	        onTouchEnd,
+	        scrolling = false,
+	        localX = 0,
+	        localY = 0,
+	        accDx = 0;
+
+	      if (!msGesture) {
+	        onTouchStart = function(e) {
+	          if (slider.animating) {
+	            e.preventDefault();
+	          } else if (( window.navigator.msPointerEnabled ) || e.touches.length === 1) {
+	            slider.pause();
+	            // CAROUSEL:
+	            cwidth = (vertical) ? slider.h : slider.w;
+	            startT = Number(new Date());
+	            // CAROUSEL:
+
+	            // Local vars for X and Y points.
+	            localX = e.touches[0].pageX;
+	            localY = e.touches[0].pageY;
+
+	            offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
+	              (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
+	                (carousel && slider.currentSlide === slider.last) ? slider.limit :
+	                  (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
+	                    (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
+	            startX = (vertical) ? localY : localX;
+	            startY = (vertical) ? localX : localY;
+
+	            el.addEventListener('touchmove', onTouchMove, false);
+	            el.addEventListener('touchend', onTouchEnd, false);
+	          }
+	        };
+
+	        onTouchMove = function(e) {
+	          // Local vars for X and Y points.
+
+	          localX = e.touches[0].pageX;
+	          localY = e.touches[0].pageY;
+
+	          dx = (vertical) ? startX - localY : startX - localX;
+	          scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
+
+	          var fxms = 500;
+
+	          if (!scrolling || Number(new Date()) - startT > fxms) {
+	            e.preventDefault();
+	            if (!fade && slider.transitions) {
+	              if (!slider.vars.animationLoop) {
+	                dx = dx / ((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx) / cwidth + 2) : 1);
+	              }
+	              slider.setProps(offset + dx, "setTouch");
+	            }
+	          }
+	        };
+
+	        onTouchEnd = function(e) {
+	          // finish the touch by undoing the touch session
+	          el.removeEventListener('touchmove', onTouchMove, false);
+
+	          if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
+	            var updateDx = (reverse) ? -dx : dx,
+	              target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
+
+	            if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth / 2)) {
+	              slider.flexAnimate(target, slider.vars.pauseOnAction);
+	            } else {
+	              if (!fade) {slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);}
+	            }
+	          }
+	          el.removeEventListener('touchend', onTouchEnd, false);
+
+	          startX = null;
+	          startY = null;
+	          dx = null;
+	          offset = null;
+	        };
+
+	        el.addEventListener('touchstart', onTouchStart, false);
+	      } else {
+	        el.style.msTouchAction = "none";
+	        el._gesture = new MSGesture();
+	        el._gesture.target = el;
+	        el.addEventListener("MSPointerDown", onMSPointerDown, false);
+	        el._slider = slider;
+	        el.addEventListener("MSGestureChange", onMSGestureChange, false);
+	        el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
+
+	        function onMSPointerDown(e) {
+	          e.stopPropagation();
+	          if (slider.animating) {
+	            e.preventDefault();
+	          } else {
+	            slider.pause();
+	            el._gesture.addPointer(e.pointerId);
+	            accDx = 0;
+	            cwidth = (vertical) ? slider.h : slider.w;
+	            startT = Number(new Date());
+	            // CAROUSEL:
+
+	            offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
+	              (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
+	                (carousel && slider.currentSlide === slider.last) ? slider.limit :
+	                  (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
+	                    (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
+	          }
+	        }
+
+	        function onMSGestureChange(e) {
+	          e.stopPropagation();
+	          var slider = e.target._slider;
+	          if (!slider) {
+	            return;
+	          }
+	          var transX = -e.translationX,
+	            transY = -e.translationY;
+
+	          //Accumulate translations.
+	          accDx = accDx + ((vertical) ? transY : transX);
+	          dx = accDx;
+	          scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
+
+	          if (e.detail === e.MSGESTURE_FLAG_INERTIA) {
+	            setImmediate(function() {
+	              el._gesture.stop();
+	            });
+
+	            return;
+	          }
+
+	          if (!scrolling || Number(new Date()) - startT > 500) {
+	            e.preventDefault();
+	            if (!fade && slider.transitions) {
+	              if (!slider.vars.animationLoop) {
+	                dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
+	              }
+	              slider.setProps(offset + dx, "setTouch");
+	            }
+	          }
+	        }
+
+	        function onMSGestureEnd(e) {
+	          e.stopPropagation();
+	          var slider = e.target._slider;
+	          if (!slider) {
+	            return;
+	          }
+	          if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
+	            var updateDx = (reverse) ? -dx : dx,
+	              target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
+
+	            if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth / 2)) {
+	              slider.flexAnimate(target, slider.vars.pauseOnAction);
+	            } else {
+	              if (!fade) {slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);}
+	            }
+	          }
+
+	          startX = null;
+	          startY = null;
+	          dx = null;
+	          offset = null;
+	          accDx = 0;
+	        }
+	      }
+	    },
+	    resize: function() {
+	      if (!slider.animating && slider.is(':visible')) {
+	        if (!carousel) {slider.doMath()};
+
+	        if (fade) {
+	          // SMOOTH HEIGHT:
+	          methods.smoothHeight();
+	        } else if (carousel) { //CAROUSEL:
+	          slider.slides.width(slider.computedW);
+	          slider.update(slider.pagingCount);
+	          slider.setProps();
+	        }
+	        else if (vertical) { //VERTICAL:
+	          slider.viewport.height(slider.h);
+	          slider.setProps(slider.h, "setTotal");
+	        } else {
+	          // SMOOTH HEIGHT:
+	          if (slider.vars.smoothHeight) {methods.smoothHeight();}
+	          slider.newSlides.width(slider.computedW);
+	          slider.setProps(slider.computedW, "setTotal");
+	        }
+	      }
+	    },
+	    smoothHeight: function(dur) {
+	      if (!vertical || fade) {
+	        var $obj = (fade) ? slider : slider.viewport;
+	        (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).innerHeight()}, dur) : $obj.innerHeight(slider.slides.eq(slider.animatingTo).innerHeight());
+	      }
+	    },
+	    sync: function(action) {
+	      var $obj = $(slider.vars.sync).data("flexslider"),
+	        target = slider.animatingTo;
+
+	      switch (action) {
+	        case "animate":
+	          $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true);
+	          break;
+	        case "play":
+	          if (!$obj.playing && !$obj.asNav) {
+	            $obj.play();
+	          }
+	          break;
+	        case "pause":
+	          $obj.pause();
+	          break;
+	      }
+	    },
+	    uniqueID: function($clone) {
+	      // Append _clone to current level and children elements with id attributes
+	      $clone.filter('[id]').add($clone.find('[id]')).each(function() {
+	        var $this = $(this);
+	        $this.attr('id', $this.attr('id') + '_clone');
+	      });
+	      return $clone;
+	    },
+	    pauseInvisible: {
+	      visProp: null,
+	      init: function() {
+	        var visProp = methods.pauseInvisible.getHiddenProp();
+	        if (visProp) {
+	          var evtname = visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
+	          document.addEventListener(evtname, function() {
+	            if (methods.pauseInvisible.isHidden()) {
+	              if(slider.startTimeout) {
+	                clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
+	              } else {
+	                slider.pause(); //Or just pause
+	              }
+	            }
+	            else {
+	              if(slider.started) {
+	                slider.play(); //Initiated before, just play
+	              } else {
+	                if (slider.vars.initDelay > 0) {
+	                  setTimeout(slider.play, slider.vars.initDelay);
+	                } else {
+	                  slider.play(); //Didn't init before: simply init or wait for it
+	                }
+	              }
+	            }
+	          });
+	        }
+	      },
+	      isHidden: function() {
+	        var prop = methods.pauseInvisible.getHiddenProp();
+	        if (!prop) {
+	          return false;
+	        }
+	        return document[prop];
+	      },
+	      getHiddenProp: function() {
+	        var prefixes = ['webkit','moz','ms','o'];
+	        // if 'hidden' is natively supported just return it
+	        if ('hidden' in document) {
+	          return 'hidden';
+	        }
+	        // otherwise loop over all the known prefixes until we find one
+	        for (var i = 0; i < prefixes.length; i++ ) {
+	          if ((prefixes[i] + 'Hidden') in document) {
+	            return prefixes[i] + 'Hidden';
+	          }
+	        }
+	        // otherwise it's not supported
+	        return null;
+	      }
+	    },
+	    setToClearWatchedEvent: function() {
+	      clearTimeout(watchedEventClearTimer);
+	      watchedEventClearTimer = setTimeout(function() {
+	        watchedEvent = "";
+	      }, 3000);
+	    }
+	  };
+
+	  // public methods
+	  slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
+	    if (!slider.vars.animationLoop && target !== slider.currentSlide) {
+	      slider.direction = (target > slider.currentSlide) ? "next" : "prev";
+	    }
+
+	    if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
+
+	    if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
+	      if (asNav && withSync) {
+	        var master = $(slider.vars.asNavFor).data('flexslider');
+	        slider.atEnd = target === 0 || target === slider.count - 1;
+	        master.flexAnimate(target, true, false, true, fromNav);
+	        slider.direction = (slider.currentItem < target) ? "next" : "prev";
+	        master.direction = slider.direction;
+
+	        if (Math.ceil((target + 1) / slider.visible) - 1 !== slider.currentSlide && target !== 0) {
+	          slider.currentItem = target;
+	          slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
+	          target = Math.floor(target / slider.visible);
+	        } else {
+	          slider.currentItem = target;
+	          slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
+	          return false;
+	        }
+	      }
+
+	      slider.animating = true;
+	      slider.animatingTo = target;
+
+	      // SLIDESHOW:
+	      if (pause) {slider.pause();}
+
+	      // API: before() animation Callback
+	      slider.vars.before(slider);
+
+	      // SYNC:
+	      if (slider.syncExists && !fromNav) {methods.sync("animate");}
+
+	      // CONTROLNAV
+	      if (slider.vars.controlNav) {methods.controlNav.active();}
+
+	      // !CAROUSEL:
+	      // CANDIDATE: slide active class (for add/remove slide)
+	      if (!carousel) {slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');}
+
+	      // INFINITE LOOP:
+	      // CANDIDATE: atEnd
+	      slider.atEnd = target === 0 || target === slider.last;
+
+	      // DIRECTIONNAV:
+	      if (slider.vars.directionNav) {methods.directionNav.update();}
+
+	      if (target === slider.last) {
+	        // API: end() of cycle Callback
+	        slider.vars.end(slider);
+	        // SLIDESHOW && !INFINITE LOOP:
+	        if (!slider.vars.animationLoop) {slider.pause();}
+	      }
+
+	      // SLIDE:
+	      if (!fade) {
+	        var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
+	          margin, slideString, calcNext;
+
+	        // INFINITE LOOP / REVERSE:
+	        if (carousel) {
+	          //margin = (slider.vars.itemWidth > slider.w) ? slider.vars.itemMargin * 2 : slider.vars.itemMargin;
+	          margin = slider.vars.itemMargin;
+	          calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
+	          slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
+	        } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
+	          slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
+	        } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
+	          slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
+	        } else {
+	          slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
+	        }
+	        slider.setProps(slideString, "", slider.vars.animationSpeed);
+	        if (slider.transitions) {
+	          if (!slider.vars.animationLoop || !slider.atEnd) {
+	            slider.animating = false;
+	            slider.currentSlide = slider.animatingTo;
+	          }
+
+	          // Unbind previous transitionEnd events and re-bind new transitionEnd event
+	          slider.container.unbind("webkitTransitionEnd transitionend");
+	          slider.container.bind("webkitTransitionEnd transitionend", function() {
+	            clearTimeout(slider.ensureAnimationEnd);
+	            slider.wrapup(dimension);
+	          });
+
+	          // Insurance for the ever-so-fickle transitionEnd event
+	          clearTimeout(slider.ensureAnimationEnd);
+	          slider.ensureAnimationEnd = setTimeout(function() {
+	            slider.wrapup(dimension);
+	          }, slider.vars.animationSpeed + 100);
+
+	        } else {
+	          slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
+	            slider.wrapup(dimension);
+	          });
+	        }
+	      } else { // FADE:
+	        if (!touch) {
+	          //slider.slides.eq(slider.currentSlide).fadeOut(slider.vars.animationSpeed, slider.vars.easing);
+	          //slider.slides.eq(target).fadeIn(slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
+
+	          slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
+	          slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
+
+	        } else {
+	          slider.slides.eq(slider.currentSlide).css({
+	            "opacity": 0,
+	            "zIndex": 1
+	          });
+	          slider.slides.eq(target).css({"opacity": 1, "zIndex": 2});
+	          slider.wrapup(dimension);
+	        }
+	      }
+	      // SMOOTH HEIGHT:
+	      if (slider.vars.smoothHeight) {methods.smoothHeight(slider.vars.animationSpeed)};
+	    }
+	  };
+	  slider.wrapup = function(dimension) {
+	    // SLIDE:
+	    if (!fade && !carousel) {
+	      if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
+	        slider.setProps(dimension, "jumpEnd");
+	      } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
+	        slider.setProps(dimension, "jumpStart");
+	      }
+	    }
+	    slider.animating = false;
+	    slider.currentSlide = slider.animatingTo;
+	    // API: after() animation Callback
+	    slider.vars.after(slider);
+	  };
+
+	  // SLIDESHOW:
+	  slider.animateSlides = function() {
+	    if (!slider.animating && focused) {slider.flexAnimate(slider.getTarget("next"));}
+	  };
+	  // SLIDESHOW:
+	  slider.pause = function() {
+	    clearInterval(slider.animatedSlides);
+	    slider.animatedSlides = null;
+	    slider.playing = false;
+	    // PAUSEPLAY:
+	    if (slider.vars.pausePlay) {methods.pausePlay.update("play");}
+	    // SYNC:
+	    if (slider.syncExists) {methods.sync("pause");}
+	  };
+	  // SLIDESHOW:
+	  slider.play = function() {
+	    if (slider.playing) {clearInterval(slider.animatedSlides);}
+	    slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
+	    slider.started = slider.playing = true;
+	    // PAUSEPLAY:
+	    if (slider.vars.pausePlay) {methods.pausePlay.update("pause");}
+	    // SYNC:
+	    if (slider.syncExists) {methods.sync("play");}
+	  };
+	  // STOP:
+	  slider.stop = function() {
+	    slider.pause();
+	    slider.stopped = true;
+	  };
+	  slider.canAdvance = function(target, fromNav) {
+	    // ASNAV:
+	    var last = (asNav) ? slider.pagingCount - 1 : slider.last;
+	    return (fromNav) ? true :
+	      (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
+	        (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
+	          (target === slider.currentSlide && !asNav) ? false :
+	            (slider.vars.animationLoop) ? true :
+	              (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
+	                (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
+	                  true;
+	  };
+	  slider.getTarget = function(dir) {
+	    slider.direction = dir;
+	    if (dir === "next") {
+	      return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
+	    } else {
+	      return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
+	    }
+	  };
+
+	  // SLIDE:
+	  slider.setProps = function(pos, special, dur) {
+	    var target = (function() {
+	      var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
+	        posCalc = (function() {
+	          if (carousel) {
+	            return (special === "setTouch") ? pos :
+	              (reverse && slider.animatingTo === slider.last) ? 0 :
+	                (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
+	                  (slider.animatingTo === slider.last) ? slider.limit : posCheck;
+	          } else {
+	            switch (special) {
+	              case "setTotal":
+	                return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
+	              case "setTouch":
+	                return (reverse) ? pos : pos;
+	              case "jumpEnd":
+	                return (reverse) ? pos : slider.count * pos;
+	              case "jumpStart":
+	                return (reverse) ? slider.count * pos : pos;
+	              default:
+	                return pos;
+	            }
+	          }
+	        }());
+
+	      return (posCalc * -1) + "px";
+	    }());
+
+	    if (slider.transitions) {
+	      target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
+	      dur = (dur !== undefined) ? (dur / 1000) + "s" : "0s";
+	      slider.container.css("-" + slider.pfx + "-transition-duration", dur);
+	      slider.container.css("transition-duration", dur);
+	    }
+
+	    slider.args[slider.prop] = target;
+	    if (slider.transitions || dur === undefined) {slider.container.css(slider.args);}
+
+	    slider.container.css('transform', target);
+	  };
+
+	  slider.setup = function(type) {
+	    // SLIDE:
+	    if (!fade) {
+	      var sliderOffset, arr;
+
+	      if (type === "init") {
+	        slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({
+	          "overflow": "hidden",
+	          "position": "relative"
+	        }).appendTo(slider).append(slider.container);
+	        // INFINITE LOOP:
+	        slider.cloneCount = 0;
+	        slider.cloneOffset = 0;
+	        // REVERSE:
+	        if (reverse) {
+	          arr = $.makeArray(slider.slides).reverse();
+	          slider.slides = $(arr);
+	          slider.container.empty().append(slider.slides);
+	        }
+	      }
+	      // INFINITE LOOP && !CAROUSEL:
+	      if (slider.vars.animationLoop && !carousel) {
+	        slider.cloneCount = 2;
+	        slider.cloneOffset = 1;
+	        // clear out old clones
+	        if (type !== "init") { slider.container.find('.clone').remove(); }
+	        slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))
+	          .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));
+	      }
+	      slider.newSlides = $(slider.vars.selector, slider);
+
+	      sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
+	      // VERTICAL:
+	      if (vertical && !carousel) {
+	        slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
+	        setTimeout(function() {
+	          slider.newSlides.css({"display": "block"});
+	          slider.doMath();
+	          slider.viewport.height(slider.h);
+	          slider.setProps(sliderOffset * slider.h, "init");
+	        }, (type === "init") ? 100 : 0);
+	      } else {
+	        slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
+	        slider.setProps(sliderOffset * slider.computedW, "init");
+	        setTimeout(function() {
+	          slider.doMath();
+	          slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
+
+	          // SMOOTH HEIGHT:
+	          if (slider.vars.smoothHeight) {methods.smoothHeight();}
+	        }, (type === "init") ? 100 : 0);
+	      }
+	    } else { // FADE:
+	      slider.slides.css({
+	        "width": "100%",
+	        "float": "left",
+	        "marginRight": "-100%",
+	        "position": "relative"
+	      });
+	      if (type === "init") {
+	        if (!touch) {
+	          //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
+	          if (slider.vars.fadeFirstSlide == false) {
+	            slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1});
+	          } else {
+	            slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
+	          }
+	        } else {
+	          slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
+	        }
+	      }
+	      // SMOOTH HEIGHT:
+	      if (slider.vars.smoothHeight) {methods.smoothHeight();}
+	    }
+	    // !CAROUSEL:
+	    // CANDIDATE: active slide
+	    if (!carousel) {slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");}
+
+	    //FlexSlider: init() Callback
+	    slider.vars.init(slider);
+	  };
+
+	  slider.doMath = function() {
+	    var slide = slider.slides.first(),
+	      slideMargin = slider.vars.itemMargin,
+	      minItems = slider.vars.minItems,
+	      maxItems = slider.vars.maxItems;
+
+	    slider.w = (slider.viewport === undefined) ? slider.width() : slider.viewport.width();
+	    slider.h = slide.height();
+	    slider.boxPadding = slide.outerWidth() - slide.width();
+
+	    // CAROUSEL:
+	    if (carousel) {
+	      slider.itemT = slider.vars.itemWidth + slideMargin;
+	      slider.itemM = slideMargin;
+	      slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
+	      slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
+	      slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1))) / minItems :
+	        (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1))) / maxItems :
+	          (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
+
+	      slider.visible = Math.floor(slider.w / (slider.itemW));
+	      slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
+	      slider.pagingCount = Math.ceil(((slider.count - slider.visible) / slider.move) + 1);
+	      slider.last = slider.pagingCount - 1;
+	      slider.limit = (slider.pagingCount === 1) ? 0 :
+	        (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
+	    } else {
+	      slider.itemW = slider.w;
+	      slider.itemM = slideMargin;
+	      slider.pagingCount = slider.count;
+	      slider.last = slider.count - 1;
+	    }
+	    slider.computedW = slider.itemW - slider.boxPadding;
+	    slider.computedM = slider.itemM;
+	  };
+
+	  slider.update = function(pos, action) {
+	    slider.doMath();
+
+	    // update currentSlide and slider.animatingTo if necessary
+	    if (!carousel) {
+	      if (pos < slider.currentSlide) {
+	        slider.currentSlide += 1;
+	      } else if (pos <= slider.currentSlide && pos !== 0) {
+	        slider.currentSlide -= 1;
+	      }
+	      slider.animatingTo = slider.currentSlide;
+	    }
+
+	    // update controlNav
+	    if (slider.vars.controlNav && !slider.manualControls) {
+	      if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
+	        methods.controlNav.update("add");
+	      } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
+	        if (carousel && slider.currentSlide > slider.last) {
+	          slider.currentSlide -= 1;
+	          slider.animatingTo -= 1;
+	        }
+	        methods.controlNav.update("remove", slider.last);
+	      }
+	    }
+	    // update directionNav
+	    if (slider.vars.directionNav) {methods.directionNav.update();}
+
+	  };
+
+	  slider.addSlide = function(obj, pos) {
+	    var $obj = $(obj);
+
+	    slider.count += 1;
+	    slider.last = slider.count - 1;
+
+	    // append new slide
+	    if (vertical && reverse) {
+	      (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
+	    } else {
+	      (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
+	    }
+
+	    // update currentSlide, animatingTo, controlNav, and directionNav
+	    slider.update(pos, "add");
+
+	    // update slider.slides
+	    slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
+	    // re-setup the slider to accomdate new slide
+	    slider.setup();
+
+	    //FlexSlider: added() Callback
+	    slider.vars.added(slider);
+	  };
+	  slider.removeSlide = function(obj) {
+	    var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
+
+	    // update count
+	    slider.count -= 1;
+	    slider.last = slider.count - 1;
+
+	    // remove slide
+	    if (isNaN(obj)) {
+	      $(obj, slider.slides).remove();
+	    } else {
+	      (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
+	    }
+
+	    // update currentSlide, animatingTo, controlNav, and directionNav
+	    slider.doMath();
+	    slider.update(pos, "remove");
+
+	    // update slider.slides
+	    slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
+	    // re-setup the slider to accomdate new slide
+	    slider.setup();
+
+	    // FlexSlider: removed() Callback
+	    slider.vars.removed(slider);
+	  };
+
+	  //FlexSlider: Initialize
+	  methods.init();
+	};
+
+	// Ensure the slider isn't focussed if the window loses focus.
+	$(window).blur(function(e) {
+	  focused = false;
+	}).focus(function(e) {
+	  focused = true;
+	});
+
+	// FlexSlider: Default Settings
+	$.flexslider.defaults = {
+	  namespace: 'am-',             // {NEW} String: Prefix string attached to the class of every element generated by the plugin
+	  selector: '.am-slides > li',       // {NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
+	  animation: 'slide',              // String: Select your animation type, 'fade' or 'slide'
+	  easing: 'swing',                // {NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
+	  direction: 'horizontal',        // String: Select the sliding direction, "horizontal" or "vertical"
+	  reverse: false,                 // {NEW} Boolean: Reverse the animation direction
+	  animationLoop: true,            // Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
+	  smoothHeight: false,            // {NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
+	  startAt: 0,                     // Integer: The slide that the slider should start on. Array notation (0 = first slide)
+	  slideshow: true,                // Boolean: Animate slider automatically
+	  slideshowSpeed: 5000,           // Integer: Set the speed of the slideshow cycling, in milliseconds
+	  animationSpeed: 600,            // Integer: Set the speed of animations, in milliseconds
+	  initDelay: 0,                   // {NEW} Integer: Set an initialization delay, in milliseconds
+	  randomize: false,               // Boolean: Randomize slide order
+	  fadeFirstSlide: true,           // Boolean: Fade in the first slide when animation type is "fade"
+	  thumbCaptions: false,           // Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
+
+	  // Usability features
+	  pauseOnAction: true,            // Boolean: Pause the slideshow when interacting with control elements, highly recommended.
+	  pauseOnHover: false,            // Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
+	  pauseInvisible: true,   		// {NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
+	  useCSS: true,                   // {NEW} Boolean: Slider will use CSS3 transitions if available
+	  touch: true,                    // {NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
+	  video: false,                   // {NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
+
+	  // Primary Controls
+	  controlNav: true,               // Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage
+	  directionNav: true,             // Boolean: Create navigation for previous/next navigation? (true/false)
+	  prevText: ' ',           // String: Set the text for the "previous" directionNav item
+	  nextText: ' ',               // String: Set the text for the "next" directionNav item
+
+	  // Secondary Navigation
+	  keyboard: true,                 // Boolean: Allow slider navigating via keyboard left/right keys
+	  multipleKeyboard: false,        // {NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
+	  mousewheel: false,              // {UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
+	  pausePlay: false,               // Boolean: Create pause/play dynamic element
+	  pauseText: 'Pause',             // String: Set the text for the 'pause' pausePlay item
+	  playText: 'Play',               // String: Set the text for the 'play' pausePlay item
+
+	  //  Special properties
+	  controlsContainer: '',          // {UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $('.flexslider-container'). Property is ignored if given element is not found.
+	  manualControls: '',             // {UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
+	  customDirectionNav: '',         // {NEW} jQuery Object/Selector: Custom prev / next button. Must be two jQuery elements. In order to make the events work they have to have the classes "prev" and "next" (plus namespace)
+	  sync: '',                       // {NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
+	  asNavFor: '',                   // {NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
+
+	  // Carousel Options
+	  itemWidth: 0,                   // {NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
+	  itemMargin: 0,                  // {NEW} Integer: Margin between carousel items.
+	  minItems: 1,                    // {NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
+	  maxItems: 0,                    // {NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
+	  move: 0,                        // {NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
+	  allowOneSlide: true,           // {NEW} Boolean: Whether or not to allow a slider comprised of a single slide
+
+	  // Callback API
+	  start: function() {
+	  },            // Callback: function(slider) - Fires when the slider loads the first slide
+	  before: function() {
+	  },           // Callback: function(slider) - Fires asynchronously with each slider animation
+	  after: function() {
+	  },            // Callback: function(slider) - Fires after each slider animation completes
+	  end: function() {
+	  },              // Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
+	  added: function() {
+	  },            // {NEW} Callback: function(slider) - Fires after a slide is added
+	  removed: function() {
+	  },           // {NEW} Callback: function(slider) - Fires after a slide is removed
+	  init: function() {
+	  }             // {NEW} Callback: function(slider) - Fires after the slider is initially setup
+	};
+
+	// FlexSlider: Plugin Function
+	$.fn.flexslider = function(options) {
+	  var args = Array.prototype.slice.call(arguments, 1);
+	  if (options === undefined) {options = {};}
+
+	  if (typeof options === 'object') {
+	    return this.each(function() {
+	      var $this = $(this);
+	      var selector = (options.selector) ? options.selector : '.am-slides > li';
+	      var $slides = $this.find(selector);
+
+	      if (( $slides.length === 1 && options.allowOneSlide === false) || $slides.length === 0) {
+	        $slides.fadeIn(400);
+	        if (options.start) {options.start($this);}
+	      } else if ($this.data('flexslider') === undefined) {
+	        new $.flexslider(this, options);
+	      }
+	    });
+	  } else {
+	    // Helper strings to quickly pecdrform functions on the slider
+	    var $slider = $(this).data('flexslider');
+	    var methodReturn;
+	    switch (options) {
+	      case 'next':
+	        $slider.flexAnimate($slider.getTarget('next'), true);
+	        break;
+	      case 'prev':
+	      case 'previous':
+	        $slider.flexAnimate($slider.getTarget('prev'), true);
+	        break;
+	      default:
+	        if (typeof options === 'number') {
+	          $slider.flexAnimate(options, true);
+	        } else if (typeof options === 'string') {
+	          methodReturn = (typeof $slider[options] === 'function') ?
+	            $slider[options].apply($slider, args) : $slider[options];
+	        }
+	    }
+
+	    return methodReturn === undefined ? this : methodReturn;
+	  }
+	};
+
+	// Init code
+	UI.ready(function(context) {
+	  $('[data-am-flexslider]', context).each(function(i, item) {
+	    var $slider = $(item);
+	    var options = UI.utils.parseOptions($slider.data('amFlexslider'));
+
+	    options.before = function(slider) {
+	      if (slider._pausedTimer) {
+	        window.clearTimeout(slider._pausedTimer);
+	        slider._pausedTimer = null;
+	      }
+	    };
+
+	    options.after = function(slider) {
+	      var pauseTime = slider.vars.playAfterPaused;
+	      if (pauseTime && !isNaN(pauseTime) && !slider.playing) {
+	        if (!slider.manualPause && !slider.manualPlay && !slider.stopped) {
+	          slider._pausedTimer = window.setTimeout(function() {
+	            slider.play();
+	          }, pauseTime);
+	        }
+	      }
+	    };
+
+	    $slider.flexslider(options);
+	  });
+	});
+
+	module.exports = $.flexslider;
+
+	/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(12).setImmediate))
+
+/***/ },
+/* 12 */
+/***/ function(module, exports, __webpack_require__) {
+
+	/* WEBPACK VAR INJECTION */(function(setImmediate, clearImmediate) {var nextTick = __webpack_require__(13).nextTick;
+	var apply = Function.prototype.apply;
+	var slice = Array.prototype.slice;
+	var immediateIds = {};
+	var nextImmediateId = 0;
+
+	// DOM APIs, for completeness
+
+	exports.setTimeout = function() {
+	  return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
+	};
+	exports.setInterval = function() {
+	  return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
+	};
+	exports.clearTimeout =
+	exports.clearInterval = function(timeout) { timeout.close(); };
+
+	function Timeout(id, clearFn) {
+	  this._id = id;
+	  this._clearFn = clearFn;
+	}
+	Timeout.prototype.unref = Timeout.prototype.ref = function() {};
+	Timeout.prototype.close = function() {
+	  this._clearFn.call(window, this._id);
+	};
+
+	// Does not start the time, just sets up the members needed.
+	exports.enroll = function(item, msecs) {
+	  clearTimeout(item._idleTimeoutId);
+	  item._idleTimeout = msecs;
+	};
+
+	exports.unenroll = function(item) {
+	  clearTimeout(item._idleTimeoutId);
+	  item._idleTimeout = -1;
+	};
+
+	exports._unrefActive = exports.active = function(item) {
+	  clearTimeout(item._idleTimeoutId);
+
+	  var msecs = item._idleTimeout;
+	  if (msecs >= 0) {
+	    item._idleTimeoutId = setTimeout(function onTimeout() {
+	      if (item._onTimeout)
+	        item._onTimeout();
+	    }, msecs);
+	  }
+	};
+
+	// That's not how node.js implements it but the exposed api is the same.
+	exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
+	  var id = nextImmediateId++;
+	  var args = arguments.length < 2 ? false : slice.call(arguments, 1);
+
+	  immediateIds[id] = true;
+
+	  nextTick(function onNextTick() {
+	    if (immediateIds[id]) {
+	      // fn.call() is faster so we optimize for the common use-case
+	      // @see http://jsperf.com/call-apply-segu
+	      if (args) {
+	        fn.apply(null, args);
+	      } else {
+	        fn.call(null);
+	      }
+	      // Prevent ids from leaking
+	      exports.clearImmediate(id);
+	    }
+	  });
+
+	  return id;
+	};
+
+	exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
+	  delete immediateIds[id];
+	};
+	/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(12).setImmediate, __webpack_require__(12).clearImmediate))
+
+/***/ },
+/* 13 */
+/***/ function(module, exports) {
+
+	// shim for using process in browser
+	var process = module.exports = {};
+
+	// cached from whatever global is present so that test runners that stub it
+	// don't break things.  But we need to wrap it in a try catch in case it is
+	// wrapped in strict mode code which doesn't define any globals.  It's inside a
+	// function because try/catches deoptimize in certain engines.
+
+	var cachedSetTimeout;
+	var cachedClearTimeout;
+
+	function defaultSetTimout() {
+	    throw new Error('setTimeout has not been defined');
+	}
+	function defaultClearTimeout () {
+	    throw new Error('clearTimeout has not been defined');
+	}
+	(function () {
+	    try {
+	        if (typeof setTimeout === 'function') {
+	            cachedSetTimeout = setTimeout;
+	        } else {
+	            cachedSetTimeout = defaultSetTimout;
+	        }
+	    } catch (e) {
+	        cachedSetTimeout = defaultSetTimout;
+	    }
+	    try {
+	        if (typeof clearTimeout === 'function') {
+	            cachedClearTimeout = clearTimeout;
+	        } else {
+	            cachedClearTimeout = defaultClearTimeout;
+	        }
+	    } catch (e) {
+	        cachedClearTimeout = defaultClearTimeout;
+	    }
+	} ())
+	function runTimeout(fun) {
+	    if (cachedSetTimeout === setTimeout) {
+	        //normal enviroments in sane situations
+	        return setTimeout(fun, 0);
+	    }
+	    // if setTimeout wasn't available but was latter defined
+	    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
+	        cachedSetTimeout = setTimeout;
+	        return setTimeout(fun, 0);
+	    }
+	    try {
+	        // when when somebody has screwed with setTimeout but no I.E. maddness
+	        return cachedSetTimeout(fun, 0);
+	    } catch(e){
+	        try {
+	            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
+	            return cachedSetTimeout.call(null, fun, 0);
+	        } catch(e){
+	            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
+	            return cachedSetTimeout.call(this, fun, 0);
+	        }
+	    }
+
+
+	}
+	function runClearTimeout(marker) {
+	    if (cachedClearTimeout === clearTimeout) {
+	        //normal enviroments in sane situations
+	        return clearTimeout(marker);
+	    }
+	    // if clearTimeout wasn't available but was latter defined
+	    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
+	        cachedClearTimeout = clearTimeout;
+	        return clearTimeout(marker);
+	    }
+	    try {
+	        // when when somebody has screwed with setTimeout but no I.E. maddness
+	        return cachedClearTimeout(marker);
+	    } catch (e){
+	        try {
+	            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
+	            return cachedClearTimeout.call(null, marker);
+	        } catch (e){
+	            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
+	            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
+	            return cachedClearTimeout.call(this, marker);
+	        }
+	    }
+
+
+
+	}
+	var queue = [];
+	var draining = false;
+	var currentQueue;
+	var queueIndex = -1;
+
+	function cleanUpNextTick() {
+	    if (!draining || !currentQueue) {
+	        return;
+	    }
+	    draining = false;
+	    if (currentQueue.length) {
+	        queue = currentQueue.concat(queue);
+	    } else {
+	        queueIndex = -1;
+	    }
+	    if (queue.length) {
+	        drainQueue();
+	    }
+	}
+
+	function drainQueue() {
+	    if (draining) {
+	        return;
+	    }
+	    var timeout = runTimeout(cleanUpNextTick);
+	    draining = true;
+
+	    var len = queue.length;
+	    while(len) {
+	        currentQueue = queue;
+	        queue = [];
+	        while (++queueIndex < len) {
+	            if (currentQueue) {
+	                currentQueue[queueIndex].run();
+	            }
+	        }
+	        queueIndex = -1;
+	        len = queue.length;
+	    }
+	    currentQueue = null;
+	    draining = false;
+	    runClearTimeout(timeout);
+	}
+
+	process.nextTick = function (fun) {
+	    var args = new Array(arguments.length - 1);
+	    if (arguments.length > 1) {
+	        for (var i = 1; i < arguments.length; i++) {
+	            args[i - 1] = arguments[i];
+	        }
+	    }
+	    queue.push(new Item(fun, args));
+	    if (queue.length === 1 && !draining) {
+	        runTimeout(drainQueue);
+	    }
+	};
+
+	// v8 likes predictible objects
+	function Item(fun, array) {
+	    this.fun = fun;
+	    this.array = array;
+	}
+	Item.prototype.run = function () {
+	    this.fun.apply(null, this.array);
+	};
+	process.title = 'browser';
+	process.browser = true;
+	process.env = {};
+	process.argv = [];
+	process.version = ''; // empty string to avoid regexp issues
+	process.versions = {};
+
+	function noop() {}
+
+	process.on = noop;
+	process.addListener = noop;
+	process.once = noop;
+	process.off = noop;
+	process.removeListener = noop;
+	process.removeAllListeners = noop;
+	process.emit = noop;
+
+	process.binding = function (name) {
+	    throw new Error('process.binding is not supported');
+	};
+
+	process.cwd = function () { return '/' };
+	process.chdir = function (dir) {
+	    throw new Error('process.chdir is not supported');
+	};
+	process.umask = function() { return 0; };
+
+
+/***/ },
+/* 14 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var UI = __webpack_require__(2);
+
+	/*! iScroll v5.2.0
+	 * (c) 2008-2016 Matteo Spinelli
+	 * http://cubiq.org/license
+	 */
+
+	var rAF = UI.utils.rAF;
+
+	var utils = (function() {
+	  var me = {};
+
+	  var _elementStyle = document.createElement('div').style;
+	  var _vendor = (function() {
+	    var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'],
+	      transform,
+	      i = 0,
+	      l = vendors.length;
+
+	    for (; i < l; i++) {
+	      transform = vendors[i] + 'ransform';
+	      if (transform in _elementStyle) return vendors[i].substr(0, vendors[i].length - 1);
+	    }
+
+	    return false;
+	  })();
+
+	  function _prefixStyle(style) {
+	    if (_vendor === false) return false;
+	    if (_vendor === '') return style;
+	    return _vendor + style.charAt(0).toUpperCase() + style.substr(1);
+	  }
+
+	  me.getTime = Date.now || function getTime() {
+	      return new Date().getTime();
+	    };
+
+	  me.extend = function(target, obj) {
+	    for (var i in obj) {
+	      target[i] = obj[i];
+	    }
+	  };
+
+	  me.addEvent = function(el, type, fn, capture) {
+	    el.addEventListener(type, fn, !!capture);
+	  };
+
+	  me.removeEvent = function(el, type, fn, capture) {
+	    el.removeEventListener(type, fn, !!capture);
+	  };
+
+	  me.prefixPointerEvent = function(pointerEvent) {
+	    return window.MSPointerEvent ?
+	    'MSPointer' + pointerEvent.charAt(7)
+	      .toUpperCase() + pointerEvent.substr(8) :
+	      pointerEvent;
+	  };
+
+	  me.momentum = function(current, start, time, lowerMargin, wrapperSize, deceleration) {
+	    var distance = current - start,
+	      speed = Math.abs(distance) / time,
+	      destination,
+	      duration;
+
+	    deceleration = deceleration === undefined ? 0.0006 : deceleration;
+
+	    destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
+	    duration = speed / deceleration;
+
+	    if (destination < lowerMargin) {
+	      destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin;
+	      distance = Math.abs(destination - current);
+	      duration = distance / speed;
+	    } else if (destination > 0) {
+	      destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0;
+	      distance = Math.abs(current) + destination;
+	      duration = distance / speed;
+	    }
+
+	    return {
+	      destination: Math.round(destination),
+	      duration: duration
+	    };
+	  };
+
+	  var _transform = _prefixStyle('transform');
+
+	  me.extend(me, {
+	    hasTransform: _transform !== false,
+	    hasPerspective: _prefixStyle('perspective') in _elementStyle,
+	    hasTouch: 'ontouchstart' in window,
+	    hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed
+	    hasTransition: _prefixStyle('transition') in _elementStyle
+	  });
+
+	  /*
+	   This should find all Android browsers lower than build 535.19 (both stock browser and webview)
+	   - galaxy S2 is ok
+	   - 2.3.6 : `AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1`
+	   - 4.0.4 : `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
+	   - galaxy S3 is badAndroid (stock brower, webview)
+	   `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
+	   - galaxy S4 is badAndroid (stock brower, webview)
+	   `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
+	   - galaxy S5 is OK
+	   `AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)`
+	   - galaxy S6 is OK
+	   `AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)`
+	   */
+	  me.isBadAndroid = (function() {
+	    var appVersion = window.navigator.appVersion;
+	    // Android browser is not a chrome browser.
+	    if (/Android/.test(appVersion) && !(/Chrome\/\d/.test(appVersion))) {
+	      var safariVersion = appVersion.match(/Safari\/(\d+.\d)/);
+	      if (safariVersion && typeof safariVersion === "object" && safariVersion.length >= 2) {
+	        return parseFloat(safariVersion[1]) < 535.19;
+	      } else {
+	        return true;
+	      }
+	    } else {
+	      return false;
+	    }
+	  })();
+
+	  me.extend(me.style = {}, {
+	    transform: _transform,
+	    transitionTimingFunction: _prefixStyle('transitionTimingFunction'),
+	    transitionDuration: _prefixStyle('transitionDuration'),
+	    transitionDelay: _prefixStyle('transitionDelay'),
+	    transformOrigin: _prefixStyle('transformOrigin')
+	  });
+
+	  me.hasClass = function(e, c) {
+	    var re = new RegExp("(^|\\s)" + c + "(\\s|$)");
+	    return re.test(e.className);
+	  };
+
+	  me.addClass = function(e, c) {
+	    if (me.hasClass(e, c)) {
+	      return;
+	    }
+
+	    var newclass = e.className.split(' ');
+	    newclass.push(c);
+	    e.className = newclass.join(' ');
+	  };
+
+	  me.removeClass = function(e, c) {
+	    if (!me.hasClass(e, c)) {
+	      return;
+	    }
+
+	    var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g');
+	    e.className = e.className.replace(re, ' ');
+	  };
+
+	  me.offset = function(el) {
+	    var left = -el.offsetLeft,
+	      top = -el.offsetTop;
+
+	    // jshint -W084
+	    while (el = el.offsetParent) {
+	      left -= el.offsetLeft;
+	      top -= el.offsetTop;
+	    }
+	    // jshint +W084
+
+	    return {
+	      left: left,
+	      top: top
+	    };
+	  };
+
+	  me.preventDefaultException = function(el, exceptions) {
+	    for (var i in exceptions) {
+	      if (exceptions[i].test(el[i])) {
+	        return true;
+	      }
+	    }
+
+	    return false;
+	  };
+
+	  me.extend(me.eventType = {}, {
+	    touchstart: 1,
+	    touchmove: 1,
+	    touchend: 1,
+
+	    mousedown: 2,
+	    mousemove: 2,
+	    mouseup: 2,
+
+	    pointerdown: 3,
+	    pointermove: 3,
+	    pointerup: 3,
+
+	    MSPointerDown: 3,
+	    MSPointerMove: 3,
+	    MSPointerUp: 3
+	  });
+
+	  me.extend(me.ease = {}, {
+	    quadratic: {
+	      style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
+	      fn: function(k) {
+	        return k * ( 2 - k );
+	      }
+	    },
+	    circular: {
+	      style: 'cubic-bezier(0.1, 0.57, 0.1, 1)',	// Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1)
+	      fn: function(k) {
+	        return Math.sqrt(1 - ( --k * k ));
+	      }
+	    },
+	    back: {
+	      style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
+	      fn: function(k) {
+	        var b = 4;
+	        return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1;
+	      }
+	    },
+	    bounce: {
+	      style: '',
+	      fn: function(k) {
+	        if (( k /= 1 ) < ( 1 / 2.75 )) {
+	          return 7.5625 * k * k;
+	        } else if (k < ( 2 / 2.75 )) {
+	          return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
+	        } else if (k < ( 2.5 / 2.75 )) {
+	          return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
+	        } else {
+	          return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
+	        }
+	      }
+	    },
+	    elastic: {
+	      style: '',
+	      fn: function(k) {
+	        var f = 0.22,
+	          e = 0.4;
+
+	        if (k === 0) {
+	          return 0;
+	        }
+	        if (k == 1) {
+	          return 1;
+	        }
+
+	        return ( e * Math.pow(2, -10 * k) * Math.sin(( k - f / 4 ) * ( 2 * Math.PI ) / f) + 1 );
+	      }
+	    }
+	  });
+
+	  me.tap = function(e, eventName) {
+	    var ev = document.createEvent('Event');
+	    ev.initEvent(eventName, true, true);
+	    ev.pageX = e.pageX;
+	    ev.pageY = e.pageY;
+	    e.target.dispatchEvent(ev);
+	  };
+
+	  me.click = function(e) {
+	    var target = e.target,
+	      ev;
+
+	    if (!(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName)) {
+	      // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
+	      // initMouseEvent is deprecated.
+	      ev = document.createEvent(window.MouseEvent ? 'MouseEvents' : 'Event');
+	      ev.initEvent('click', true, true);
+	      ev.view = e.view || window;
+	      ev.detail = 1;
+	      ev.screenX = target.screenX || 0;
+	      ev.screenY = target.screenY || 0;
+	      ev.clientX = target.clientX || 0;
+	      ev.clientY = target.clientY || 0;
+	      ev.ctrlKey = !!e.ctrlKey;
+	      ev.altKey = !!e.altKey;
+	      ev.shiftKey = !!e.shiftKey;
+	      ev.metaKey = !!e.metaKey;
+	      ev.button = 0;
+	      ev.relatedTarget = null;
+	      ev._constructed = true;
+	      target.dispatchEvent(ev);
+	    }
+	  };
+
+	  return me;
+	})();
+	function IScroll(el, options) {
+	  this.wrapper = typeof el == 'string' ? document.querySelector(el) : el;
+	  this.scroller = this.wrapper.children[0];
+	  this.scrollerStyle = this.scroller.style;		// cache style for better performance
+
+	  this.options = {
+
+	// INSERT POINT: OPTIONS
+	    disablePointer: !utils.hasPointer,
+	    disableTouch: utils.hasPointer || !utils.hasTouch,
+	    disableMouse: utils.hasPointer || utils.hasTouch,
+	    startX: 0,
+	    startY: 0,
+	    scrollY: true,
+	    directionLockThreshold: 5,
+	    momentum: true,
+
+	    bounce: true,
+	    bounceTime: 600,
+	    bounceEasing: '',
+
+	    preventDefault: true,
+	    preventDefaultException: {tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/},
+
+	    HWCompositing: true,
+	    useTransition: true,
+	    useTransform: true,
+	    bindToWrapper: typeof window.onmousedown === "undefined"
+	  };
+
+	  for (var i in options) {
+	    this.options[i] = options[i];
+	  }
+
+	  // Normalize options
+	  this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : '';
+
+	  this.options.useTransition = utils.hasTransition && this.options.useTransition;
+	  this.options.useTransform = utils.hasTransform && this.options.useTransform;
+
+	  this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough;
+	  this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault;
+
+	  // If you want eventPassthrough I have to lock one of the axes
+	  this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY;
+	  this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX;
+
+	  // With eventPassthrough we also need lockDirection mechanism
+	  this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough;
+	  this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold;
+
+	  this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing;
+
+	  this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling;
+
+	  if (this.options.tap === true) {
+	    this.options.tap = 'tap';
+	  }
+
+	  // https://github.com/cubiq/iscroll/issues/1029
+	  if (!this.options.useTransition && !this.options.useTransform) {
+	    if (!(/relative|absolute/i).test(this.scrollerStyle.position)) {
+	      this.scrollerStyle.position = "relative";
+	    }
+	  }
+
+	// INSERT POINT: NORMALIZATION
+
+	  // Some defaults
+	  this.x = 0;
+	  this.y = 0;
+	  this.directionX = 0;
+	  this.directionY = 0;
+	  this._events = {};
+
+	// INSERT POINT: DEFAULTS
+
+	  this._init();
+	  this.refresh();
+
+	  this.scrollTo(this.options.startX, this.options.startY);
+	  this.enable();
+	}
+
+	IScroll.prototype = {
+	  version: '5.2.0',
+
+	  _init: function() {
+	    this._initEvents();
+
+	// INSERT POINT: _init
+
+	  },
+
+	  destroy: function() {
+	    this._initEvents(true);
+	    clearTimeout(this.resizeTimeout);
+	    this.resizeTimeout = null;
+	    this._execEvent('destroy');
+	  },
+
+	  _transitionEnd: function(e) {
+	    if (e.target != this.scroller || !this.isInTransition) {
+	      return;
+	    }
+
+	    this._transitionTime();
+	    if (!this.resetPosition(this.options.bounceTime)) {
+	      this.isInTransition = false;
+	      this._execEvent('scrollEnd');
+	    }
+	  },
+
+	  _start: function(e) {
+	    // React to left mouse button only
+	    if (utils.eventType[e.type] != 1) {
+	      // for button property
+	      // http://unixpapa.com/js/mouse.html
+	      var button;
+	      if (!e.which) {
+	        /* IE case */
+	        button = (e.button < 2) ? 0 :
+	          ((e.button == 4) ? 1 : 2);
+	      } else {
+	        /* All others */
+	        button = e.button;
+	      }
+	      if (button !== 0) {
+	        return;
+	      }
+	    }
+
+	    if (!this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated)) {
+	      return;
+	    }
+
+	    if (this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException)) {
+	      e.preventDefault();
+	    }
+
+	    var point = e.touches ? e.touches[0] : e,
+	      pos;
+
+	    this.initiated = utils.eventType[e.type];
+	    this.moved = false;
+	    this.distX = 0;
+	    this.distY = 0;
+	    this.directionX = 0;
+	    this.directionY = 0;
+	    this.directionLocked = 0;
+
+	    this.startTime = utils.getTime();
+
+	    if (this.options.useTransition && this.isInTransition) {
+	      this._transitionTime();
+	      this.isInTransition = false;
+	      pos = this.getComputedPosition();
+	      this._translate(Math.round(pos.x), Math.round(pos.y));
+	      this._execEvent('scrollEnd');
+	    } else if (!this.options.useTransition && this.isAnimating) {
+	      this.isAnimating = false;
+	      this._execEvent('scrollEnd');
+	    }
+
+	    this.startX = this.x;
+	    this.startY = this.y;
+	    this.absStartX = this.x;
+	    this.absStartY = this.y;
+	    this.pointX = point.pageX;
+	    this.pointY = point.pageY;
+
+	    this._execEvent('beforeScrollStart');
+	  },
+
+	  _move: function(e) {
+	    if (!this.enabled || utils.eventType[e.type] !== this.initiated) {
+	      return;
+	    }
+
+	    if (this.options.preventDefault) {	// increases performance on Android? TODO: check!
+	      e.preventDefault();
+	    }
+
+	    var point = e.touches ? e.touches[0] : e,
+	      deltaX = point.pageX - this.pointX,
+	      deltaY = point.pageY - this.pointY,
+	      timestamp = utils.getTime(),
+	      newX, newY,
+	      absDistX, absDistY;
+
+	    this.pointX = point.pageX;
+	    this.pointY = point.pageY;
+
+	    this.distX += deltaX;
+	    this.distY += deltaY;
+	    absDistX = Math.abs(this.distX);
+	    absDistY = Math.abs(this.distY);
+
+	    // We need to move at least 10 pixels for the scrolling to initiate
+	    if (timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10)) {
+	      return;
+	    }
+
+	    // If you are scrolling in one direction lock the other
+	    if (!this.directionLocked && !this.options.freeScroll) {
+	      if (absDistX > absDistY + this.options.directionLockThreshold) {
+	        this.directionLocked = 'h';		// lock horizontally
+	      } else if (absDistY >= absDistX + this.options.directionLockThreshold) {
+	        this.directionLocked = 'v';		// lock vertically
+	      } else {
+	        this.directionLocked = 'n';		// no lock
+	      }
+	    }
+
+	    if (this.directionLocked == 'h') {
+	      if (this.options.eventPassthrough == 'vertical') {
+	        e.preventDefault();
+	      } else if (this.options.eventPassthrough == 'horizontal') {
+	        this.initiated = false;
+	        return;
+	      }
+
+	      deltaY = 0;
+	    } else if (this.directionLocked == 'v') {
+	      if (this.options.eventPassthrough == 'horizontal') {
+	        e.preventDefault();
+	      } else if (this.options.eventPassthrough == 'vertical') {
+	        this.initiated = false;
+	        return;
+	      }
+
+	      deltaX = 0;
+	    }
+
+	    deltaX = this.hasHorizontalScroll ? deltaX : 0;
+	    deltaY = this.hasVerticalScroll ? deltaY : 0;
+
+	    newX = this.x + deltaX;
+	    newY = this.y + deltaY;
+
+	    // Slow down if outside of the boundaries
+	    if (newX > 0 || newX < this.maxScrollX) {
+	      newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX;
+	    }
+	    if (newY > 0 || newY < this.maxScrollY) {
+	      newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY;
+	    }
+
+	    this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
+	    this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
+
+	    if (!this.moved) {
+	      this._execEvent('scrollStart');
+	    }
+
+	    this.moved = true;
+
+	    this._translate(newX, newY);
+
+	    /* REPLACE START: _move */
+
+	    if (timestamp - this.startTime > 300) {
+	      this.startTime = timestamp;
+	      this.startX = this.x;
+	      this.startY = this.y;
+	    }
+
+	    /* REPLACE END: _move */
+
+	  },
+
+	  _end: function(e) {
+	    if (!this.enabled || utils.eventType[e.type] !== this.initiated) {
+	      return;
+	    }
+
+	    if (this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException)) {
+	      e.preventDefault();
+	    }
+
+	    var point = e.changedTouches ? e.changedTouches[0] : e,
+	      momentumX,
+	      momentumY,
+	      duration = utils.getTime() - this.startTime,
+	      newX = Math.round(this.x),
+	      newY = Math.round(this.y),
+	      distanceX = Math.abs(newX - this.startX),
+	      distanceY = Math.abs(newY - this.startY),
+	      time = 0,
+	      easing = '';
+
+	    this.isInTransition = 0;
+	    this.initiated = 0;
+	    this.endTime = utils.getTime();
+
+	    // reset if we are outside of the boundaries
+	    if (this.resetPosition(this.options.bounceTime)) {
+	      return;
+	    }
+
+	    this.scrollTo(newX, newY);	// ensures that the last position is rounded
+
+	    // we scrolled less than 10 pixels
+	    if (!this.moved) {
+	      if (this.options.tap) {
+	        utils.tap(e, this.options.tap);
+	      }
+
+	      if (this.options.click) {
+	        utils.click(e);
+	      }
+
+	      this._execEvent('scrollCancel');
+	      return;
+	    }
+
+	    if (this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100) {
+	      this._execEvent('flick');
+	      return;
+	    }
+
+	    // start momentum animation if needed
+	    if (this.options.momentum && duration < 300) {
+	      momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : {
+	        destination: newX,
+	        duration: 0
+	      };
+	      momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : {
+	        destination: newY,
+	        duration: 0
+	      };
+	      newX = momentumX.destination;
+	      newY = momentumY.destination;
+	      time = Math.max(momentumX.duration, momentumY.duration);
+	      this.isInTransition = 1;
+	    }
+
+	// INSERT POINT: _end
+
+	    if (newX != this.x || newY != this.y) {
+	      // change easing function when scroller goes out of the boundaries
+	      if (newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY) {
+	        easing = utils.ease.quadratic;
+	      }
+
+	      this.scrollTo(newX, newY, time, easing);
+	      return;
+	    }
+
+	    this._execEvent('scrollEnd');
+	  },
+
+	  _resize: function() {
+	    var that = this;
+
+	    clearTimeout(this.resizeTimeout);
+
+	    this.resizeTimeout = setTimeout(function() {
+	      that.refresh();
+	    }, this.options.resizePolling);
+	  },
+
+	  resetPosition: function(time) {
+	    var x = this.x,
+	      y = this.y;
+
+	    time = time || 0;
+
+	    if (!this.hasHorizontalScroll || this.x > 0) {
+	      x = 0;
+	    } else if (this.x < this.maxScrollX) {
+	      x = this.maxScrollX;
+	    }
+
+	    if (!this.hasVerticalScroll || this.y > 0) {
+	      y = 0;
+	    } else if (this.y < this.maxScrollY) {
+	      y = this.maxScrollY;
+	    }
+
+	    if (x == this.x && y == this.y) {
+	      return false;
+	    }
+
+	    this.scrollTo(x, y, time, this.options.bounceEasing);
+
+	    return true;
+	  },
+
+	  disable: function() {
+	    this.enabled = false;
+	  },
+
+	  enable: function() {
+	    this.enabled = true;
+	  },
+
+	  refresh: function() {
+	    var rf = this.wrapper.offsetHeight;		// Force reflow
+
+	    this.wrapperWidth = this.wrapper.clientWidth;
+	    this.wrapperHeight = this.wrapper.clientHeight;
+
+	    /* REPLACE START: refresh */
+
+	    this.scrollerWidth = this.scroller.offsetWidth;
+	    this.scrollerHeight = this.scroller.offsetHeight;
+
+	    this.maxScrollX = this.wrapperWidth - this.scrollerWidth;
+	    this.maxScrollY = this.wrapperHeight - this.scrollerHeight;
+
+	    /* REPLACE END: refresh */
+
+	    this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0;
+	    this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0;
+
+	    if (!this.hasHorizontalScroll) {
+	      this.maxScrollX = 0;
+	      this.scrollerWidth = this.wrapperWidth;
+	    }
+
+	    if (!this.hasVerticalScroll) {
+	      this.maxScrollY = 0;
+	      this.scrollerHeight = this.wrapperHeight;
+	    }
+
+	    this.endTime = 0;
+	    this.directionX = 0;
+	    this.directionY = 0;
+
+	    this.wrapperOffset = utils.offset(this.wrapper);
+
+	    this._execEvent('refresh');
+
+	    this.resetPosition();
+
+	// INSERT POINT: _refresh
+
+	  },
+
+	  on: function(type, fn) {
+	    if (!this._events[type]) {
+	      this._events[type] = [];
+	    }
+
+	    this._events[type].push(fn);
+	  },
+
+	  off: function(type, fn) {
+	    if (!this._events[type]) {
+	      return;
+	    }
+
+	    var index = this._events[type].indexOf(fn);
+
+	    if (index > -1) {
+	      this._events[type].splice(index, 1);
+	    }
+	  },
+
+	  _execEvent: function(type) {
+	    if (!this._events[type]) {
+	      return;
+	    }
+
+	    var i = 0,
+	      l = this._events[type].length;
+
+	    if (!l) {
+	      return;
+	    }
+
+	    for (; i < l; i++) {
+	      this._events[type][i].apply(this, [].slice.call(arguments, 1));
+	    }
+	  },
+
+	  scrollBy: function(x, y, time, easing) {
+	    x = this.x + x;
+	    y = this.y + y;
+	    time = time || 0;
+
+	    this.scrollTo(x, y, time, easing);
+	  },
+
+	  scrollTo: function(x, y, time, easing) {
+	    easing = easing || utils.ease.circular;
+
+	    this.isInTransition = this.options.useTransition && time > 0;
+	    var transitionType = this.options.useTransition && easing.style;
+	    if (!time || transitionType) {
+	      if (transitionType) {
+	        this._transitionTimingFunction(easing.style);
+	        this._transitionTime(time);
+	      }
+	      this._translate(x, y);
+	    } else {
+	      this._animate(x, y, time, easing.fn);
+	    }
+	  },
+
+	  scrollToElement: function(el, time, offsetX, offsetY, easing) {
+	    el = el.nodeType ? el : this.scroller.querySelector(el);
+
+	    if (!el) {
+	      return;
+	    }
+
+	    var pos = utils.offset(el);
+
+	    pos.left -= this.wrapperOffset.left;
+	    pos.top -= this.wrapperOffset.top;
+
+	    // if offsetX/Y are true we center the element to the screen
+	    if (offsetX === true) {
+	      offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2);
+	    }
+	    if (offsetY === true) {
+	      offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2);
+	    }
+
+	    pos.left -= offsetX || 0;
+	    pos.top -= offsetY || 0;
+
+	    pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left;
+	    pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top;
+
+	    time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x - pos.left), Math.abs(this.y - pos.top)) : time;
+
+	    this.scrollTo(pos.left, pos.top, time, easing);
+	  },
+
+	  _transitionTime: function(time) {
+	    if (!this.options.useTransition) {
+	      return;
+	    }
+	    time = time || 0;
+	    var durationProp = utils.style.transitionDuration;
+	    if (!durationProp) {
+	      return;
+	    }
+
+	    this.scrollerStyle[durationProp] = time + 'ms';
+
+	    if (!time && utils.isBadAndroid) {
+	      this.scrollerStyle[durationProp] = '0.0001ms';
+	      // remove 0.0001ms
+	      var self = this;
+	      rAF(function() {
+	        if (self.scrollerStyle[durationProp] === '0.0001ms') {
+	          self.scrollerStyle[durationProp] = '0s';
+	        }
+	      });
+	    }
+
+	// INSERT POINT: _transitionTime
+
+	  },
+
+	  _transitionTimingFunction: function(easing) {
+	    this.scrollerStyle[utils.style.transitionTimingFunction] = easing;
+
+	// INSERT POINT: _transitionTimingFunction
+
+	  },
+
+	  _translate: function(x, y) {
+	    if (this.options.useTransform) {
+
+	      /* REPLACE START: _translate */
+
+	      this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ;
+
+	      /* REPLACE END: _translate */
+
+	    } else {
+	      x = Math.round(x);
+	      y = Math.round(y);
+	      this.scrollerStyle.left = x + 'px';
+	      this.scrollerStyle.top = y + 'px';
+	    }
+
+	    this.x = x;
+	    this.y = y;
+
+	// INSERT POINT: _translate
+
+	  },
+
+	  _initEvents: function(remove) {
+	    var eventType = remove ? utils.removeEvent : utils.addEvent,
+	      target = this.options.bindToWrapper ? this.wrapper : window;
+
+	    eventType(window, 'orientationchange', this);
+	    eventType(window, 'resize', this);
+
+	    if (this.options.click) {
+	      eventType(this.wrapper, 'click', this, true);
+	    }
+
+	    if (!this.options.disableMouse) {
+	      eventType(this.wrapper, 'mousedown', this);
+	      eventType(target, 'mousemove', this);
+	      eventType(target, 'mousecancel', this);
+	      eventType(target, 'mouseup', this);
+	    }
+
+	    if (utils.hasPointer && !this.options.disablePointer) {
+	      eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this);
+	      eventType(target, utils.prefixPointerEvent('pointermove'), this);
+	      eventType(target, utils.prefixPointerEvent('pointercancel'), this);
+	      eventType(target, utils.prefixPointerEvent('pointerup'), this);
+	    }
+
+	    if (utils.hasTouch && !this.options.disableTouch) {
+	      eventType(this.wrapper, 'touchstart', this);
+	      eventType(target, 'touchmove', this);
+	      eventType(target, 'touchcancel', this);
+	      eventType(target, 'touchend', this);
+	    }
+
+	    eventType(this.scroller, 'transitionend', this);
+	    eventType(this.scroller, 'webkitTransitionEnd', this);
+	    eventType(this.scroller, 'oTransitionEnd', this);
+	    eventType(this.scroller, 'MSTransitionEnd', this);
+	  },
+
+	  getComputedPosition: function() {
+	    var matrix = window.getComputedStyle(this.scroller, null),
+	      x, y;
+
+	    if (this.options.useTransform) {
+	      matrix = matrix[utils.style.transform].split(')')[0].split(', ');
+	      x = +(matrix[12] || matrix[4]);
+	      y = +(matrix[13] || matrix[5]);
+	    } else {
+	      x = +matrix.left.replace(/[^-\d.]/g, '');
+	      y = +matrix.top.replace(/[^-\d.]/g, '');
+	    }
+
+	    return {x: x, y: y};
+	  },
+	  _animate: function(destX, destY, duration, easingFn) {
+	    var that = this,
+	      startX = this.x,
+	      startY = this.y,
+	      startTime = utils.getTime(),
+	      destTime = startTime + duration;
+
+	    function step() {
+	      var now = utils.getTime(),
+	        newX, newY,
+	        easing;
+
+	      if (now >= destTime) {
+	        that.isAnimating = false;
+	        that._translate(destX, destY);
+
+	        if (!that.resetPosition(that.options.bounceTime)) {
+	          that._execEvent('scrollEnd');
+	        }
+
+	        return;
+	      }
+
+	      now = ( now - startTime ) / duration;
+	      easing = easingFn(now);
+	      newX = ( destX - startX ) * easing + startX;
+	      newY = ( destY - startY ) * easing + startY;
+	      that._translate(newX, newY);
+
+	      if (that.isAnimating) {
+	        rAF(step);
+	      }
+	    }
+
+	    this.isAnimating = true;
+	    step();
+	  },
+	  handleEvent: function(e) {
+	    switch (e.type) {
+	      case 'touchstart':
+	      case 'pointerdown':
+	      case 'MSPointerDown':
+	      case 'mousedown':
+	        this._start(e);
+	        break;
+	      case 'touchmove':
+	      case 'pointermove':
+	      case 'MSPointerMove':
+	      case 'mousemove':
+	        this._move(e);
+	        break;
+	      case 'touchend':
+	      case 'pointerup':
+	      case 'MSPointerUp':
+	      case 'mouseup':
+	      case 'touchcancel':
+	      case 'pointercancel':
+	      case 'MSPointerCancel':
+	      case 'mousecancel':
+	        this._end(e);
+	        break;
+	      case 'orientationchange':
+	      case 'resize':
+	        this._resize();
+	        break;
+	      case 'transitionend':
+	      case 'webkitTransitionEnd':
+	      case 'oTransitionEnd':
+	      case 'MSTransitionEnd':
+	        this._transitionEnd(e);
+	        break;
+	      case 'wheel':
+	      case 'DOMMouseScroll':
+	      case 'mousewheel':
+	        this._wheel(e);
+	        break;
+	      case 'keydown':
+	        this._key(e);
+	        break;
+	      case 'click':
+	        if (this.enabled && !e._constructed) {
+	          e.preventDefault();
+	          e.stopPropagation();
+	        }
+	        break;
+	    }
+	  }
+	};
+
+	IScroll.utils = utils;
+
+	module.exports = UI.iScroll = IScroll;
+
+	/* jshint unused: true */
+	/* jshint +W101, +W116, +W109 */
+
+
+/***/ },
+/* 15 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var dimmer = __webpack_require__(9);
+	var $doc = $(document);
+	var supportTransition = UI.support.transition;
+
+	/**
+	 * @reference https://github.com/nolimits4web/Framework7/blob/master/src/js/modals.js
+	 * @license https://github.com/nolimits4web/Framework7/blob/master/LICENSE
+	 */
+
+	var Modal = function(element, options) {
+	  this.options = $.extend({}, Modal.DEFAULTS, options || {});
+	  this.$element = $(element);
+	  this.$dialog = this.$element.find('.am-modal-dialog');
+
+	  if (!this.$element.attr('id')) {
+	    this.$element.attr('id', UI.utils.generateGUID('am-modal'));
+	  }
+
+	  this.isPopup = this.$element.hasClass('am-popup');
+	  this.isActions = this.$element.hasClass('am-modal-actions');
+	  this.isPrompt = this.$element.hasClass('am-modal-prompt');
+	  this.isLoading = this.$element.hasClass('am-modal-loading');
+	  this.active = this.transitioning = this.relatedTarget = null;
+	  this.dimmer = this.options.dimmer ? dimmer : {
+	    open: function() {
+	    },
+	    close: function() {
+	    }
+	  };
+
+	  this.events();
+	};
+
+	Modal.DEFAULTS = {
+	  className: {
+	    active: 'am-modal-active',
+	    out: 'am-modal-out'
+	  },
+	  selector: {
+	    modal: '.am-modal',
+	    active: '.am-modal-active'
+	  },
+	  closeViaDimmer: true,
+	  cancelable: true,
+	  onConfirm: function() {
+	  },
+	  onCancel: function() {
+	  },
+	  closeOnCancel: true,
+	  closeOnConfirm: true,
+	  dimmer: true,
+	  height: undefined,
+	  width: undefined,
+	  duration: 300, // must equal the CSS transition duration
+	  transitionEnd: supportTransition && supportTransition.end + '.modal.amui'
+	};
+
+	Modal.prototype.toggle = function(relatedTarget) {
+	  return this.active ? this.close() : this.open(relatedTarget);
+	};
+
+	Modal.prototype.open = function(relatedTarget) {
+	  var $element = this.$element;
+	  var options = this.options;
+	  var isPopup = this.isPopup;
+	  var width = options.width;
+	  var height = options.height;
+	  var style = {};
+
+	  if (this.active) {
+	    return;
+	  }
+
+	  if (!this.$element.length) {
+	    return;
+	  }
+
+	  // callback hook
+	  relatedTarget && (this.relatedTarget = relatedTarget);
+
+	  // 判断如果还在动画,就先触发之前的closed事件
+	  if (this.transitioning) {
+	    clearTimeout($element.transitionEndTimmer);
+	    $element.transitionEndTimmer = null;
+	    $element.trigger(options.transitionEnd)
+	      .off(options.transitionEnd);
+	  }
+
+	  isPopup && this.$element.show();
+
+	  this.active = true;
+
+	  $element.trigger($.Event('open.modal.amui', {relatedTarget: relatedTarget}));
+
+	  this.dimmer.open($element);
+
+	  $element.show().redraw();
+
+	  // apply Modal width/height if set
+	  if (!isPopup && !this.isActions) {
+	    if (width) {
+	      style.width = parseInt(width, 10) + 'px';
+	    }
+
+	    if (height) {
+	      style.height = parseInt(height, 10) + 'px';
+	    }
+
+	    this.$dialog.css(style);
+	  }
+
+	  $element
+	    .removeClass(options.className.out)
+	    .addClass(options.className.active);
+
+	  this.transitioning = 1;
+
+	  var complete = function() {
+	    $element.trigger($.Event('opened.modal.amui', {
+	      relatedTarget: relatedTarget
+	    }));
+	    this.transitioning = 0;
+
+	    // Prompt auto focus
+	    if (this.isPrompt) {
+	      this.$dialog.find('input').eq(0).focus();
+	    }
+	  };
+
+	  if (!supportTransition) {
+	    return complete.call(this);
+	  }
+
+	  $element
+	    .one(options.transitionEnd, $.proxy(complete, this))
+	    .emulateTransitionEnd(options.duration);
+	};
+
+	Modal.prototype.close = function(relatedTarget) {
+	  if (!this.active) {
+	    return;
+	  }
+
+	  var $element = this.$element;
+	  var options = this.options;
+	  var isPopup = this.isPopup;
+
+	  // 判断如果还在动画,就先触发之前的opened事件
+	  if (this.transitioning) {
+	    clearTimeout($element.transitionEndTimmer);
+	    $element.transitionEndTimmer = null;
+	    $element.trigger(options.transitionEnd).off(options.transitionEnd);
+	    this.dimmer.close($element, true);
+	  }
+
+	  this.$element.trigger($.Event('close.modal.amui', {
+	    relatedTarget: relatedTarget
+	  }));
+
+	  this.transitioning = 1;
+
+	  var complete = function() {
+	    $element.trigger('closed.modal.amui');
+	    isPopup && $element.removeClass(options.className.out);
+	    $element.hide();
+	    this.transitioning = 0;
+	    // 不强制关闭 Dimmer,以便多个 Modal 可以共享 Dimmer
+	    this.dimmer.close($element, false);
+	    this.active = false;
+	  };
+
+	  $element.removeClass(options.className.active)
+	    .addClass(options.className.out);
+
+	  if (!supportTransition) {
+	    return complete.call(this);
+	  }
+
+	  $element.one(options.transitionEnd, $.proxy(complete, this))
+	    .emulateTransitionEnd(options.duration);
+	};
+
+	Modal.prototype.events = function() {
+	  var _this = this;
+	  var options = this.options;
+	  var $element = this.$element;
+	  var $dimmer = this.dimmer.$element;
+	  var $ipt = $element.find('.am-modal-prompt-input');
+	  var $confirm = $element.find('[data-am-modal-confirm]');
+	  var $cancel = $element.find('[data-am-modal-cancel]');
+	  var getData = function() {
+	    var data = [];
+	    $ipt.each(function() {
+	      data.push($(this).val());
+	    });
+
+	    return (data.length === 0) ? undefined :
+	      ((data.length === 1) ? data[0] : data);
+	  };
+
+	  // close via Esc key
+	  if (this.options.cancelable) {
+	    $element.on('keyup.modal.amui', function(e) {
+	      if (_this.active && e.which === 27) {
+	        $element.trigger('cancel.modal.amui');
+	        _this.close();
+	      }
+	    });
+	  }
+
+	  // Close Modal when dimmer clicked
+	  if (this.options.dimmer && this.options.closeViaDimmer && !this.isLoading) {
+	    $dimmer.on('click.dimmer.modal.amui', function() {
+	      _this.close();
+	    });
+	  }
+
+	  // Close Modal when button clicked
+	  $element.on(
+	    'click.close.modal.amui',
+	    '[data-am-modal-close], .am-modal-btn',
+	    function(e) {
+	      e.preventDefault();
+	      var $this = $(this);
+
+	      if ($this.is($confirm)) {
+	        options.closeOnConfirm && _this.close();
+	      } else if ($this.is($cancel)) {
+	        options.closeOnCancel && _this.close();
+	      } else {
+	        _this.close();
+	      }
+	    }
+	  )
+	    // trigger dimmer click event if non-dialog area clicked
+	    // fixes #882 caused by https://github.com/amazeui/amazeui/commit/b6be7719681193f1c4cb04af89cb9fd9f4422163
+	    .on('click', function(e) {
+	      // fixes #900
+	      // e.stopPropagation();
+	      $(e.target).is($element) && $dimmer.trigger('click.dimmer.modal.amui');
+	    });
+
+	  $confirm.on('click.confirm.modal.amui',
+	    function() {
+	      $element.trigger($.Event('confirm.modal.amui', {
+	        trigger: this
+	      }));
+	    });
+
+	  $cancel.on('click.cancel.modal.amui', function() {
+	    $element.trigger($.Event('cancel.modal.amui', {
+	      trigger: this
+	    }));
+	  });
+
+	  $element.on('confirm.modal.amui', function(e) {
+	    e.data = getData();
+	    _this.options.onConfirm.call(_this, e);
+	  }).on('cancel.modal.amui', function(e) {
+	    e.data = getData();
+	    _this.options.onCancel.call(_this, e);
+	  });
+	};
+
+	function Plugin(option, relatedTarget) {
+	  return this.each(function() {
+	    var $this = $(this);
+	    var data = $this.data('amui.modal');
+	    var options = typeof option == 'object' && option;
+
+	    if (!data) {
+	      $this.data('amui.modal', (data = new Modal(this, options)));
+	    }
+
+	    if (typeof option == 'string') {
+	      data[option] && data[option](relatedTarget);
+	    } else {
+	      data.toggle(option && option.relatedTarget || undefined);
+	    }
+	  });
+	}
+
+	$.fn.modal = Plugin;
+
+	// Init
+	$doc.on('click.modal.amui.data-api', '[data-am-modal]', function() {
+	  var $this = $(this);
+	  var options = UI.utils.parseOptions($this.attr('data-am-modal'));
+	  var $target = $(options.target ||
+	    (this.href && this.href.replace(/.*(?=#[^\s]+$)/, '')));
+	  var option = $target.data('amui.modal') ? 'toggle' : options;
+
+	  Plugin.call($target, option, this);
+	});
+
+	module.exports = UI.modal = Modal;
+
+
+/***/ },
+/* 16 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(3);
+
+	var $win = $(window);
+	var $doc = $(document);
+	var scrollPos;
+
+	/**
+	 * @via https://github.com/uikit/uikit/blob/master/src/js/offcanvas.js
+	 * @license https://github.com/uikit/uikit/blob/master/LICENSE.md
+	 */
+
+	var OffCanvas = function(element, options) {
+	  this.$element = $(element);
+	  this.options = $.extend({}, OffCanvas.DEFAULTS, options);
+	  this.active = null;
+	  this.bindEvents();
+	};
+
+	OffCanvas.DEFAULTS = {
+	  duration: 300,
+	  effect: 'overlay' // {push|overlay}, push is too expensive
+	};
+
+	OffCanvas.prototype.open = function(relatedElement) {
+	  var _this = this;
+	  var $element = this.$element;
+
+	  if (!$element.length || $element.hasClass('am-active')) {
+	    return;
+	  }
+
+	  var effect = this.options.effect;
+	  var $html = $('html');
+	  var $body = $('body');
+	  var $bar = $element.find('.am-offcanvas-bar').first();
+	  var dir = $bar.hasClass('am-offcanvas-bar-flip') ? -1 : 1;
+
+	  $bar.addClass('am-offcanvas-bar-' + effect);
+
+	  scrollPos = {x: window.scrollX, y: window.scrollY};
+
+	  $element.addClass('am-active');
+
+	  $body.css({
+	    width: window.innerWidth,
+	    height: $win.height()
+	  }).addClass('am-offcanvas-page');
+
+	  if (effect !== 'overlay') {
+	    $body.css({
+	      'margin-left': $bar.outerWidth() * dir
+	    }).width(); // force redraw
+	  }
+
+	  $html.css('margin-top', scrollPos.y * -1);
+
+	  setTimeout(function() {
+	    $bar.addClass('am-offcanvas-bar-active').width();
+	  }, 0);
+
+	  $element.trigger('open.offcanvas.amui');
+
+	  this.active = 1;
+
+	  // Close OffCanvas when none content area clicked
+	  $element.on('click.offcanvas.amui', function(e) {
+	    var $target = $(e.target);
+
+	    if ($target.hasClass('am-offcanvas-bar')) {
+	      return;
+	    }
+
+	    if ($target.parents('.am-offcanvas-bar').first().length) {
+	      return;
+	    }
+
+	    // https://developer.mozilla.org/zh-CN/docs/DOM/event.stopImmediatePropagation
+	    e.stopImmediatePropagation();
+
+	    _this.close();
+	  });
+
+	  $html.on('keydown.offcanvas.amui', function(e) {
+	    (e.keyCode === 27) && _this.close();
+	  });
+	};
+
+	OffCanvas.prototype.close = function(relatedElement) {
+	  var _this = this;
+	  var $html = $('html');
+	  var $body = $('body');
+	  var $element = this.$element;
+	  var $bar = $element.find('.am-offcanvas-bar').first();
+
+	  if (!$element.length || !this.active || !$element.hasClass('am-active')) {
+	    return;
+	  }
+
+	  $element.trigger('close.offcanvas.amui');
+
+	  function complete() {
+	    $body
+	      .removeClass('am-offcanvas-page')
+	      .css({
+	        width: '',
+	        height: '',
+	        'margin-left': '',
+	        'margin-right': ''
+	      });
+	    $element.removeClass('am-active');
+	    $bar.removeClass('am-offcanvas-bar-active');
+	    $html.css('margin-top', '');
+	    window.scrollTo(scrollPos.x, scrollPos.y);
+	    $element.trigger('closed.offcanvas.amui');
+	    _this.active = 0;
+	  }
+
+	  if (UI.support.transition) {
+	    setTimeout(function() {
+	      $bar.removeClass('am-offcanvas-bar-active');
+	    }, 0);
+
+	    $body.css('margin-left', '').one(UI.support.transition.end, function() {
+	      complete();
+	    }).emulateTransitionEnd(this.options.duration);
+	  } else {
+	    complete();
+	  }
+
+	  $element.off('click.offcanvas.amui');
+	  $html.off('.offcanvas.amui');
+	};
+
+	OffCanvas.prototype.bindEvents = function() {
+	  var _this = this;
+	  $doc.on('click.offcanvas.amui', '[data-am-dismiss="offcanvas"]', function(e) {
+	      e.preventDefault();
+	      _this.close();
+	    });
+
+	  $win.on('resize.offcanvas.amui orientationchange.offcanvas.amui',
+	    function() {
+	      _this.active && _this.close();
+	    });
+
+	  this.$element.hammer().on('swipeleft swipeleft', function(e) {
+	    e.preventDefault();
+	    _this.close();
+	  });
+
+	  return this;
+	};
+
+	function Plugin(option, relatedElement) {
+	  var args = Array.prototype.slice.call(arguments, 1);
+
+	  return this.each(function() {
+	    var $this = $(this);
+	    var data = $this.data('amui.offcanvas');
+	    var options = $.extend({}, typeof option == 'object' && option);
+
+	    if (!data) {
+	      $this.data('amui.offcanvas', (data = new OffCanvas(this, options)));
+	      (!option || typeof option == 'object') && data.open(relatedElement);
+	    }
+
+	    if (typeof option == 'string') {
+	      data[option] && data[option].apply(data, args);
+	    }
+	  });
+	}
+
+	$.fn.offCanvas = Plugin;
+
+	// Init code
+	$doc.on('click.offcanvas.amui', '[data-am-offcanvas]', function(e) {
+	  e.preventDefault();
+	  var $this = $(this);
+	  var options = UI.utils.parseOptions($this.data('amOffcanvas'));
+	  var $target = $(options.target ||
+	  (this.href && this.href.replace(/.*(?=#[^\s]+$)/, '')));
+	  var option = $target.data('amui.offcanvas') ? 'open' : options;
+
+	  Plugin.call($target, option, this);
+	});
+
+	module.exports = UI.offcanvas = OffCanvas;
+
+	// TODO: 优化动画效果
+	// http://dbushell.github.io/Responsive-Off-Canvas-Menu/step4.html
+
+
+/***/ },
+/* 17 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var requestAnimationFrame = UI.utils.rAF;
+
+	/**
+	 * @via https://github.com/manuelstofer/pinchzoom/blob/master/src/pinchzoom.js
+	 * @license the MIT License.
+	 */
+
+	var definePinchZoom = function($) {
+
+	  /**
+	   * Pinch zoom using jQuery
+	   * @version 0.0.2
+	   * @author Manuel Stofer <mst@rtp.ch>
+	   * @param el
+	   * @param options
+	   * @constructor
+	   */
+	  var PinchZoom = function(el, options) {
+	      this.el = $(el);
+	      this.zoomFactor = 1;
+	      this.lastScale = 1;
+	      this.offset = {
+	        x: 0,
+	        y: 0
+	      };
+	      this.options = $.extend({}, this.defaults, options);
+	      this.setupMarkup();
+	      this.bindEvents();
+	      this.update();
+	      // default enable.
+	      this.enable();
+
+	    },
+	    sum = function(a, b) {
+	      return a + b;
+	    },
+	    isCloseTo = function(value, expected) {
+	      return value > expected - 0.01 && value < expected + 0.01;
+	    };
+
+	  PinchZoom.prototype = {
+
+	    defaults: {
+	      tapZoomFactor: 2,
+	      zoomOutFactor: 1.3,
+	      animationDuration: 300,
+	      maxZoom: 4,
+	      minZoom: 0.5,
+	      lockDragAxis: false,
+	      use2d: true,
+	      zoomStartEventName: 'pz_zoomstart',
+	      zoomEndEventName: 'pz_zoomend',
+	      dragStartEventName: 'pz_dragstart',
+	      dragEndEventName: 'pz_dragend',
+	      doubleTapEventName: 'pz_doubletap'
+	    },
+
+	    /**
+	     * Event handler for 'dragstart'
+	     * @param event
+	     */
+	    handleDragStart: function(event) {
+	      this.el.trigger(this.options.dragStartEventName);
+	      this.stopAnimation();
+	      this.lastDragPosition = false;
+	      this.hasInteraction = true;
+	      this.handleDrag(event);
+	    },
+
+	    /**
+	     * Event handler for 'drag'
+	     * @param event
+	     */
+	    handleDrag: function(event) {
+
+	      if (this.zoomFactor > 1.0) {
+	        var touch = this.getTouches(event)[0];
+	        this.drag(touch, this.lastDragPosition);
+	        this.offset = this.sanitizeOffset(this.offset);
+	        this.lastDragPosition = touch;
+	      }
+	    },
+
+	    handleDragEnd: function() {
+	      this.el.trigger(this.options.dragEndEventName);
+	      this.end();
+	    },
+
+	    /**
+	     * Event handler for 'zoomstart'
+	     * @param event
+	     */
+	    handleZoomStart: function(event) {
+	      this.el.trigger(this.options.zoomStartEventName);
+	      this.stopAnimation();
+	      this.lastScale = 1;
+	      this.nthZoom = 0;
+	      this.lastZoomCenter = false;
+	      this.hasInteraction = true;
+	    },
+
+	    /**
+	     * Event handler for 'zoom'
+	     * @param event
+	     */
+	    handleZoom: function(event, newScale) {
+
+	      // a relative scale factor is used
+	      var touchCenter = this.getTouchCenter(this.getTouches(event)),
+	        scale = newScale / this.lastScale;
+	      this.lastScale = newScale;
+
+	      // the first touch events are thrown away since they are not precise
+	      this.nthZoom += 1;
+	      if (this.nthZoom > 3) {
+
+	        this.scale(scale, touchCenter);
+	        this.drag(touchCenter, this.lastZoomCenter);
+	      }
+	      this.lastZoomCenter = touchCenter;
+	    },
+
+	    handleZoomEnd: function() {
+	      this.el.trigger(this.options.zoomEndEventName);
+	      this.end();
+	    },
+
+	    /**
+	     * Event handler for 'doubletap'
+	     * @param event
+	     */
+	    handleDoubleTap: function(event) {
+	      var center = this.getTouches(event)[0],
+	        zoomFactor = this.zoomFactor > 1 ? 1 : this.options.tapZoomFactor,
+	        startZoomFactor = this.zoomFactor,
+	        updateProgress = (function(progress) {
+	          this.scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);
+	        }).bind(this);
+
+	      if (this.hasInteraction) {
+	        return;
+	      }
+	      if (startZoomFactor > zoomFactor) {
+	        center = this.getCurrentZoomCenter();
+	      }
+
+	      this.animate(this.options.animationDuration, updateProgress, this.swing);
+	      this.el.trigger(this.options.doubleTapEventName);
+	    },
+
+	    /**
+	     * Max / min values for the offset
+	     * @param offset
+	     * @return {Object} the sanitized offset
+	     */
+	    sanitizeOffset: function(offset) {
+	      var maxX = (this.zoomFactor - 1) * this.getContainerX(),
+	        maxY = (this.zoomFactor - 1) * this.getContainerY(),
+	        maxOffsetX = Math.max(maxX, 0),
+	        maxOffsetY = Math.max(maxY, 0),
+	        minOffsetX = Math.min(maxX, 0),
+	        minOffsetY = Math.min(maxY, 0);
+
+	      return {
+	        x: Math.min(Math.max(offset.x, minOffsetX), maxOffsetX),
+	        y: Math.min(Math.max(offset.y, minOffsetY), maxOffsetY)
+	      };
+	    },
+
+	    /**
+	     * Scale to a specific zoom factor (not relative)
+	     * @param zoomFactor
+	     * @param center
+	     */
+	    scaleTo: function(zoomFactor, center) {
+	      this.scale(zoomFactor / this.zoomFactor, center);
+	    },
+
+	    /**
+	     * Scales the element from specified center
+	     * @param scale
+	     * @param center
+	     */
+	    scale: function(scale, center) {
+	      scale = this.scaleZoomFactor(scale);
+	      this.addOffset({
+	        x: (scale - 1) * (center.x + this.offset.x),
+	        y: (scale - 1) * (center.y + this.offset.y)
+	      });
+	    },
+
+	    /**
+	     * Scales the zoom factor relative to current state
+	     * @param scale
+	     * @return the actual scale (can differ because of max min zoom factor)
+	     */
+	    scaleZoomFactor: function(scale) {
+	      var originalZoomFactor = this.zoomFactor;
+	      this.zoomFactor *= scale;
+	      this.zoomFactor = Math.min(this.options.maxZoom, Math.max(this.zoomFactor, this.options.minZoom));
+	      return this.zoomFactor / originalZoomFactor;
+	    },
+
+	    /**
+	     * Drags the element
+	     * @param center
+	     * @param lastCenter
+	     */
+	    drag: function(center, lastCenter) {
+	      if (lastCenter) {
+	        if (this.options.lockDragAxis) {
+	          // lock scroll to position that was changed the most
+	          if (Math.abs(center.x - lastCenter.x) > Math.abs(center.y - lastCenter.y)) {
+	            this.addOffset({
+	              x: -(center.x - lastCenter.x),
+	              y: 0
+	            });
+	          }
+	          else {
+	            this.addOffset({
+	              y: -(center.y - lastCenter.y),
+	              x: 0
+	            });
+	          }
+	        }
+	        else {
+	          this.addOffset({
+	            y: -(center.y - lastCenter.y),
+	            x: -(center.x - lastCenter.x)
+	          });
+	        }
+	      }
+	    },
+
+	    /**
+	     * Calculates the touch center of multiple touches
+	     * @param touches
+	     * @return {Object}
+	     */
+	    getTouchCenter: function(touches) {
+	      return this.getVectorAvg(touches);
+	    },
+
+	    /**
+	     * Calculates the average of multiple vectors (x, y values)
+	     */
+	    getVectorAvg: function(vectors) {
+	      return {
+	        x: vectors.map(function(v) {
+	          return v.x;
+	        }).reduce(sum) / vectors.length,
+	        y: vectors.map(function(v) {
+	          return v.y;
+	        }).reduce(sum) / vectors.length
+	      };
+	    },
+
+	    /**
+	     * Adds an offset
+	     * @param offset the offset to add
+	     * @return return true when the offset change was accepted
+	     */
+	    addOffset: function(offset) {
+	      this.offset = {
+	        x: this.offset.x + offset.x,
+	        y: this.offset.y + offset.y
+	      };
+	    },
+
+	    sanitize: function() {
+	      if (this.zoomFactor < this.options.zoomOutFactor) {
+	        this.zoomOutAnimation();
+	      } else if (this.isInsaneOffset(this.offset)) {
+	        this.sanitizeOffsetAnimation();
+	      }
+	    },
+
+	    /**
+	     * Checks if the offset is ok with the current zoom factor
+	     * @param offset
+	     * @return {Boolean}
+	     */
+	    isInsaneOffset: function(offset) {
+	      var sanitizedOffset = this.sanitizeOffset(offset);
+	      return sanitizedOffset.x !== offset.x ||
+	        sanitizedOffset.y !== offset.y;
+	    },
+
+	    /**
+	     * Creates an animation moving to a sane offset
+	     */
+	    sanitizeOffsetAnimation: function() {
+	      var targetOffset = this.sanitizeOffset(this.offset),
+	        startOffset = {
+	          x: this.offset.x,
+	          y: this.offset.y
+	        },
+	        updateProgress = (function(progress) {
+	          this.offset.x = startOffset.x + progress * (targetOffset.x - startOffset.x);
+	          this.offset.y = startOffset.y + progress * (targetOffset.y - startOffset.y);
+	          this.update();
+	        }).bind(this);
+
+	      this.animate(
+	        this.options.animationDuration,
+	        updateProgress,
+	        this.swing
+	      );
+	    },
+
+	    /**
+	     * Zooms back to the original position,
+	     * (no offset and zoom factor 1)
+	     */
+	    zoomOutAnimation: function() {
+	      var startZoomFactor = this.zoomFactor,
+	        zoomFactor = 1,
+	        center = this.getCurrentZoomCenter(),
+	        updateProgress = (function(progress) {
+	          this.scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);
+	        }).bind(this);
+
+	      this.animate(
+	        this.options.animationDuration,
+	        updateProgress,
+	        this.swing
+	      );
+	    },
+
+	    /**
+	     * Updates the aspect ratio
+	     */
+	    updateAspectRatio: function() {
+	      this.setContainerY(this.getContainerX() / this.getAspectRatio());
+	    },
+
+	    /**
+	     * Calculates the initial zoom factor (for the element to fit into the container)
+	     * @return the initial zoom factor
+	     */
+	    getInitialZoomFactor: function() {
+	      // use .offsetWidth instead of width()
+	      // because jQuery-width() return the original width but Zepto-width() will calculate width with transform.
+	      // the same as .height()
+	      return this.container[0].offsetWidth / this.el[0].offsetWidth;
+	    },
+
+	    /**
+	     * Calculates the aspect ratio of the element
+	     * @return the aspect ratio
+	     */
+	    getAspectRatio: function() {
+	      return this.el[0].offsetWidth / this.el[0].offsetHeight;
+	    },
+
+	    /**
+	     * Calculates the virtual zoom center for the current offset and zoom factor
+	     * (used for reverse zoom)
+	     * @return {Object} the current zoom center
+	     */
+	    getCurrentZoomCenter: function() {
+
+	      // uses following formula to calculate the zoom center x value
+	      // offset_left / offset_right = zoomcenter_x / (container_x - zoomcenter_x)
+	      var length = this.container[0].offsetWidth * this.zoomFactor,
+	        offsetLeft = this.offset.x,
+	        offsetRight = length - offsetLeft - this.container[0].offsetWidth,
+	        widthOffsetRatio = offsetLeft / offsetRight,
+	        centerX = widthOffsetRatio * this.container[0].offsetWidth / (widthOffsetRatio + 1),
+
+	      // the same for the zoomcenter y
+	        height = this.container[0].offsetHeight * this.zoomFactor,
+	        offsetTop = this.offset.y,
+	        offsetBottom = height - offsetTop - this.container[0].offsetHeight,
+	        heightOffsetRatio = offsetTop / offsetBottom,
+	        centerY = heightOffsetRatio * this.container[0].offsetHeight / (heightOffsetRatio + 1);
+
+	      // prevents division by zero
+	      if (offsetRight === 0) {
+	        centerX = this.container[0].offsetWidth;
+	      }
+	      if (offsetBottom === 0) {
+	        centerY = this.container[0].offsetHeight;
+	      }
+
+	      return {
+	        x: centerX,
+	        y: centerY
+	      };
+	    },
+
+	    canDrag: function() {
+	      return !isCloseTo(this.zoomFactor, 1);
+	    },
+
+	    /**
+	     * Returns the touches of an event relative to the container offset
+	     * @param event
+	     * @return array touches
+	     */
+	    getTouches: function(event) {
+	      var position = this.container.offset();
+	      return Array.prototype.slice.call(event.touches).map(function(touch) {
+	        return {
+	          x: touch.pageX - position.left,
+	          y: touch.pageY - position.top
+	        };
+	      });
+	    },
+
+	    /**
+	     * Animation loop
+	     * does not support simultaneous animations
+	     * @param duration
+	     * @param framefn
+	     * @param timefn
+	     * @param callback
+	     */
+	    animate: function(duration, framefn, timefn, callback) {
+	      var startTime = new Date().getTime(),
+	        renderFrame = (function() {
+	          if (!this.inAnimation) {
+	            return;
+	          }
+	          var frameTime = new Date().getTime() - startTime,
+	            progress = frameTime / duration;
+	          if (frameTime >= duration) {
+	            framefn(1);
+	            if (callback) {
+	              callback();
+	            }
+	            this.update();
+	            this.stopAnimation();
+	            this.update();
+	          } else {
+	            if (timefn) {
+	              progress = timefn(progress);
+	            }
+	            framefn(progress);
+	            this.update();
+	            requestAnimationFrame(renderFrame);
+	          }
+	        }).bind(this);
+	      this.inAnimation = true;
+	      requestAnimationFrame(renderFrame);
+	    },
+
+	    /**
+	     * Stops the animation
+	     */
+	    stopAnimation: function() {
+	      this.inAnimation = false;
+	    },
+
+	    /**
+	     * Swing timing function for animations
+	     * @param p
+	     * @return {Number}
+	     */
+	    swing: function(p) {
+	      return -Math.cos(p * Math.PI) / 2 + 0.5;
+	    },
+
+	    getContainerX: function() {
+	      return this.container[0].offsetWidth;
+	    },
+
+	    getContainerY: function() {
+	      return this.container[0].offsetHeight;
+	    },
+
+	    setContainerY: function(y) {
+	      return this.container.height(y);
+	    },
+
+	    /**
+	     * Creates the expected html structure
+	     */
+	    setupMarkup: function() {
+	      this.container = $('<div class="pinch-zoom-container"></div>');
+	      this.el.before(this.container);
+	      this.container.append(this.el);
+
+	      this.container.css({
+	        'overflow': 'hidden',
+	        'position': 'relative'
+	      });
+
+	      // Zepto doesn't recognize `webkitTransform..` style
+	      this.el.css({
+	        '-webkit-transform-origin': '0% 0%',
+	        '-moz-transform-origin': '0% 0%',
+	        '-ms-transform-origin': '0% 0%',
+	        '-o-transform-origin': '0% 0%',
+	        'transform-origin': '0% 0%',
+	        'position': 'absolute'
+	      });
+	    },
+
+	    end: function() {
+	      this.hasInteraction = false;
+	      this.sanitize();
+	      this.update();
+	    },
+
+	    /**
+	     * Binds all required event listeners
+	     */
+	    bindEvents: function() {
+	      detectGestures(this.container.get(0), this);
+	      // Zepto and jQuery both know about `on`
+	      $(window).on('resize', this.update.bind(this));
+	      $(this.el).find('img').on('load', this.update.bind(this));
+	    },
+
+	    /**
+	     * Updates the css values according to the current zoom factor and offset
+	     */
+	    update: function() {
+
+	      if (this.updatePlaned) {
+	        return;
+	      }
+	      this.updatePlaned = true;
+
+	      setTimeout((function() {
+	        this.updatePlaned = false;
+	        this.updateAspectRatio();
+
+	        var zoomFactor = this.getInitialZoomFactor() * this.zoomFactor,
+	          offsetX = -this.offset.x / zoomFactor,
+	          offsetY = -this.offset.y / zoomFactor,
+	          transform3d = 'scale3d(' + zoomFactor + ', ' + zoomFactor + ',1) ' +
+	            'translate3d(' + offsetX + 'px,' + offsetY + 'px,0px)',
+	          transform2d = 'scale(' + zoomFactor + ', ' + zoomFactor + ') ' +
+	            'translate(' + offsetX + 'px,' + offsetY + 'px)',
+	          removeClone = (function() {
+	            if (this.clone) {
+	              this.clone.remove();
+	              delete this.clone;
+	            }
+	          }).bind(this);
+
+	        // Scale 3d and translate3d are faster (at least on ios)
+	        // but they also reduce the quality.
+	        // PinchZoom uses the 3d transformations during interactions
+	        // after interactions it falls back to 2d transformations
+	        if (!this.options.use2d || this.hasInteraction || this.inAnimation) {
+	          this.is3d = true;
+	          removeClone();
+	          this.el.css({
+	            '-webkit-transform': transform3d,
+	            '-o-transform': transform2d,
+	            '-ms-transform': transform2d,
+	            '-moz-transform': transform2d,
+	            'transform': transform3d
+	          });
+	        } else {
+
+	          // When changing from 3d to 2d transform webkit has some glitches.
+	          // To avoid this, a copy of the 3d transformed element is displayed in the
+	          // foreground while the element is converted from 3d to 2d transform
+	          if (this.is3d) {
+	            this.clone = this.el.clone();
+	            this.clone.css('pointer-events', 'none');
+	            this.clone.appendTo(this.container);
+	            setTimeout(removeClone, 200);
+	          }
+	          this.el.css({
+	            '-webkit-transform': transform2d,
+	            '-o-transform': transform2d,
+	            '-ms-transform': transform2d,
+	            '-moz-transform': transform2d,
+	            'transform': transform2d
+	          });
+	          this.is3d = false;
+	        }
+	      }).bind(this), 0);
+	    },
+
+	    /**
+	     * Enables event handling for gestures
+	     */
+	    enable: function() {
+	      this.enabled = true;
+	    },
+
+	    /**
+	     * Disables event handling for gestures
+	     */
+	    disable: function() {
+	      this.enabled = false;
+	    }
+	  };
+
+	  var detectGestures = function(el, target) {
+	    var interaction = null,
+	      fingers = 0,
+	      lastTouchStart = null,
+	      startTouches = null,
+
+	      setInteraction = function(newInteraction, event) {
+	        if (interaction !== newInteraction) {
+
+	          if (interaction && !newInteraction) {
+	            switch (interaction) {
+	              case "zoom":
+	                target.handleZoomEnd(event);
+	                break;
+	              case 'drag':
+	                target.handleDragEnd(event);
+	                break;
+	            }
+	          }
+
+	          switch (newInteraction) {
+	            case 'zoom':
+	              target.handleZoomStart(event);
+	              break;
+	            case 'drag':
+	              target.handleDragStart(event);
+	              break;
+	          }
+	        }
+	        interaction = newInteraction;
+	      },
+
+	      updateInteraction = function(event) {
+	        if (fingers === 2) {
+	          setInteraction('zoom');
+	        } else if (fingers === 1 && target.canDrag()) {
+	          setInteraction('drag', event);
+	        } else {
+	          setInteraction(null, event);
+	        }
+	      },
+
+	      targetTouches = function(touches) {
+	        return Array.prototype.slice.call(touches).map(function(touch) {
+	          return {
+	            x: touch.pageX,
+	            y: touch.pageY
+	          };
+	        });
+	      },
+
+	      getDistance = function(a, b) {
+	        var x, y;
+	        x = a.x - b.x;
+	        y = a.y - b.y;
+	        return Math.sqrt(x * x + y * y);
+	      },
+
+	      calculateScale = function(startTouches, endTouches) {
+	        var startDistance = getDistance(startTouches[0], startTouches[1]),
+	          endDistance = getDistance(endTouches[0], endTouches[1]);
+	        return endDistance / startDistance;
+	      },
+
+	      cancelEvent = function(event) {
+	        event.stopPropagation();
+	        event.preventDefault();
+	      },
+
+	      detectDoubleTap = function(event) {
+	        var time = (new Date()).getTime();
+
+	        if (fingers > 1) {
+	          lastTouchStart = null;
+	        }
+
+	        if (time - lastTouchStart < 300) {
+	          cancelEvent(event);
+
+	          target.handleDoubleTap(event);
+	          switch (interaction) {
+	            case 'zoom':
+	              target.handleZoomEnd(event);
+	              break;
+	            case 'drag':
+	              target.handleDragEnd(event);
+	              break;
+	          }
+	        }
+
+	        if (fingers === 1) {
+	          lastTouchStart = time;
+	        }
+	      },
+	      firstMove = true;
+
+	    el.addEventListener('touchstart', function(event) {
+	      if (target.enabled) {
+	        firstMove = true;
+	        fingers = event.touches.length;
+	        detectDoubleTap(event);
+	      }
+	    });
+
+	    el.addEventListener('touchmove', function(event) {
+	      if (target.enabled) {
+	        if (firstMove) {
+	          updateInteraction(event);
+	          if (interaction) {
+	            cancelEvent(event);
+	          }
+	          startTouches = targetTouches(event.touches);
+	        } else {
+	          switch (interaction) {
+	            case 'zoom':
+	              target.handleZoom(event, calculateScale(startTouches, targetTouches(event.touches)));
+	              break;
+	            case 'drag':
+	              target.handleDrag(event);
+	              break;
+	          }
+	          if (interaction) {
+	            cancelEvent(event);
+	            target.update();
+	          }
+	        }
+
+	        firstMove = false;
+	      }
+	    });
+
+	    el.addEventListener('touchend', function(event) {
+	      if (target.enabled) {
+	        fingers = event.touches.length;
+	        updateInteraction(event);
+	      }
+	    });
+	  };
+
+	  return PinchZoom;
+	};
+
+	module.exports = UI.pichzoom = definePinchZoom($);
+
+
+/***/ },
+/* 18 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var $w = $(window);
+
+	/**
+	 * @reference https://github.com/nolimits4web/Framework7/blob/master/src/js/modals.js
+	 * @license https://github.com/nolimits4web/Framework7/blob/master/LICENSE
+	 */
+
+	var Popover = function(element, options) {
+	  this.options = $.extend({}, Popover.DEFAULTS, options);
+	  this.$element = $(element);
+	  this.active = null;
+	  this.$popover = (this.options.target && $(this.options.target)) || null;
+
+	  this.init();
+	  this._bindEvents();
+	};
+
+	Popover.DEFAULTS = {
+	  theme: null,
+	  trigger: 'click',
+	  content: '',
+	  open: false,
+	  target: null,
+	  tpl: '<div class="am-popover">' +
+	    '<div class="am-popover-inner"></div>' +
+	    '<div class="am-popover-caret"></div></div>'
+	};
+
+	Popover.prototype.init = function() {
+	  var _this = this;
+	  var $element = this.$element;
+	  var $popover;
+
+	  if (!this.options.target) {
+	    this.$popover = this.getPopover();
+	    this.setContent();
+	  }
+
+	  $popover = this.$popover;
+
+	  $popover.appendTo($('body'));
+
+	  this.sizePopover();
+
+	  function sizePopover() {
+	    _this.sizePopover();
+	  }
+
+	  // TODO: 监听页面内容变化,重新调整位置
+
+	  $element.on('open.popover.amui', function() {
+	    $(window).on('resize.popover.amui', UI.utils.debounce(sizePopover, 50));
+	  });
+
+	  $element.on('close.popover.amui', function() {
+	    $(window).off('resize.popover.amui', sizePopover);
+	  });
+
+	  this.options.open && this.open();
+	};
+
+	Popover.prototype.sizePopover = function sizePopover() {
+	  var $element = this.$element;
+	  var $popover = this.$popover;
+
+	  if (!$popover || !$popover.length) {
+	    return;
+	  }
+
+	  var popWidth = $popover.outerWidth();
+	  var popHeight = $popover.outerHeight();
+	  var $popCaret = $popover.find('.am-popover-caret');
+	  var popCaretSize = ($popCaret.outerWidth() / 2) || 8;
+	  // 取不到 $popCaret.outerHeight() 的值,所以直接加 8
+	  var popTotalHeight = popHeight + 8; // $popCaret.outerHeight();
+
+	  var triggerWidth = $element.outerWidth();
+	  var triggerHeight = $element.outerHeight();
+	  var triggerOffset = $element.offset();
+	  var triggerRect = $element[0].getBoundingClientRect();
+
+	  var winHeight = $w.height();
+	  var winWidth = $w.width();
+	  var popTop = 0;
+	  var popLeft = 0;
+	  var diff = 0;
+	  var spacing = 2;
+	  var popPosition = 'top';
+
+	  $popover.css({left: '', top: ''}).removeClass('am-popover-left ' +
+	  'am-popover-right am-popover-top am-popover-bottom');
+
+	  // $popCaret.css({left: '', top: ''});
+
+	  if (popTotalHeight - spacing < triggerRect.top + spacing) {
+	    // Popover on the top of trigger
+	    popTop = triggerOffset.top - popTotalHeight - spacing;
+	  } else if (popTotalHeight <
+	    winHeight - triggerRect.top - triggerRect.height) {
+	    // On bottom
+	    popPosition = 'bottom';
+	    popTop = triggerOffset.top + triggerHeight + popCaretSize + spacing;
+	  } else { // On middle
+	    popPosition = 'middle';
+	    popTop = triggerHeight / 2 + triggerOffset.top - popHeight / 2;
+	  }
+
+	  // Horizontal Position
+	  if (popPosition === 'top' || popPosition === 'bottom') {
+	    popLeft = triggerWidth / 2 + triggerOffset.left - popWidth / 2;
+
+	    diff = popLeft;
+
+	    if (popLeft < 5) {
+	      popLeft = 5;
+	    }
+
+	    if (popLeft + popWidth > winWidth) {
+	      popLeft = (winWidth - popWidth - 20);
+	      // console.log('left %d, win %d, popw %d', popLeft, winWidth, popWidth);
+	    }
+
+	    if (popPosition === 'top') {
+	      // This is the Popover position, NOT caret position
+	      // Popover on the Top of trigger, caret on the bottom of Popover
+	      $popover.addClass('am-popover-top');
+	    }
+
+	    if (popPosition === 'bottom') {
+	      $popover.addClass('am-popover-bottom');
+	    }
+
+	    diff = diff - popLeft;
+	    // $popCaret.css({left: (popWidth / 2 - popCaretSize + diff) + 'px'});
+
+	  } else if (popPosition === 'middle') {
+	    popLeft = triggerOffset.left - popWidth - popCaretSize;
+	    $popover.addClass('am-popover-left');
+	    if (popLeft < 5) {
+	      popLeft = triggerOffset.left + triggerWidth + popCaretSize;
+	      $popover.removeClass('am-popover-left').addClass('am-popover-right');
+	    }
+
+	    if (popLeft + popWidth > winWidth) {
+	      popLeft = winWidth - popWidth - 5;
+	      $popover.removeClass('am-popover-left').addClass('am-popover-right');
+	    }
+	    // $popCaret.css({top: (popHeight / 2 - popCaretSize / 2) + 'px'});
+	  }
+
+	  // Apply position style
+	  $popover.css({top: popTop + 'px', left: popLeft + 'px'});
+	};
+
+	Popover.prototype.toggle = function() {
+	  return this[this.active ? 'close' : 'open']();
+	};
+
+	Popover.prototype.open = function() {
+	  var $popover = this.$popover;
+
+	  this.$element.trigger('open.popover.amui');
+	  this.sizePopover();
+	  $popover.show().addClass('am-active');
+	  this.active = true;
+	};
+
+	Popover.prototype.close = function() {
+	  var $popover = this.$popover;
+
+	  this.$element.trigger('close.popover.amui');
+
+	  $popover
+	    .removeClass('am-active')
+	    .trigger('closed.popover.amui')
+	    .hide();
+
+	  this.active = false;
+	};
+
+	Popover.prototype.getPopover = function() {
+	  var uid = UI.utils.generateGUID('am-popover');
+	  var theme = [];
+
+	  if (this.options.theme) {
+	    $.each(this.options.theme.split(' '), function(i, item) {
+	      theme.push('am-popover-' + $.trim(item));
+	    });
+	  }
+
+	  return $(this.options.tpl).attr('id', uid).addClass(theme.join(' '));
+	};
+
+	Popover.prototype.setContent = function(content) {
+	  content = content || this.options.content;
+	  this.$popover && this.$popover.find('.am-popover-inner')
+	    .empty().html(content);
+	};
+
+	Popover.prototype._bindEvents = function() {
+	  var eventNS = 'popover.amui';
+	  var triggers = this.options.trigger.split(' ');
+
+	  for (var i = triggers.length; i--;) {
+	    var trigger = triggers[i];
+
+	    if (trigger === 'click') {
+	      this.$element.on('click.' + eventNS, $.proxy(this.toggle, this));
+	    } else { // hover or focus
+	      var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin';
+	      var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout';
+
+	      this.$element.on(eventIn + '.' + eventNS, $.proxy(this.open, this));
+	      this.$element.on(eventOut + '.' + eventNS, $.proxy(this.close, this));
+	    }
+	  }
+	};
+
+	Popover.prototype.destroy = function() {
+	  this.$element.off('.popover.amui').removeData('amui.popover');
+	  this.$popover.remove();
+	};
+
+	UI.plugin('popover', Popover);
+
+	// Init code
+	UI.ready(function(context) {
+	  $('[data-am-popover]', context).popover();
+	});
+
+	module.exports = Popover;
+
+	// TODO: 允许用户定义位置
+
+
+/***/ },
+/* 19 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var UI = __webpack_require__(2);
+
+	var Progress = (function() {
+	  /**
+	   * NProgress (c) 2013, Rico Sta. Cruz
+	   * @via http://ricostacruz.com/nprogress
+	   */
+
+	  var NProgress = {};
+
+	  NProgress.version = '0.2.0';
+
+	  var Settings = NProgress.settings = {
+	    minimum: 0.08,
+	    easing: 'ease',
+	    positionUsing: '',
+	    speed: 200,
+	    trickle: true,
+	    trickleRate: 0.02,
+	    trickleSpeed: 800,
+	    showSpinner: true,
+	    parent: 'body',
+	    barSelector: '[role="nprogress-bar"]',
+	    spinnerSelector: '[role="nprogress-spinner"]',
+	    template: '<div class="nprogress-bar" role="nprogress-bar">' +
+	    '<div class="nprogress-peg"></div></div>' +
+	    '<div class="nprogress-spinner" role="nprogress-spinner">' +
+	    '<div class="nprogress-spinner-icon"></div></div>'
+	  };
+
+	  /**
+	   * Updates configuration.
+	   *
+	   *     NProgress.configure({
+	   *       minimum: 0.1
+	   *     });
+	   */
+	  NProgress.configure = function(options) {
+	    var key, value;
+	    for (key in options) {
+	      value = options[key];
+	      if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
+	    }
+
+	    return this;
+	  };
+
+	  /**
+	   * Last number.
+	   */
+
+	  NProgress.status = null;
+
+	  /**
+	   * Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
+	   *
+	   *     NProgress.set(0.4);
+	   *     NProgress.set(1.0);
+	   */
+
+	  NProgress.set = function(n) {
+	    var started = NProgress.isStarted();
+
+	    n = clamp(n, Settings.minimum, 1);
+	    NProgress.status = (n === 1 ? null : n);
+
+	    var progress = NProgress.render(!started),
+	      bar      = progress.querySelector(Settings.barSelector),
+	      speed    = Settings.speed,
+	      ease     = Settings.easing;
+
+	    progress.offsetWidth; /* Repaint */
+
+	    queue(function(next) {
+	      // Set positionUsing if it hasn't already been set
+	      if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
+
+	      // Add transition
+	      css(bar, barPositionCSS(n, speed, ease));
+
+	      if (n === 1) {
+	        // Fade out
+	        css(progress, {
+	          transition: 'none',
+	          opacity: 1
+	        });
+	        progress.offsetWidth; /* Repaint */
+
+	        setTimeout(function() {
+	          css(progress, {
+	            transition: 'all ' + speed + 'ms linear',
+	            opacity: 0
+	          });
+	          setTimeout(function() {
+	            NProgress.remove();
+	            next();
+	          }, speed);
+	        }, speed);
+	      } else {
+	        setTimeout(next, speed);
+	      }
+	    });
+
+	    return this;
+	  };
+
+	  NProgress.isStarted = function() {
+	    return typeof NProgress.status === 'number';
+	  };
+
+	  /**
+	   * Shows the progress bar.
+	   * This is the same as setting the status to 0%, except that it doesn't go backwards.
+	   *
+	   *     NProgress.start();
+	   *
+	   */
+	  NProgress.start = function() {
+	    if (!NProgress.status) NProgress.set(0);
+
+	    var work = function() {
+	      setTimeout(function() {
+	        if (!NProgress.status) return;
+	        NProgress.trickle();
+	        work();
+	      }, Settings.trickleSpeed);
+	    };
+
+	    if (Settings.trickle) work();
+
+	    return this;
+	  };
+
+	  /**
+	   * Hides the progress bar.
+	   * This is the *sort of* the same as setting the status to 100%, with the
+	   * difference being `done()` makes some placebo effect of some realistic motion.
+	   *
+	   *     NProgress.done();
+	   *
+	   * If `true` is passed, it will show the progress bar even if its hidden.
+	   *
+	   *     NProgress.done(true);
+	   */
+
+	  NProgress.done = function(force) {
+	    if (!force && !NProgress.status) return this;
+
+	    return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
+	  };
+
+	  /**
+	   * Increments by a random amount.
+	   */
+
+	  NProgress.inc = function(amount) {
+	    var n = NProgress.status;
+
+	    if (!n) {
+	      return NProgress.start();
+	    } else {
+	      if (typeof amount !== 'number') {
+	        amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
+	      }
+
+	      n = clamp(n + amount, 0, 0.994);
+	      return NProgress.set(n);
+	    }
+	  };
+
+	  NProgress.trickle = function() {
+	    return NProgress.inc(Math.random() * Settings.trickleRate);
+	  };
+
+	  /**
+	   * Waits for all supplied jQuery promises and
+	   * increases the progress as the promises resolve.
+	   *
+	   * @param $promise jQUery Promise
+	   */
+	  (function() {
+	    var initial = 0, current = 0;
+
+	    NProgress.promise = function($promise) {
+	      if (!$promise || $promise.state() === "resolved") {
+	        return this;
+	      }
+
+	      if (current === 0) {
+	        NProgress.start();
+	      }
+
+	      initial++;
+	      current++;
+
+	      $promise.always(function() {
+	        current--;
+	        if (current === 0) {
+	          initial = 0;
+	          NProgress.done();
+	        } else {
+	          NProgress.set((initial - current) / initial);
+	        }
+	      });
+
+	      return this;
+	    };
+
+	  })();
+
+	  /**
+	   * (Internal) renders the progress bar markup based on the `template`
+	   * setting.
+	   */
+
+	  NProgress.render = function(fromStart) {
+	    if (NProgress.isRendered()) return document.getElementById('nprogress');
+
+	    addClass(document.documentElement, 'nprogress-busy');
+
+	    var progress = document.createElement('div');
+	    progress.id = 'nprogress';
+	    progress.innerHTML = Settings.template;
+
+	    var bar      = progress.querySelector(Settings.barSelector),
+	      perc     = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
+	      parent   = document.querySelector(Settings.parent),
+	      spinner;
+
+	    css(bar, {
+	      transition: 'all 0 linear',
+	      transform: 'translate3d(' + perc + '%,0,0)'
+	    });
+
+	    if (!Settings.showSpinner) {
+	      spinner = progress.querySelector(Settings.spinnerSelector);
+	      spinner && removeElement(spinner);
+	    }
+
+	    if (parent != document.body) {
+	      addClass(parent, 'nprogress-custom-parent');
+	    }
+
+	    parent.appendChild(progress);
+	    return progress;
+	  };
+
+	  /**
+	   * Removes the element. Opposite of render().
+	   */
+
+	  NProgress.remove = function() {
+	    removeClass(document.documentElement, 'nprogress-busy');
+	    removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent');
+	    var progress = document.getElementById('nprogress');
+	    progress && removeElement(progress);
+	  };
+
+	  /**
+	   * Checks if the progress bar is rendered.
+	   */
+
+	  NProgress.isRendered = function() {
+	    return !!document.getElementById('nprogress');
+	  };
+
+	  /**
+	   * Determine which positioning CSS rule to use.
+	   */
+
+	  NProgress.getPositioningCSS = function() {
+	    // Sniff on document.body.style
+	    var bodyStyle = document.body.style;
+
+	    // Sniff prefixes
+	    var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
+	      ('MozTransform' in bodyStyle) ? 'Moz' :
+	        ('msTransform' in bodyStyle) ? 'ms' :
+	          ('OTransform' in bodyStyle) ? 'O' : '';
+
+	    if (vendorPrefix + 'Perspective' in bodyStyle) {
+	      // Modern browsers with 3D support, e.g. Webkit, IE10
+	      return 'translate3d';
+	    } else if (vendorPrefix + 'Transform' in bodyStyle) {
+	      // Browsers without 3D support, e.g. IE9
+	      return 'translate';
+	    } else {
+	      // Browsers without translate() support, e.g. IE7-8
+	      return 'margin';
+	    }
+	  };
+
+	  /**
+	   * Helpers
+	   */
+
+	  function clamp(n, min, max) {
+	    if (n < min) return min;
+	    if (n > max) return max;
+	    return n;
+	  }
+
+	  /**
+	   * (Internal) converts a percentage (`0..1`) to a bar translateX
+	   * percentage (`-100%..0%`).
+	   */
+
+	  function toBarPerc(n) {
+	    return (-1 + n) * 100;
+	  }
+
+
+	  /**
+	   * (Internal) returns the correct CSS for changing the bar's
+	   * position given an n percentage, and speed and ease from Settings
+	   */
+
+	  function barPositionCSS(n, speed, ease) {
+	    var barCSS;
+
+	    if (Settings.positionUsing === 'translate3d') {
+	      barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
+	    } else if (Settings.positionUsing === 'translate') {
+	      barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
+	    } else {
+	      barCSS = { 'margin-left': toBarPerc(n)+'%' };
+	    }
+
+	    barCSS.transition = 'all '+speed+'ms '+ease;
+
+	    return barCSS;
+	  }
+
+	  /**
+	   * (Internal) Queues a function to be executed.
+	   */
+
+	  var queue = (function() {
+	    var pending = [];
+
+	    function next() {
+	      var fn = pending.shift();
+	      if (fn) {
+	        fn(next);
+	      }
+	    }
+
+	    return function(fn) {
+	      pending.push(fn);
+	      if (pending.length == 1) next();
+	    };
+	  })();
+
+	  /**
+	   * (Internal) Applies css properties to an element, similar to the jQuery
+	   * css method.
+	   *
+	   * While this helper does assist with vendor prefixed property names, it
+	   * does not perform any manipulation of values prior to setting styles.
+	   */
+
+	  var css = (function() {
+	    var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
+	      cssProps    = {};
+
+	    function camelCase(string) {
+	      return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
+	        return letter.toUpperCase();
+	      });
+	    }
+
+	    function getVendorProp(name) {
+	      var style = document.body.style;
+	      if (name in style) return name;
+
+	      var i = cssPrefixes.length,
+	        capName = name.charAt(0).toUpperCase() + name.slice(1),
+	        vendorName;
+	      while (i--) {
+	        vendorName = cssPrefixes[i] + capName;
+	        if (vendorName in style) return vendorName;
+	      }
+
+	      return name;
+	    }
+
+	    function getStyleProp(name) {
+	      name = camelCase(name);
+	      return cssProps[name] || (cssProps[name] = getVendorProp(name));
+	    }
+
+	    function applyCss(element, prop, value) {
+	      prop = getStyleProp(prop);
+	      element.style[prop] = value;
+	    }
+
+	    return function(element, properties) {
+	      var args = arguments,
+	        prop,
+	        value;
+
+	      if (args.length == 2) {
+	        for (prop in properties) {
+	          value = properties[prop];
+	          if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
+	        }
+	      } else {
+	        applyCss(element, args[1], args[2]);
+	      }
+	    }
+	  })();
+
+	  /**
+	   * (Internal) Determines if an element or space separated list of class names contains a class name.
+	   */
+
+	  function hasClass(element, name) {
+	    var list = typeof element == 'string' ? element : classList(element);
+	    return list.indexOf(' ' + name + ' ') >= 0;
+	  }
+
+	  /**
+	   * (Internal) Adds a class to an element.
+	   */
+
+	  function addClass(element, name) {
+	    var oldList = classList(element),
+	      newList = oldList + name;
+
+	    if (hasClass(oldList, name)) return;
+
+	    // Trim the opening space.
+	    element.className = newList.substring(1);
+	  }
+
+	  /**
+	   * (Internal) Removes a class from an element.
+	   */
+
+	  function removeClass(element, name) {
+	    var oldList = classList(element),
+	      newList;
+
+	    if (!hasClass(element, name)) return;
+
+	    // Replace the class name.
+	    newList = oldList.replace(' ' + name + ' ', ' ');
+
+	    // Trim the opening and closing spaces.
+	    element.className = newList.substring(1, newList.length - 1);
+	  }
+
+	  /**
+	   * (Internal) Gets a space separated list of the class names on the element.
+	   * The list is wrapped with a single space on each end to facilitate finding
+	   * matches within the list.
+	   */
+
+	  function classList(element) {
+	    return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
+	  }
+
+	  /**
+	   * (Internal) Removes an element from the DOM.
+	   */
+
+	  function removeElement(element) {
+	    element && element.parentNode && element.parentNode.removeChild(element);
+	  }
+
+	  return NProgress;
+	})();
+
+	module.exports = UI.progress = Progress;
+
+
+/***/ },
+/* 20 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var PinchZoom = __webpack_require__(17);
+	var Hammer = __webpack_require__(3);
+	var animation = UI.support.animation;
+	var transition = UI.support.transition;
+
+	/**
+	 * PureView
+	 * @desc Image browser for Mobile
+	 * @param element
+	 * @param options
+	 * @constructor
+	 */
+
+	var PureView = function(element, options) {
+	  this.$element = $(element);
+	  this.$body = $(document.body);
+	  this.options = $.extend({}, PureView.DEFAULTS, options);
+	  this.$pureview = $(this.options.tpl).attr('id',
+	    UI.utils.generateGUID('am-pureview'));
+
+	  this.$slides = null;
+	  this.transitioning = null;
+	  this.scrollbarWidth = 0;
+
+	  this.init();
+	};
+
+	PureView.DEFAULTS = {
+	  tpl: '<div class="am-pureview am-pureview-bar-active">' +
+	  '<ul class="am-pureview-slider"></ul>' +
+	  '<ul class="am-pureview-direction">' +
+	  '<li class="am-pureview-prev"><a href=""></a></li>' +
+	  '<li class="am-pureview-next"><a href=""></a></li></ul>' +
+	  '<ol class="am-pureview-nav"></ol>' +
+	  '<div class="am-pureview-bar am-active">' +
+	  '<span class="am-pureview-title"></span>' +
+	  '<div class="am-pureview-counter"><span class="am-pureview-current"></span> / ' +
+	  '<span class="am-pureview-total"></span></div></div>' +
+	  '<div class="am-pureview-actions am-active">' +
+	  '<a href="javascript: void(0)" class="am-icon-chevron-left" ' +
+	  'data-am-close="pureview"></a></div>' +
+	  '</div>',
+
+	  className: {
+	    prevSlide: 'am-pureview-slide-prev',
+	    nextSlide: 'am-pureview-slide-next',
+	    onlyOne: 'am-pureview-only',
+	    active: 'am-active',
+	    barActive: 'am-pureview-bar-active',
+	    activeBody: 'am-pureview-active'
+	  },
+
+	  selector: {
+	    slider: '.am-pureview-slider',
+	    close: '[data-am-close="pureview"]',
+	    total: '.am-pureview-total',
+	    current: '.am-pureview-current',
+	    title: '.am-pureview-title',
+	    actions: '.am-pureview-actions',
+	    bar: '.am-pureview-bar',
+	    pinchZoom: '.am-pinch-zoom',
+	    nav: '.am-pureview-nav'
+	  },
+
+	  shareBtn: false,
+
+	  // press to toggle Toolbar
+	  toggleToolbar: true,
+
+	  // 从何处获取图片,img 可以使用 data-rel 指定大图
+	  target: 'img',
+
+	  // 微信 Webview 中调用微信的图片浏览器
+	  // 实现图片保存、分享好友、收藏图片等功能
+	  weChatImagePreview: true
+	};
+
+	PureView.prototype.init = function() {
+	  var _this = this;
+	  var options = this.options;
+	  var $element = this.$element;
+	  var $pureview = this.$pureview;
+
+	  this.refreshSlides();
+
+	  $('body').append($pureview);
+
+	  this.$title = $pureview.find(options.selector.title);
+	  this.$current = $pureview.find(options.selector.current);
+	  this.$bar = $pureview.find(options.selector.bar);
+	  this.$actions = $pureview.find(options.selector.actions);
+
+	  if (options.shareBtn) {
+	    this.$actions.append('<a href="javascript: void(0)" ' +
+	    'class="am-icon-share-square-o" data-am-toggle="share"></a>');
+	  }
+
+	  this.$element.on('click.pureview.amui', options.target, function(e) {
+	    e.preventDefault();
+	    var clicked = _this.$images.index(this);
+
+	    // Invoke WeChat ImagePreview in WeChat
+	    // TODO: detect WeChat before init
+	    if (options.weChatImagePreview && window.WeixinJSBridge) {
+	      window.WeixinJSBridge.invoke('imagePreview', {
+	        current: _this.imgUrls[clicked],
+	        urls: _this.imgUrls
+	      });
+	    } else {
+	      _this.open(clicked);
+	    }
+	  });
+
+	  $pureview.find('.am-pureview-direction').
+	    on('click.direction.pureview.amui', 'li', function(e) {
+	      e.preventDefault();
+
+	      if ($(this).is('.am-pureview-prev')) {
+	        _this.prevSlide();
+	      } else {
+	        _this.nextSlide();
+	      }
+	    });
+
+	  // Nav Contorl
+	  $pureview.find(options.selector.nav).on('click.nav.pureview.amui', 'li',
+	    function() {
+	      var index = _this.$navItems.index($(this));
+	      _this.activate(_this.$slides.eq(index));
+	    });
+
+	  // Close Icon
+	  $pureview.find(options.selector.close).
+	    on('click.close.pureview.amui', function(e) {
+	      e.preventDefault();
+	      _this.close();
+	    });
+
+	  this.$slider.hammer().on('swipeleft.pureview.amui', function(e) {
+	    e.preventDefault();
+	    _this.nextSlide();
+	  }).on('swiperight.pureview.amui', function(e) {
+	    e.preventDefault();
+	    _this.prevSlide();
+	  }).on('press.pureview.amui', function(e) {
+	    e.preventDefault();
+	    options.toggleToolbar && _this.toggleToolBar();
+	  });
+
+	  this.$slider.data('hammer').get('swipe').set({
+	    direction: Hammer.DIRECTION_HORIZONTAL,
+	    velocity: 0.35
+	  });
+
+	  // Observe DOM
+	  $element.DOMObserve({
+	    childList: true,
+	    subtree: true
+	  }, function(mutations, observer) {
+	    // _this.refreshSlides();
+	    // console.log('mutations[0].type);
+	  });
+
+	  // NOTE:
+	  // trigger this event manually if MutationObserver not supported
+	  //   when new images appended, or call refreshSlides()
+	  // if (!UI.support.mutationobserver) $element.trigger('changed.dom.amui')
+	  $element.on('changed.dom.amui', function(e) {
+	    e.stopPropagation();
+	    _this.refreshSlides();
+	  });
+
+	  $(document).on('keydown.pureview.amui', $.proxy(function(e) {
+	    var keyCode = e.keyCode;
+	    if (keyCode == 37) {
+	      this.prevSlide();
+	    } else if (keyCode == 39) {
+	      this.nextSlide();
+	    } else if (keyCode == 27) {
+	      this.close();
+	    }
+	  }, this));
+	};
+
+	PureView.prototype.refreshSlides = function() {
+	  // update images collections
+	  this.$images = this.$element.find(this.options.target);
+	  var _this = this;
+	  var options = this.options;
+	  var $pureview = this.$pureview;
+	  var $slides = $([]);
+	  var $navItems = $([]);
+	  var $images = this.$images;
+	  var total = $images.length;
+	  this.$slider = $pureview.find(options.selector.slider);
+	  this.$nav = $pureview.find(options.selector.nav);
+	  var viewedFlag = 'data-am-pureviewed';
+	  // for WeChat Image Preview
+	  this.imgUrls = this.imgUrls || [];
+
+	  if (!total) {
+	    return;
+	  }
+
+	  if (total === 1) {
+	    $pureview.addClass(options.className.onlyOne);
+	  }
+
+	  $images.not('[' + viewedFlag + ']').each(function(i, item) {
+	    var src;
+	    var title;
+
+	    // get image URI from link's href attribute
+	    if (item.nodeName === 'A') {
+	      src = item.href; // to absolute path
+	      title = item.title || '';
+	    } else {
+	      // NOTE: `data-rel` should be a full URL, otherwise,
+	      //        WeChat images preview will not work
+	      src = $(item).data('rel') || item.src; // <img src='' data-rel='' />
+	      src = UI.utils.getAbsoluteUrl(src);
+	      title = $(item).attr('alt') || '';
+	    }
+
+	    // add pureviewed flag
+	    item.setAttribute(viewedFlag, '1');
+
+	    // hide bar: wechat_webview_type=1
+	    // http://tmt.io/wechat/  not working?
+	    _this.imgUrls.push(src);
+
+	    $slides = $slides.add($('<li data-src="' + src + '" data-title="' + title +
+	    '"></li>'));
+	    $navItems = $navItems.add($('<li>' + (i + 1) + '</li>'));
+	  });
+
+	  $pureview.find(options.selector.total).text(total);
+
+	  this.$slider.append($slides);
+	  this.$nav.append($navItems);
+	  this.$navItems = this.$nav.find('li');
+	  this.$slides = this.$slider.find('li');
+	};
+
+	PureView.prototype.loadImage = function($slide, callback) {
+	  var appendedFlag = 'image-appended';
+
+	  if (!$slide.data(appendedFlag)) {
+	    var $img = $('<img>', {
+	      src: $slide.data('src'),
+	      alt: $slide.data('title')
+	    });
+
+	    $slide.html($img).wrapInner('<div class="am-pinch-zoom"></div>').redraw();
+
+	    var $pinchWrapper = $slide.find(this.options.selector.pinchZoom);
+	    $pinchWrapper.data('amui.pinchzoom', new PinchZoom($pinchWrapper[0], {}));
+	    $slide.data('image-appended', true);
+	  }
+
+	  callback && callback.call(this);
+	};
+
+	PureView.prototype.activate = function($slide) {
+	  var options = this.options;
+	  var $slides = this.$slides;
+	  var activeIndex = $slides.index($slide);
+	  var title = $slide.data('title') || '';
+	  var active = options.className.active;
+
+	  if ($slides.find('.' + active).is($slide)) {
+	    return;
+	  }
+
+	  if (this.transitioning) {
+	    return;
+	  }
+
+	  this.loadImage($slide, function() {
+	    UI.utils.imageLoader($slide.find('img'), function(image) {
+	      $slide.find('.am-pinch-zoom').addClass('am-pureview-loaded');
+	      $(image).addClass('am-img-loaded');
+	    });
+	  });
+
+	  this.transitioning = 1;
+
+	  this.$title.text(title);
+	  this.$current.text(activeIndex + 1);
+	  $slides.removeClass();
+	  $slide.addClass(active);
+	  $slides.eq(activeIndex - 1).addClass(options.className.prevSlide);
+	  $slides.eq(activeIndex + 1).addClass(options.className.nextSlide);
+
+	  this.$navItems.removeClass().
+	    eq(activeIndex).addClass(options.className.active);
+
+	  if (transition) {
+	    $slide.one(transition.end, $.proxy(function() {
+	      this.transitioning = 0;
+	    }, this)).emulateTransitionEnd(300);
+	  } else {
+	    this.transitioning = 0;
+	  }
+
+	  // TODO: pre-load next image
+	};
+
+	PureView.prototype.nextSlide = function() {
+	  if (this.$slides.length === 1) {
+	    return;
+	  }
+
+	  var $slides = this.$slides;
+	  var $active = $slides.filter('.am-active');
+	  var activeIndex = $slides.index($active);
+	  var rightSpring = 'am-animation-right-spring';
+
+	  if (activeIndex + 1 >= $slides.length) { // last one
+	    animation && $active.addClass(rightSpring).on(animation.end, function() {
+	      $active.removeClass(rightSpring);
+	    });
+	  } else {
+	    this.activate($slides.eq(activeIndex + 1));
+	  }
+	};
+
+	PureView.prototype.prevSlide = function() {
+	  if (this.$slides.length === 1) {
+	    return;
+	  }
+
+	  var $slides = this.$slides;
+	  var $active = $slides.filter('.am-active');
+	  var activeIndex = this.$slides.index(($active));
+	  var leftSpring = 'am-animation-left-spring';
+
+	  if (activeIndex === 0) { // first one
+	    animation && $active.addClass(leftSpring).on(animation.end, function() {
+	      $active.removeClass(leftSpring);
+	    });
+	  } else {
+	    this.activate($slides.eq(activeIndex - 1));
+	  }
+	};
+
+	PureView.prototype.toggleToolBar = function() {
+	  this.$pureview.toggleClass(this.options.className.barActive);
+	};
+
+	PureView.prototype.open = function(index) {
+	  var active = index || 0;
+	  this.checkScrollbar();
+	  this.setScrollbar();
+	  this.activate(this.$slides.eq(active));
+	  this.$pureview.show().redraw().addClass(this.options.className.active);
+	  this.$body.addClass(this.options.className.activeBody);
+	};
+
+	PureView.prototype.close = function() {
+	  var options = this.options;
+
+	  this.$pureview.removeClass(options.className.active);
+	  this.$slides.removeClass();
+
+	  function resetBody() {
+	    this.$pureview.hide();
+	    this.$body.removeClass(options.className.activeBody);
+	    this.resetScrollbar();
+	  }
+
+	  if (transition) {
+	    this.$pureview.one(transition.end, $.proxy(resetBody, this)).
+	      emulateTransitionEnd(300);
+	  } else {
+	    resetBody.call(this);
+	  }
+	};
+
+	PureView.prototype.checkScrollbar = function() {
+	  this.scrollbarWidth = UI.utils.measureScrollbar();
+	};
+
+	PureView.prototype.setScrollbar = function() {
+	  var bodyPaddingRight = parseInt((this.$body.css('padding-right') || 0), 10);
+	  if (this.scrollbarWidth) {
+	    this.$body.css('padding-right', bodyPaddingRight + this.scrollbarWidth);
+	  }
+	};
+
+	PureView.prototype.resetScrollbar = function() {
+	  this.$body.css('padding-right', '');
+	};
+
+	UI.plugin('pureview', PureView);
+
+	// Init code
+	UI.ready(function(context) {
+	  $('[data-am-pureview]', context).pureview();
+	});
+
+	module.exports = PureView;
+
+	// TODO: 1. 动画改进
+	//       2. 改变图片的时候恢复 Zoom
+	//       3. 选项
+	//       4. 图片高度问题:由于 PinchZoom 的原因,过高的图片如果设置看了滚动,则放大以后显示不全
+
+
+/***/ },
+/* 21 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	/**
+	 * @via https://github.com/uikit/uikit/blob/master/src/js/scrollspy.js
+	 * @license https://github.com/uikit/uikit/blob/master/LICENSE.md
+	 */
+
+	var ScrollSpy = function(element, options) {
+	  if (!UI.support.animation) {
+	    return;
+	  }
+
+	  this.options = $.extend({}, ScrollSpy.DEFAULTS, options);
+	  this.$element = $(element);
+
+	  var checkViewRAF = function() {
+	    UI.utils.rAF.call(window, $.proxy(this.checkView, this));
+	  }.bind(this);
+
+	  this.$window = $(window).on('scroll.scrollspy.amui', checkViewRAF)
+	    .on('resize.scrollspy.amui orientationchange.scrollspy.amui',
+	    UI.utils.debounce(checkViewRAF, 50));
+
+	  this.timer = this.inViewState = this.initInView = null;
+
+	  checkViewRAF();
+	};
+
+	ScrollSpy.DEFAULTS = {
+	  animation: 'fade',
+	  className: {
+	    inView: 'am-scrollspy-inview',
+	    init: 'am-scrollspy-init'
+	  },
+	  repeat: true,
+	  delay: 0,
+	  topOffset: 0,
+	  leftOffset: 0
+	};
+
+	ScrollSpy.prototype.checkView = function() {
+	  var $element = this.$element;
+	  var options = this.options;
+	  var inView = UI.utils.isInView($element, options);
+	  var animation = options.animation ?
+	  ' am-animation-' + options.animation : '';
+
+	  if (inView && !this.inViewState) {
+	    if (this.timer) {
+	      clearTimeout(this.timer);
+	    }
+
+	    if (!this.initInView) {
+	      $element.addClass(options.className.init);
+	      this.offset = $element.offset();
+	      this.initInView = true;
+
+	      $element.trigger('init.scrollspy.amui');
+	    }
+
+	    this.timer = setTimeout(function() {
+	      if (inView) {
+	        $element.addClass(options.className.inView + animation).width();
+	      }
+	    }, options.delay);
+
+	    this.inViewState = true;
+	    $element.trigger('inview.scrollspy.amui');
+	  }
+
+	  if (!inView && this.inViewState && options.repeat) {
+	    $element.removeClass(options.className.inView + animation);
+
+	    this.inViewState = false;
+
+	    $element.trigger('outview.scrollspy.amui');
+	  }
+	};
+
+	ScrollSpy.prototype.check = function() {
+	  UI.utils.rAF.call(window, $.proxy(this.checkView, this));
+	};
+
+	// Sticky Plugin
+	UI.plugin('scrollspy', ScrollSpy);
+
+	// Init code
+	UI.ready(function(context) {
+	  $('[data-am-scrollspy]', context).scrollspy();
+	});
+
+	module.exports = ScrollSpy;
+
+
+/***/ },
+/* 22 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(23);
+
+	/**
+	 * @via https://github.com/uikit/uikit/
+	 * @license https://github.com/uikit/uikit/blob/master/LICENSE.md
+	 */
+
+	// ScrollSpyNav Class
+	var ScrollSpyNav = function(element, options) {
+	  this.options = $.extend({}, ScrollSpyNav.DEFAULTS, options);
+	  this.$element = $(element);
+	  this.anchors = [];
+
+	  this.$links = this.$element.find('a[href^="#"]').each(function(i, link) {
+	    this.anchors.push($(link).attr('href'));
+	  }.bind(this));
+
+	  this.$targets = $(this.anchors.join(', '));
+
+	  var processRAF = function() {
+	    UI.utils.rAF.call(window, $.proxy(this.process, this));
+	  }.bind(this);
+
+	  this.$window = $(window).on('scroll.scrollspynav.amui', processRAF)
+	    .on('resize.scrollspynav.amui orientationchange.scrollspynav.amui',
+	    UI.utils.debounce(processRAF, 50));
+
+	  processRAF();
+	  this.scrollProcess();
+	};
+
+	ScrollSpyNav.DEFAULTS = {
+	  className: {
+	    active: 'am-active'
+	  },
+	  closest: false,
+	  smooth: true,
+	  offsetTop: 0
+	};
+
+	ScrollSpyNav.prototype.process = function() {
+	  var scrollTop = this.$window.scrollTop();
+	  var options = this.options;
+	  var inViews = [];
+	  var $links = this.$links;
+
+	  var $targets = this.$targets;
+
+	  $targets.each(function(i, target) {
+	    if (UI.utils.isInView(target, options)) {
+	      inViews.push(target);
+	    }
+	  });
+
+	  // console.log(inViews.length);
+
+	  if (inViews.length) {
+	    var $target;
+
+	    $.each(inViews, function(i, item) {
+	      if ($(item).offset().top >= scrollTop) {
+	        $target = $(item);
+	        return false; // break
+	      }
+	    });
+
+	    if (!$target) {
+	      return;
+	    }
+
+	    if (options.closest) {
+	      $links.closest(options.closest).removeClass(options.className.active);
+	      $links.filter('a[href="#' + $target.attr('id') + '"]').
+	        closest(options.closest).addClass(options.className.active);
+	    } else {
+	      $links.removeClass(options.className.active).
+	        filter('a[href="#' + $target.attr('id') + '"]').
+	        addClass(options.className.active);
+	    }
+	  }
+	};
+
+	ScrollSpyNav.prototype.scrollProcess = function() {
+	  var $links = this.$links;
+	  var options = this.options;
+
+	  // smoothScroll
+	  if (options.smooth && $.fn.smoothScroll) {
+	    $links.on('click', function(e) {
+	      e.preventDefault();
+
+	      var $this = $(this);
+	      var $target = $($this.attr('href'));
+
+	      if (!$target) {
+	        return;
+	      }
+
+	      var offsetTop = options.offsetTop &&
+	        !isNaN(parseInt(options.offsetTop)) && parseInt(options.offsetTop) || 0;
+
+	      $(window).smoothScroll({position: $target.offset().top - offsetTop});
+	    });
+	  }
+	};
+
+	// ScrollSpyNav Plugin
+	UI.plugin('scrollspynav', ScrollSpyNav);
+
+	// Init code
+	UI.ready(function(context) {
+	  $('[data-am-scrollspynav]', context).scrollspynav();
+	});
+
+	module.exports = ScrollSpyNav;
+
+	// TODO: 1. 算法改进
+	//       2. 多级菜单支持
+	//       3. smooth scroll pushState
+
+
+/***/ },
+/* 23 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var rAF = UI.utils.rAF;
+	var cAF = UI.utils.cancelAF;
+
+	/**
+	 * Smooth Scroll
+	 * @param position
+	 * @via http://mir.aculo.us/2014/01/19/scrolling-dom-elements-to-the-top-a-zepto-plugin/
+	 */
+
+	// Usage: $(window).smoothScroll([options])
+
+	// only allow one scroll to top operation to be in progress at a time,
+	// which is probably what you want
+	var smoothScrollInProgress = false;
+
+	var SmoothScroll = function(element, options) {
+	  options = options || {};
+
+	  var $this = $(element);
+	  var targetY = parseInt(options.position) || SmoothScroll.DEFAULTS.position;
+	  var initialY = $this.scrollTop();
+	  var lastY = initialY;
+	  var delta = targetY - initialY;
+	  // duration in ms, make it a bit shorter for short distances
+	  // this is not scientific and you might want to adjust this for
+	  // your preferences
+	  var speed = options.speed ||
+	      Math.min(750, Math.min(1500, Math.abs(initialY - targetY)));
+	  // temp variables (t will be a position between 0 and 1, y is the calculated scrollTop)
+	  var start;
+	  var t;
+	  var y;
+	  var cancelScroll = function() {
+	      abort();
+	    };
+
+	  // abort if already in progress or nothing to scroll
+	  if (smoothScrollInProgress) {
+	    return;
+	  }
+
+	  if (delta === 0) {
+	    return;
+	  }
+
+	  // quint ease-in-out smoothing, from
+	  // https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js#L127-L136
+	  function smooth(pos) {
+	    if ((pos /= 0.5) < 1) {
+	      return 0.5 * Math.pow(pos, 5);
+	    }
+
+	    return 0.5 * (Math.pow((pos - 2), 5) + 2);
+	  }
+
+	  function abort() {
+	    $this.off('touchstart.smoothscroll.amui', cancelScroll);
+	    smoothScrollInProgress = false;
+	  }
+
+	  // when there's a touch detected while scrolling is in progress, abort
+	  // the scrolling (emulates native scrolling behavior)
+	  $this.on('touchstart.smoothscroll.amui', cancelScroll);
+	  smoothScrollInProgress = true;
+
+	  // start rendering away! note the function given to frame
+	  // is named "render" so we can reference it again further down
+	  function render(now) {
+	    if (!smoothScrollInProgress) {
+	      return;
+	    }
+	    if (!start) {
+	      start = now;
+	    }
+
+	    // calculate t, position of animation in [0..1]
+	    t = Math.min(1, Math.max((now - start) / speed, 0));
+	    // calculate the new scrollTop position (don't forget to smooth)
+	    y = Math.round(initialY + delta * smooth(t));
+	    // bracket scrollTop so we're never over-scrolling
+	    if (delta > 0 && y > targetY) {
+	      y = targetY;
+	    }
+	    if (delta < 0 && y < targetY) {
+	      y = targetY;
+	    }
+
+	    // only actually set scrollTop if there was a change fromt he last frame
+	    if (lastY != y) {
+	      $this.scrollTop(y);
+	    }
+
+	    lastY = y;
+	    // if we're not done yet, queue up an other frame to render,
+	    // or clean up
+	    if (y !== targetY) {
+	      cAF(scrollRAF);
+	      scrollRAF = rAF(render);
+	    } else {
+	      cAF(scrollRAF);
+	      abort();
+	    }
+	  }
+
+	  var scrollRAF = rAF(render);
+	};
+
+	SmoothScroll.DEFAULTS = {
+	  position: 0
+	};
+
+	$.fn.smoothScroll = function(option) {
+	  return this.each(function() {
+	    new SmoothScroll(this, option);
+	  });
+	};
+
+	// Init code
+	$(document).on('click.smoothScroll.amui.data-api', '[data-am-smooth-scroll]',
+	  function(e) {
+	    e.preventDefault();
+	    var options = UI.utils.parseOptions($(this).data('amSmoothScroll'));
+
+	    $(window).smoothScroll(options);
+	  });
+
+	module.exports = SmoothScroll;
+
+
+/***/ },
+/* 24 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	// require('./ui.dropdown');
+
+	// Make jQuery :contains Case-Insensitive
+	$.expr[':'].containsNC = function(elem, i, match, array) {
+	  return (elem.textContent || elem.innerText || '').toLowerCase().
+	      indexOf((match[3] || '').toLowerCase()) >= 0;
+	};
+
+	/**
+	 * Selected
+	 * @desc HTML select replacer
+	 * @via https://github.com/silviomoreto/bootstrap-select
+	 * @license https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE
+	 * @param element
+	 * @param options
+	 * @constructor
+	 */
+
+	var Selected = function(element, options) {
+	  this.$element = $(element);
+	  this.options = $.extend({}, Selected.DEFAULTS, {
+	    placeholder: element.getAttribute('placeholder') ||
+	    Selected.DEFAULTS.placeholder
+	  }, options);
+	  this.$originalOptions = this.$element.find('option');
+	  this.multiple = element.multiple;
+	  this.$selector = null;
+	  this.initialized = false;
+	  this.init();
+	};
+
+	Selected.DEFAULTS = {
+	  btnWidth: null,
+	  btnSize: null,
+	  btnStyle: 'default',
+	  dropUp: 0,
+	  maxHeight: null,
+	  maxChecked: null,
+	  placeholder: '点击选择...',
+	  selectedClass: 'am-checked',
+	  disabledClass: 'am-disabled',
+	  searchBox: false,
+	  tpl: '<div class="am-selected am-dropdown ' +
+	  '<%= dropUp ? \'am-dropdown-up\': \'\' %>" id="<%= id %>" data-am-dropdown>' +
+	  '  <button type="button" class="am-selected-btn am-btn am-dropdown-toggle">' +
+	  '    <span class="am-selected-status am-fl"></span>' +
+	  '    <i class="am-selected-icon am-icon-caret-' +
+	  '<%= dropUp ? \'up\' : \'down\' %>"></i>' +
+	  '  </button>' +
+	  '  <div class="am-selected-content am-dropdown-content">' +
+	  '    <h2 class="am-selected-header">' +
+	  '<span class="am-icon-chevron-left">返回</span></h2>' +
+	  '   <% if (searchBox) { %>' +
+	  '   <div class="am-selected-search">' +
+	  '     <input autocomplete="off" class="am-form-field am-input-sm" />' +
+	  '   </div>' +
+	  '   <% } %>' +
+	  '    <ul class="am-selected-list">' +
+	  '      <% for (var i = 0; i < options.length; i++) { %>' +
+	  '       <% var option = options[i] %>' +
+	  '       <% if (option.header) { %>' +
+	  '  <li data-group="<%= option.group %>" class="am-selected-list-header">' +
+	  '       <%= option.text %></li>' +
+	  '       <% } else { %>' +
+	  '       <li class="<%= option.classNames%>" ' +
+	  '         data-index="<%= option.index %>" ' +
+	  '         data-group="<%= option.group || 0 %>" ' +
+	  '         data-value="<%= option.value %>" >' +
+	  '         <span class="am-selected-text"><%= option.text %></span>' +
+	  '         <i class="am-icon-check"></i></li>' +
+	  '      <% } %>' +
+	  '      <% } %>' +
+	  '    </ul>' +
+	  '    <div class="am-selected-hint"></div>' +
+	  '  </div>' +
+	  '</div>',
+	  listTpl:   '<% for (var i = 0; i < options.length; i++) { %>' +
+	  '       <% var option = options[i] %>' +
+	  '       <% if (option.header) { %>' +
+	  '  <li data-group="<%= option.group %>" class="am-selected-list-header">' +
+	  '       <%= option.text %></li>' +
+	  '       <% } else { %>' +
+	  '       <li class="<%= option.classNames %>" ' +
+	  '         data-index="<%= option.index %>" ' +
+	  '         data-group="<%= option.group || 0 %>" ' +
+	  '         data-value="<%= option.value %>" >' +
+	  '         <span class="am-selected-text"><%= option.text %></span>' +
+	  '         <i class="am-icon-check"></i></li>' +
+	  '      <% } %>' +
+	  '      <% } %>'
+	};
+
+	Selected.prototype.init = function() {
+	  var _this = this;
+	  var $element = this.$element;
+	  var options = this.options;
+
+	  $element.hide();
+
+	  var data = {
+	    id: UI.utils.generateGUID('am-selected'),
+	    multiple: this.multiple,
+	    options: [],
+	    searchBox: options.searchBox,
+	    dropUp: options.dropUp,
+	    placeholder: options.placeholder
+	  };
+
+	  this.$selector = $(UI.template(this.options.tpl, data));
+	  // set select button styles
+	  this.$selector.css({width: this.options.btnWidth});
+
+	  this.$list = this.$selector.find('.am-selected-list');
+	  this.$searchField = this.$selector.find('.am-selected-search input');
+	  this.$hint = this.$selector.find('.am-selected-hint');
+
+	  var $selectorBtn = this.$selector.find('.am-selected-btn');
+	  var btnClassNames = [];
+
+	  options.btnSize && btnClassNames.push('am-btn-' + options.btnSize);
+	  options.btnStyle && btnClassNames.push('am-btn-' + options.btnStyle);
+	  $selectorBtn.addClass(btnClassNames.join(' '));
+
+	  this.$selector.dropdown({
+	    justify: $selectorBtn
+	  });
+
+	  // disable Selected instance if <selected> is disabled
+	  // should call .disable() after Dropdown initialed
+	  if ($element[0].disabled) {
+	    this.disable();
+	  }
+
+	  // set list height
+	  if (options.maxHeight) {
+	    this.$selector.find('.am-selected-list').css({
+	      'max-height': options.maxHeight,
+	      'overflow-y': 'scroll'
+	    });
+	  }
+
+	  // set hint text
+	  var hint = [];
+	  var min = $element.attr('minchecked');
+	  var max = $element.attr('maxchecked') || options.maxChecked;
+
+	  this.maxChecked = max || Infinity;
+
+	  if ($element[0].required) {
+	    hint.push('必选');
+	  }
+
+	  if (min || max) {
+	    min && hint.push('至少选择 ' + min + ' 项');
+	    max && hint.push('至多选择 ' + max + ' 项');
+	  }
+
+	  this.$hint.text(hint.join(','));
+
+	  // render dropdown list
+	  this.renderOptions();
+
+	  // append $selector after <select>
+	  this.$element.after(this.$selector);
+	  this.dropdown = this.$selector.data('amui.dropdown');
+	  this.$status = this.$selector.find('.am-selected-status');
+
+	  // #try to fixes #476
+	  setTimeout(function() {
+	    _this.syncData();
+	    _this.initialized = true;
+	  }, 0);
+
+	  this.bindEvents();
+	};
+
+	Selected.prototype.renderOptions = function() {
+	  var $element = this.$element;
+	  var options = this.options;
+	  var optionItems = [];
+	  var $optgroup = $element.find('optgroup');
+	  this.$originalOptions = this.$element.find('option');
+
+	  // 单选框使用 JS 禁用已经选择的 option 以后,
+	  // 浏览器会重新选定第一个 option,但有一定延迟,致使 JS 获取 value 时返回 null
+	  if (!this.multiple && ($element.val() === null)) {
+	    this.$originalOptions.length &&
+	    (this.$originalOptions.get(0).selected = true);
+	  }
+
+	  function pushOption(index, item, group) {
+	    if (item.value === '') {
+	      // skip to next iteration
+	      // @see http://stackoverflow.com/questions/481601/how-to-skip-to-next-iteration-in-jquery-each-util
+	      return true;
+	    }
+
+	    var classNames = '';
+	    item.disabled && (classNames += options.disabledClass);
+	    !item.disabled && item.selected && (classNames += options.selectedClass);
+
+	    optionItems.push({
+	      group: group,
+	      index: index,
+	      classNames: classNames,
+	      text: item.text,
+	      value: item.value
+	    });
+	  }
+
+	  // select with option groups
+	  if ($optgroup.length) {
+	    $optgroup.each(function(i) {
+	      // push group name
+	      optionItems.push({
+	        header: true,
+	        group: i + 1,
+	        text: this.label
+	      });
+
+	      $optgroup.eq(i).find('option').each(function(index, item) {
+	        pushOption(index, item, i);
+	      });
+	    });
+	  } else {
+	    // without option groups
+	    this.$originalOptions.each(function(index, item) {
+	      pushOption(index, item, null);
+	    });
+	  }
+
+	  this.$list.html(UI.template(options.listTpl, {options: optionItems}));
+	  this.$shadowOptions = this.$list.find('> li').
+	    not('.am-selected-list-header');
+	};
+
+	Selected.prototype.setChecked = function(item) {
+	  var options = this.options;
+	  var $item = $(item);
+	  var isChecked = $item.hasClass(options.selectedClass);
+
+	  if (this.multiple) {
+	    // multiple
+	    var checkedLength = this.$list.find('.' + options.selectedClass).length;
+
+	    if (!isChecked && this.maxChecked <= checkedLength) {
+	      this.$element.trigger('checkedOverflow.selected.amui', {
+	        selected: this
+	      });
+
+	      return false;
+	    }
+	  } else {
+	    // close dropdown whether item is checked or not
+	    // @see #860
+	    this.dropdown.close();
+
+	    if (isChecked) {
+	      return false;
+	    }
+
+	    this.$shadowOptions.not($item).removeClass(options.selectedClass);
+	  }
+
+	  $item.toggleClass(options.selectedClass);
+	  this.syncData(item);
+	};
+
+	/**
+	 * syncData
+	 *
+	 * @description if `item` set, only sync `item` related option
+	 * @param {Object} [item]
+	 */
+	Selected.prototype.syncData = function(item) {
+	  var _this = this;
+	  var options = this.options;
+	  var status = [];
+	  var $checked = $([]);
+
+	  this.$shadowOptions.filter('.' + options.selectedClass).each(function() {
+	    var $this = $(this);
+	    status.push($this.find('.am-selected-text').text());
+
+	    if (!item) {
+	      $checked = $checked.add(_this.$originalOptions
+	        .filter('[value="' + $this.data('value') + '"]')
+	        .prop('selected', true));
+	    }
+	  });
+
+	  if (item) {
+	    var $item = $(item);
+	    this.$originalOptions
+	      .filter('[value="' + $item.data('value') + '"]')
+	      .prop('selected', $item.hasClass(options.selectedClass));
+	  } else {
+	    this.$originalOptions.not($checked).prop('selected', false);
+	  }
+
+	  // nothing selected
+	  if (!this.$element.val()) {
+	    status = [options.placeholder];
+	  }
+
+	  this.$status.text(status.join(', '));
+
+	  // Do not trigger change event on initializing
+	  this.initialized && this.$element.trigger('change');
+	};
+
+	Selected.prototype.bindEvents = function() {
+	  var _this = this;
+	  var header = 'am-selected-list-header';
+	  var handleKeyup = UI.utils.debounce(function(e) {
+	    _this.$shadowOptions.not('.' + header).hide().
+	     filter(':containsNC("' + e.target.value + '")').show();
+	  }, 100);
+
+	  this.$list.on('click', '> li', function(e) {
+	    var $this = $(this);
+	    !$this.hasClass(_this.options.disabledClass) &&
+	      !$this.hasClass(header) && _this.setChecked(this);
+	  });
+
+	  // simple search with jQuery :contains
+	  this.$searchField.on('keyup.selected.amui', handleKeyup);
+
+	  // empty search keywords
+	  this.$selector.on('closed.dropdown.amui', function() {
+	    _this.$searchField.val('');
+	    _this.$shadowOptions.css({display: ''});
+	  });
+
+	  // work with Validator
+	  // @since 2.5
+	  this.$element.on('validated.field.validator.amui', function(e) {
+	    if (e.validity) {
+	      var valid = e.validity.valid;
+	      var errorClassName = 'am-invalid';
+
+	      _this.$selector[(!valid ? 'add' : 'remove') + 'Class'](errorClassName);
+	    }
+	  });
+
+	  // observe DOM
+	  if (UI.support.mutationobserver) {
+	    this.observer = new UI.support.mutationobserver(function() {
+	      _this.$element.trigger('changed.selected.amui');
+	    });
+
+	    this.observer.observe(this.$element[0], {
+	      childList: true,
+	      subtree: true,
+	      characterData: true
+	    });
+	  }
+
+	  // custom event
+	  this.$element.on('changed.selected.amui', function() {
+	    _this.renderOptions();
+	    _this.syncData();
+	  });
+	};
+
+	// @since: 2.5
+	Selected.prototype.select = function(item) {
+	  var $item;
+
+	  if (typeof item === 'number') {
+	    $item = this.$list.find('> li').not('.am-selected-list-header').eq(item);
+	  } else if (typeof item === 'string') {
+	    $item = this.$list.find(item);
+	  } else {
+	    $item = $(item);
+	  }
+
+	  $item.trigger('click');
+	};
+
+	// @since: 2.5
+	Selected.prototype.enable = function() {
+	  this.$element.prop('disable', false);
+	  this.$selector.dropdown('enable');
+	};
+
+	// @since: 2.5
+	Selected.prototype.disable = function() {
+	  this.$element.prop('disable', true);
+	  this.$selector.dropdown('disable');
+	};
+
+	Selected.prototype.destroy = function() {
+	  this.$element.removeData('amui.selected').show();
+	  this.$selector.remove();
+	};
+
+	UI.plugin('selected', Selected);
+
+	// Conflict with jQuery form
+	// https://github.com/malsup/form/blob/6bf24a5f6d8be65f4e5491863180c09356d9dadd/jquery.form.js#L1240-L1258
+	// https://github.com/allmobilize/amazeui/issues/379
+	// @deprecated: $.fn.selected = $.fn.selectIt = Plugin;
+
+	// New way to resolve conflict:
+	// @see https://github.com/amazeui/amazeui/issues/781#issuecomment-158873541
+
+	UI.ready(function(context) {
+	  $('[data-am-selected]', context).selected();
+	});
+
+	module.exports = Selected;
+
+
+/***/ },
+/* 25 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	__webpack_require__(15);
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var QRCode = __webpack_require__(26);
+	var doc = document;
+	var $doc = $(doc);
+
+	var Share = function(options) {
+	  this.options = $.extend({}, Share.DEFAULTS, options || {});
+	  this.$element = null;
+	  this.$wechatQr = null;
+	  this.pics = null;
+	  this.inited = false;
+	  this.active = false;
+	  // this.init();
+	};
+
+	Share.DEFAULTS = {
+	  sns: ['weibo', 'qq', 'qzone', 'tqq', 'wechat', 'renren'],
+	  title: '分享到',
+	  cancel: '取消',
+	  closeOnShare: true,
+	  id: UI.utils.generateGUID('am-share'),
+	  desc: 'Hi,孤夜观天象,发现一个不错的西西,分享一下下 ;-)',
+	  via: 'Amaze UI',
+	  tpl: '<div class="am-share am-modal-actions" id="<%= id %>">' +
+	  '<h3 class="am-share-title"><%= title %></h3>' +
+	  '<ul class="am-share-sns am-avg-sm-3">' +
+	  '<% for(var i = 0; i < sns.length; i++) {%>' +
+	  '<li>' +
+	  '<a href="<%= sns[i].shareUrl %>" ' +
+	  'data-am-share-to="<%= sns[i].id %>" >' +
+	  '<i class="am-icon-<%= sns[i].icon %>"></i>' +
+	  '<span><%= sns[i].title %></span>' +
+	  '</a></li>' +
+	  '<% } %></ul>' +
+	  '<div class="am-share-footer">' +
+	  '<button class="am-btn am-btn-default am-btn-block" ' +
+	  'data-am-share-close><%= cancel %></button></div>' +
+	  '</div>'
+	};
+
+	Share.SNS = {
+	  weibo: {
+	    title: '新浪微博',
+	    url: 'http://service.weibo.com/share/share.php',
+	    width: 620,
+	    height: 450,
+	    icon: 'weibo'
+	  },
+	  // url          链接地址
+	  // title:”,     分享的文字内容(可选,默认为所在页面的title)
+	  // appkey:”,    您申请的应用appkey,显示分享来源(可选)
+	  // pic:”,       分享图片的路径(可选)
+	  // ralateUid:”, 关联用户的UID,分享微博会@该用户(可选)
+	  // NOTE: 会自动抓取图片,不用指定 pic
+
+	  qq: {
+	    title: 'QQ 好友',
+	    url: 'http://connect.qq.com/widget/shareqq/index.html',
+	    icon: 'qq'
+	  },
+	  // url:,
+	  // title:'',    分享标题(可选)
+	  // pics:'',     分享图片的路径(可选)
+	  // summary:'',  分享摘要(可选)
+	  // site:'',     分享来源 如:腾讯网(可选)
+	  // desc: ''     发送给用户的消息
+	  // NOTE: 经过测试,最终发给用户的只有 url 和 desc
+
+	  qzone: {
+	    title: 'QQ 空间',
+	    url: 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey',
+	    icon: 'star'
+	  },
+	  // http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=xxx&title=xxx&desc=&summary=&site=
+	  // url:,
+	  // title:'',    分享标题(可选)
+	  // desc:'',     默认分享理由(可选)
+	  // summary:'',  分享摘要(可选)
+	  // site:'',     分享来源 如:腾讯网(可选)
+	  // pics:'',     分享图片的路径(可选),不会自动抓取,多个图片用|分隔
+
+	  tqq: {
+	    title: '腾讯微博',
+	    url: 'http://v.t.qq.com/share/share.php',
+	    icon: 'tencent-weibo'
+	  },
+	  // url=xx&title=&appkey=801cf76d3cfc44ada52ec13114e84a96
+	  // url
+	  // title
+	  // pic 多个图片用 | 分隔
+	  // appkey
+	  // NOTE: 不会自动抓取图片
+
+	  wechat: {
+	    title: '微信',
+	    url: '[qrcode]',
+	    icon: 'wechat'
+	  },
+	  // 生成一个二维码 供用户扫描
+	  // 相关接口 https://github.com/zxlie/WeixinApi
+
+	  renren: {
+	    title: '人人网',
+	    url: 'http://widget.renren.com/dialog/share',
+	    icon: 'renren'
+	  },
+	  // http://widget.renren.com/dialog/share?resourceUrl=www&srcUrl=www&title=ww&description=xxx
+	  // 550 * 400
+	  // resourceUrl : '', // 分享的资源Url
+	  // srcUrl : '',	     // 分享的资源来源Url,
+	  //                   //   默认为header中的Referer,如果分享失败可以调整此值为resourceUrl试试
+	  // pic : '',		 // 分享的主题图片,会自动抓取
+	  // title : '',		 // 分享的标题
+	  // description : ''	 // 分享的详细描述
+	  // NOTE: 经过测试,直接使用 url 参数即可
+
+	  douban: {
+	    title: '豆瓣',
+	    url: 'http://www.douban.com/recommend/',
+	    icon: 'share-alt'
+	  },
+	  // http://www.douban.com/service/sharebutton
+	  // 450 * 330
+	  // http://www.douban.com/share/service?bm=1&image=&href=xxx&updated=&name=
+	  // href 链接
+	  // name 标题
+
+	  /* void (function() {
+	   var d = document, e = encodeURIComponent,
+	   s1 = window.getSelection, s2 = d.getSelection,
+	   s3 = d.selection, s = s1 ? s1()
+	   : s2 ? s2() : s3 ? s3.createRange().text : '',
+	   r = 'http://www.douban.com/recommend/?url=&title=&sel=&v=1&r=1'
+	   })();
+	   */
+
+	  // tsohu: '',
+	  // http://t.sohu.com/third/post.jsp?url=&title=&content=utf-8&pic=
+
+	  // print: '',
+
+	  mail: {
+	    title: '邮件分享',
+	    url: 'mailto:',
+	    icon: 'envelope-o'
+	  },
+
+	  sms: {
+	    title: '短信分享',
+	    url: 'sms:',
+	    icon: 'comment'
+	  }
+	};
+
+	Share.prototype.render = function() {
+	  var options = this.options;
+	  var snsData = [];
+	  var title = encodeURIComponent(doc.title);
+	  var link = encodeURIComponent(doc.location);
+	  var msgBody = '?body=' + title + link;
+
+	  options.sns.forEach(function(item, i) {
+	    if (Share.SNS[item]) {
+	      var tmp = Share.SNS[item];
+	      var shareUrl;
+
+	      tmp.id = item;
+
+	      if (item === 'mail') {
+	        shareUrl = msgBody + '&subject=' + options.desc;
+	      } else if (item === 'sms') {
+	        shareUrl = msgBody;
+	      } else {
+	        shareUrl = '?url=' + link + '&title=' + title;
+	      }
+
+	      tmp.shareUrl = tmp.url + shareUrl;
+
+	      snsData.push(tmp);
+	    }
+	  });
+
+	  return UI.template(options.tpl, $.extend({}, options, {sns: snsData}));
+	};
+
+	Share.prototype.init = function() {
+	  if (this.inited) {
+	    return;
+	  }
+
+	  var me = this;
+	  var shareItem = '[data-am-share-to]';
+
+	  $doc.ready($.proxy(function() {
+	    $('body').append(this.render()); // append share DOM to body
+	    this.$element = $('#' + this.options.id);
+
+	    this.$element.find('[data-am-share-close]').
+	      on('click.share.amui', function() {
+	        me.close();
+	      });
+	  }, this));
+
+	  $doc.on('click.share.amui', shareItem, $.proxy(function(e) {
+	    var $clicked = $(e.target);
+	    var $target = $clicked.is(shareItem) && $clicked ||
+	      $clicked.parent(shareItem);
+	    var sns = $target.attr('data-am-share-to');
+
+	    if (!(sns === 'mail' || sns === 'sms')) {
+	      e.preventDefault();
+	      this.shareTo(sns, this.setData(sns));
+	    }
+
+	    this.close();
+	  }, this));
+
+	  this.inited = true;
+	};
+
+	Share.prototype.open = function() {
+	  !this.inited && this.init();
+	  this.$element && this.$element.modal('open');
+	  this.$element.trigger('open.share.amui');
+	  this.active = true;
+	};
+
+	Share.prototype.close = function() {
+	  this.$element && this.$element.modal('close');
+	  this.$element.trigger('close.share.amui');
+	  this.active = false;
+	};
+
+	Share.prototype.toggle = function() {
+	  this.active ? this.close() : this.open();
+	};
+
+	Share.prototype.setData = function(sns) {
+	  if (!sns) {
+	    return;
+	  }
+
+	  var shareData = {
+	    url: doc.location,
+	    title: doc.title
+	  };
+	  var desc = this.options.desc;
+	  var imgSrc = this.pics || [];
+	  var qqReg = /^(qzone|qq|tqq)$/;
+
+	  if (qqReg.test(sns) && !imgSrc.length) {
+	    var allImages = doc.images;
+
+	    for (var i = 0; i < allImages.length && i < 10; i++) {
+	      !!allImages[i].src && imgSrc.push(encodeURIComponent(allImages[i].src));
+	    }
+
+	    this.pics = imgSrc; // 缓存图片
+	  }
+
+	  switch (sns) {
+	    case 'qzone':
+	      shareData.desc = desc;
+	      shareData.site = this.options.via;
+	      shareData.pics = imgSrc.join('|');
+	      // TODO: 抓取图片多张
+	      break;
+	    case 'qq':
+	      shareData.desc = desc;
+	      shareData.site = this.options.via;
+	      shareData.pics = imgSrc[0];
+	      // 抓取一张图片
+	      break;
+	    case 'tqq':
+	      // 抓取图片多张
+	      shareData.pic = imgSrc.join('|');
+	      break;
+	  }
+
+	  return shareData;
+	};
+
+	Share.prototype.shareTo = function(sns, data) {
+	  var snsInfo = Share.SNS[sns];
+
+	  if (!snsInfo) {
+	    return;
+	  }
+
+	  if (sns === 'wechat' || sns === 'weixin') {
+	    return this.wechatQr();
+	  }
+
+	  var query = [];
+	  for (var key in data) {
+	    if (data[key]) {
+	      // 避免 encode 图片分隔符 |
+	      query.push(key.toString() + '=' + ((key === 'pic' || key === 'pics') ?
+	        data[key] : encodeURIComponent(data[key])));
+	    }
+	  }
+
+	  window.open(snsInfo.url + '?' + query.join('&'));
+	};
+
+	Share.prototype.wechatQr = function() {
+	  if (!this.$wechatQr) {
+	    var qrId = UI.utils.generateGUID('am-share-wechat');
+	    var $qr = $('<div class="am-modal am-modal-no-btn am-share-wechat-qr">' +
+	    '<div class="am-modal-dialog"><div class="am-modal-hd">分享到微信 ' +
+	    '<a href="" class="am-close am-close-spin" ' +
+	    'data-am-modal-close>&times;</a> </div>' +
+	    '<div class="am-modal-bd">' +
+	    '<div class="am-share-wx-qr"></div>' +
+	    '<div class="am-share-wechat-tip">' +
+	    '打开微信,点击底部的<em>发现</em>,<br/> ' +
+	    '使用<em>扫一扫</em>将网页分享至朋友圈</div></div></div></div>');
+
+	    $qr.attr('id', qrId);
+
+	    var qrNode = new QRCode({
+	      render: 'canvas',
+	      correctLevel: 0,
+	      text: doc.location.href,
+	      width: 180,
+	      height: 180,
+	      background: '#fff',
+	      foreground: '#000'
+	    });
+
+	    $qr.find('.am-share-wx-qr').html(qrNode);
+
+	    $qr.appendTo($('body'));
+
+	    this.$wechatQr = $('#' + qrId);
+	  }
+
+	  this.$wechatQr.modal('open');
+	};
+
+	var share = new Share();
+
+	$doc.on('click.share.amui.data-api', '[data-am-toggle="share"]', function(e) {
+	  e.preventDefault();
+	  share.toggle();
+	});
+
+	module.exports = UI.share = share;
+
+
+/***/ },
+/* 26 */
+/***/ function(module, exports, __webpack_require__) {
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	/**
+	 * @ver 1.1.0
+	 * @via https://github.com/aralejs/qrcode/blob/master/src/qrcode.js
+	 * @license http://aralejs.org/
+	 */
+
+	var qrcodeAlgObjCache = [];
+
+	/**
+	 * 二维码构造函数,主要用于绘制
+	 * @param  {Object} opt 传递参数
+	 * @return {String} qrcode
+	 * @constructor
+	 */
+	var QRCode = function(opt) {
+	  if (typeof opt === 'string') { // 只编码ASCII字符串
+	    opt = {
+	      text: opt
+	    };
+	  }
+	  // 设置默认参数
+	  this.options = $.extend({}, {
+	    text: "",
+	    render: "",
+	    width: 256,
+	    height: 256,
+	    correctLevel: 3,
+	    background: "#ffffff",
+	    foreground: "#000000"
+	  }, opt);
+
+	  // 使用QRCodeAlg创建二维码结构
+	  var qrCodeAlg = null;
+	  for (var i = 0, l = qrcodeAlgObjCache.length; i < l; i++) {
+	    if (qrcodeAlgObjCache[i].text == this.options.text && qrcodeAlgObjCache[i].text.correctLevel == this.options.correctLevel) {
+	      qrCodeAlg = qrcodeAlgObjCache[i].obj;
+	      break;
+	    }
+	  }
+	  if (i == l) {
+	    qrCodeAlg = new QRCodeAlg(this.options.text, this.options.correctLevel);
+	    qrcodeAlgObjCache.push({
+	      text: this.options.text,
+	      correctLevel: this.options.correctLevel,
+	      obj: qrCodeAlg
+	    });
+	  }
+
+	  if (this.options.render) {
+	    switch (this.options.render) {
+	      case "canvas":
+	        return this.createCanvas(qrCodeAlg);
+	      case "table":
+	        return this.createTable(qrCodeAlg);
+	      case "svg":
+	        return this.createSVG(qrCodeAlg);
+	      default:
+	        return this.createDefault(qrCodeAlg);
+	    }
+	  }
+	  return this.createDefault(qrCodeAlg);
+	};
+	/**
+	 * 使用Canvas来画二维码
+	 * @return {}
+	 */
+
+	QRCode.prototype.createDefault = function(qrCodeAlg) {
+	  var canvas = document.createElement('canvas');
+	  if (canvas.getContext)
+	    return this.createCanvas(qrCodeAlg);
+	  if (!!document.createElementNS && !!document.createElementNS(SVG_NS, 'svg').createSVGRect)
+	    return this.createSVG(qrCodeAlg);
+	  return this.createTable(qrCodeAlg);
+	};
+	QRCode.prototype.createCanvas = function(qrCodeAlg) {
+	  //创建canvas节点
+	  var canvas = document.createElement('canvas');
+	  canvas.width = this.options.width;
+	  canvas.height = this.options.height;
+	  var ctx = canvas.getContext('2d');
+
+	  //计算每个点的长宽
+	  var tileW = (this.options.width / qrCodeAlg.getModuleCount()).toPrecision(4);
+	  var tileH = this.options.height / qrCodeAlg.getModuleCount().toPrecision(4);
+
+	  //绘制
+	  for (var row = 0; row < qrCodeAlg.getModuleCount(); row++) {
+	    for (var col = 0; col < qrCodeAlg.getModuleCount(); col++) {
+	      ctx.fillStyle = qrCodeAlg.modules[row][col] ? this.options.foreground : this.options.background;
+	      var w = (Math.ceil((col + 1) * tileW) - Math.floor(col * tileW));
+	      var h = (Math.ceil((row + 1) * tileW) - Math.floor(row * tileW));
+	      ctx.fillRect(Math.round(col * tileW), Math.round(row * tileH), w, h);
+	    }
+	  }
+	  //返回绘制的节点
+	  return canvas;
+	};
+	/**
+	 * 使用table来绘制二维码
+	 * @return {}
+	 */
+	QRCode.prototype.createTable = function(qrCodeAlg) {
+	  //创建table节点
+	  var s = [];
+	  s.push('<table style="border:0px; margin:0px; padding:0px; border-collapse:collapse; background-color: ' +
+	  this.options.background +
+	  ';">');
+	  // 计算每个节点的长宽;取整,防止点之间出现分离
+	  var tileW = -1, tileH = -1, caculateW = -1, caculateH = -1;
+	  tileW = caculateW = Math.floor(this.options.width / qrCodeAlg.getModuleCount());
+	  tileH = caculateH = Math.floor(this.options.height / qrCodeAlg.getModuleCount());
+	  if (caculateW <= 0) {
+	    if (qrCodeAlg.getModuleCount() < 80) {
+	      tileW = 2;
+	    } else {
+	      tileW = 1;
+	    }
+	  }
+	  if (caculateH <= 0) {
+	    if (qrCodeAlg.getModuleCount() < 80) {
+	      tileH = 2;
+	    } else {
+	      tileH = 1;
+	    }
+	  }
+
+	  // 绘制二维码
+	  foreTd = '<td style="border:0px; margin:0px; padding:0px; width:' + tileW + 'px; background-color: ' + this.options.foreground + '"></td>',
+	    backTd = '<td style="border:0px; margin:0px; padding:0px; width:' + tileW + 'px; background-color: ' + this.options.background + '"></td>',
+	    l = qrCodeAlg.getModuleCount();
+
+	  for (var row = 0; row < l; row++) {
+	    s.push('<tr style="border:0px; margin:0px; padding:0px; height: ' + tileH + 'px">');
+	    for (var col = 0; col < l; col++) {
+	      s.push(qrCodeAlg.modules[row][col] ? foreTd : backTd);
+	    }
+	    s.push('</tr>');
+	  }
+	  s.push('</table>');
+	  var span = document.createElement("span");
+	  span.innerHTML = s.join('');
+
+	  return span.firstChild;
+	};
+
+	/**
+	 * 使用SVG开绘制二维码
+	 * @return {}
+	 */
+	QRCode.prototype.createSVG = function(qrCodeAlg) {
+	  var x, dx, y, dy,
+	    moduleCount = qrCodeAlg.getModuleCount(),
+	    scale = this.options.height / this.options.width,
+	    svg = '<svg xmlns="http://www.w3.org/2000/svg" '
+	      + 'width="' + this.options.width + 'px" height="' + this.options.height + 'px" '
+	      + 'viewbox="0 0 ' + moduleCount * 10 + ' ' + moduleCount * 10 * scale + '">',
+	    rectHead = '<path ',
+	    foreRect = ' style="stroke-width:0.5;stroke:' + this.options.foreground
+	      + ';fill:' + this.options.foreground + ';"></path>',
+	    backRect = ' style="stroke-width:0.5;stroke:' + this.options.background
+	      + ';fill:' + this.options.background + ';"></path>';
+
+	  // draw in the svg
+	  for (var row = 0; row < moduleCount; row++) {
+	    for (var col = 0; col < moduleCount; col++) {
+	      x = col * 10;
+	      y = row * 10 * scale;
+	      dx = (col + 1) * 10;
+	      dy = (row + 1) * 10 * scale;
+
+	      svg += rectHead + 'd="M ' + x + ',' + y
+	      + ' L ' + dx + ',' + y
+	      + ' L ' + dx + ',' + dy
+	      + ' L ' + x + ',' + dy
+	      + ' Z"';
+
+	      svg += qrCodeAlg.modules[row][col] ? foreRect : backRect;
+	    }
+	  }
+
+	  svg += '</svg>';
+
+	  // return just built svg
+	  return $(svg)[0];
+	};
+
+	/**
+	 * 获取单个字符的utf8编码
+	 * unicode BMP平面约65535个字符
+	 * @param {num} code
+	 * return {array}
+	 */
+	function unicodeFormat8(code) {
+	  // 1 byte
+	  if (code < 128) {
+	    return [code];
+	    // 2 bytes
+	  } else if (code < 2048) {
+	    c0 = 192 + (code >> 6);
+	    c1 = 128 + (code & 63);
+	    return [c0, c1];
+	    // 3 bytes
+	  } else {
+	    c0 = 224 + (code >> 12);
+	    c1 = 128 + (code >> 6 & 63);
+	    c2 = 128 + (code & 63);
+	    return [c0, c1, c2];
+	  }
+	}
+
+	/**
+	 * 获取字符串的utf8编码字节串
+	 * @param {string} string
+	 * @return {array}
+	 */
+	function getUTF8Bytes(string) {
+	  var utf8codes = [];
+	  for (var i = 0; i < string.length; i++) {
+	    var code = string.charCodeAt(i);
+	    var utf8 = unicodeFormat8(code);
+	    for (var j = 0; j < utf8.length; j++) {
+	      utf8codes.push(utf8[j]);
+	    }
+	  }
+	  return utf8codes;
+	}
+
+	/**
+	 * 二维码算法实现
+	 * @param {string} data              要编码的信息字符串
+	 * @param {num} errorCorrectLevel 纠错等级
+	 */
+	function QRCodeAlg(data, errorCorrectLevel) {
+	  this.typeNumber = -1; // 版本
+	  this.errorCorrectLevel = errorCorrectLevel;
+	  this.modules = null;  // 二维矩阵,存放最终结果
+	  this.moduleCount = 0; // 矩阵大小
+	  this.dataCache = null; // 数据缓存
+	  this.rsBlocks = null; // 版本数据信息
+	  this.totalDataCount = -1; // 可使用的数据量
+	  this.data = data;
+	  this.utf8bytes = getUTF8Bytes(data);
+	  this.make();
+	}
+
+	QRCodeAlg.prototype = {
+	  constructor: QRCodeAlg,
+	  /**
+	   * 获取二维码矩阵大小
+	   * @return {num} 矩阵大小
+	   */
+	  getModuleCount: function() {
+	    return this.moduleCount;
+	  },
+	  /**
+	   * 编码
+	   */
+	  make: function() {
+	    this.getRightType();
+	    this.dataCache = this.createData();
+	    this.createQrcode();
+	  },
+	  /**
+	   * 设置二位矩阵功能图形
+	   * @param  {bool} test 表示是否在寻找最好掩膜阶段
+	   * @param  {num} maskPattern 掩膜的版本
+	   */
+	  makeImpl: function(maskPattern) {
+
+	    this.moduleCount = this.typeNumber * 4 + 17;
+	    this.modules = new Array(this.moduleCount);
+
+	    for (var row = 0; row < this.moduleCount; row++) {
+
+	      this.modules[row] = new Array(this.moduleCount);
+
+	    }
+	    this.setupPositionProbePattern(0, 0);
+	    this.setupPositionProbePattern(this.moduleCount - 7, 0);
+	    this.setupPositionProbePattern(0, this.moduleCount - 7);
+	    this.setupPositionAdjustPattern();
+	    this.setupTimingPattern();
+	    this.setupTypeInfo(true, maskPattern);
+
+	    if (this.typeNumber >= 7) {
+	      this.setupTypeNumber(true);
+	    }
+	    this.mapData(this.dataCache, maskPattern);
+	  },
+	  /**
+	   * 设置二维码的位置探测图形
+	   * @param  {num} row 探测图形的中心横坐标
+	   * @param  {num} col 探测图形的中心纵坐标
+	   */
+	  setupPositionProbePattern: function(row, col) {
+
+	    for (var r = -1; r <= 7; r++) {
+
+	      if (row + r <= -1 || this.moduleCount <= row + r) continue;
+
+	      for (var c = -1; c <= 7; c++) {
+
+	        if (col + c <= -1 || this.moduleCount <= col + c) continue;
+
+	        if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) {
+	          this.modules[row + r][col + c] = true;
+	        } else {
+	          this.modules[row + r][col + c] = false;
+	        }
+	      }
+	    }
+	  },
+	  /**
+	   * 创建二维码
+	   * @return {[type]} [description]
+	   */
+	  createQrcode: function() {
+
+	    var minLostPoint = 0;
+	    var pattern = 0;
+	    var bestModules = null;
+
+	    for (var i = 0; i < 8; i++) {
+
+	      this.makeImpl(i);
+
+	      var lostPoint = QRUtil.getLostPoint(this);
+	      if (i == 0 || minLostPoint > lostPoint) {
+	        minLostPoint = lostPoint;
+	        pattern = i;
+	        bestModules = this.modules;
+	      }
+	    }
+	    this.modules = bestModules;
+	    this.setupTypeInfo(false, pattern);
+
+	    if (this.typeNumber >= 7) {
+	      this.setupTypeNumber(false);
+	    }
+
+	  },
+	  /**
+	   * 设置定位图形
+	   * @return {[type]} [description]
+	   */
+	  setupTimingPattern: function() {
+
+	    for (var r = 8; r < this.moduleCount - 8; r++) {
+	      if (this.modules[r][6] != null) {
+	        continue;
+	      }
+	      this.modules[r][6] = (r % 2 == 0);
+
+	      if (this.modules[6][r] != null) {
+	        continue;
+	      }
+	      this.modules[6][r] = (r % 2 == 0);
+	    }
+	  },
+	  /**
+	   * 设置矫正图形
+	   * @return {[type]} [description]
+	   */
+	  setupPositionAdjustPattern: function() {
+
+	    var pos = QRUtil.getPatternPosition(this.typeNumber);
+
+	    for (var i = 0; i < pos.length; i++) {
+
+	      for (var j = 0; j < pos.length; j++) {
+
+	        var row = pos[i];
+	        var col = pos[j];
+
+	        if (this.modules[row][col] != null) {
+	          continue;
+	        }
+
+	        for (var r = -2; r <= 2; r++) {
+
+	          for (var c = -2; c <= 2; c++) {
+
+	            if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) {
+	              this.modules[row + r][col + c] = true;
+	            } else {
+	              this.modules[row + r][col + c] = false;
+	            }
+	          }
+	        }
+	      }
+	    }
+	  },
+	  /**
+	   * 设置版本信息(7以上版本才有)
+	   * @param  {bool} test 是否处于判断最佳掩膜阶段
+	   * @return {[type]}      [description]
+	   */
+	  setupTypeNumber: function(test) {
+
+	    var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
+
+	    for (var i = 0; i < 18; i++) {
+	      var mod = (!test && ((bits >> i) & 1) == 1);
+	      this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
+	      this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
+	    }
+	  },
+	  /**
+	   * 设置格式信息(纠错等级和掩膜版本)
+	   * @param  {bool} test
+	   * @param  {num} maskPattern 掩膜版本
+	   * @return {}
+	   */
+	  setupTypeInfo: function(test, maskPattern) {
+
+	    var data = (QRErrorCorrectLevel[this.errorCorrectLevel] << 3) | maskPattern;
+	    var bits = QRUtil.getBCHTypeInfo(data);
+
+	    // vertical
+	    for (var i = 0; i < 15; i++) {
+
+	      var mod = (!test && ((bits >> i) & 1) == 1);
+
+	      if (i < 6) {
+	        this.modules[i][8] = mod;
+	      } else if (i < 8) {
+	        this.modules[i + 1][8] = mod;
+	      } else {
+	        this.modules[this.moduleCount - 15 + i][8] = mod;
+	      }
+
+	      // horizontal
+	      var mod = (!test && ((bits >> i) & 1) == 1);
+
+	      if (i < 8) {
+	        this.modules[8][this.moduleCount - i - 1] = mod;
+	      } else if (i < 9) {
+	        this.modules[8][15 - i - 1 + 1] = mod;
+	      } else {
+	        this.modules[8][15 - i - 1] = mod;
+	      }
+	    }
+
+	    // fixed module
+	    this.modules[this.moduleCount - 8][8] = (!test);
+
+	  },
+	  /**
+	   * 数据编码
+	   * @return {[type]} [description]
+	   */
+	  createData: function() {
+	    var buffer = new QRBitBuffer();
+	    var lengthBits = this.typeNumber > 9 ? 16 : 8;
+	    buffer.put(4, 4); //添加模式
+	    buffer.put(this.utf8bytes.length, lengthBits);
+	    for (var i = 0, l = this.utf8bytes.length; i < l; i++) {
+	      buffer.put(this.utf8bytes[i], 8);
+	    }
+	    if (buffer.length + 4 <= this.totalDataCount * 8) {
+	      buffer.put(0, 4);
+	    }
+
+	    // padding
+	    while (buffer.length % 8 != 0) {
+	      buffer.putBit(false);
+	    }
+
+	    // padding
+	    while (true) {
+
+	      if (buffer.length >= this.totalDataCount * 8) {
+	        break;
+	      }
+	      buffer.put(QRCodeAlg.PAD0, 8);
+
+	      if (buffer.length >= this.totalDataCount * 8) {
+	        break;
+	      }
+	      buffer.put(QRCodeAlg.PAD1, 8);
+	    }
+	    return this.createBytes(buffer);
+	  },
+	  /**
+	   * 纠错码编码
+	   * @param  {buffer} buffer 数据编码
+	   * @return {[type]}
+	   */
+	  createBytes: function(buffer) {
+
+	    var offset = 0;
+
+	    var maxDcCount = 0;
+	    var maxEcCount = 0;
+
+	    var length = this.rsBlock.length / 3;
+
+	    var rsBlocks = new Array();
+
+	    for (var i = 0; i < length; i++) {
+
+	      var count = this.rsBlock[i * 3 + 0];
+	      var totalCount = this.rsBlock[i * 3 + 1];
+	      var dataCount = this.rsBlock[i * 3 + 2];
+
+	      for (var j = 0; j < count; j++) {
+	        rsBlocks.push([dataCount, totalCount]);
+	      }
+	    }
+
+	    var dcdata = new Array(rsBlocks.length);
+	    var ecdata = new Array(rsBlocks.length);
+
+	    for (var r = 0; r < rsBlocks.length; r++) {
+
+	      var dcCount = rsBlocks[r][0];
+	      var ecCount = rsBlocks[r][1] - dcCount;
+
+	      maxDcCount = Math.max(maxDcCount, dcCount);
+	      maxEcCount = Math.max(maxEcCount, ecCount);
+
+	      dcdata[r] = new Array(dcCount);
+
+	      for (var i = 0; i < dcdata[r].length; i++) {
+	        dcdata[r][i] = 0xff & buffer.buffer[i + offset];
+	      }
+	      offset += dcCount;
+
+	      var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
+	      var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
+
+	      var modPoly = rawPoly.mod(rsPoly);
+	      ecdata[r] = new Array(rsPoly.getLength() - 1);
+	      for (var i = 0; i < ecdata[r].length; i++) {
+	        var modIndex = i + modPoly.getLength() - ecdata[r].length;
+	        ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0;
+	      }
+	    }
+
+	    var data = new Array(this.totalDataCount);
+	    var index = 0;
+
+	    for (var i = 0; i < maxDcCount; i++) {
+	      for (var r = 0; r < rsBlocks.length; r++) {
+	        if (i < dcdata[r].length) {
+	          data[index++] = dcdata[r][i];
+	        }
+	      }
+	    }
+
+	    for (var i = 0; i < maxEcCount; i++) {
+	      for (var r = 0; r < rsBlocks.length; r++) {
+	        if (i < ecdata[r].length) {
+	          data[index++] = ecdata[r][i];
+	        }
+	      }
+	    }
+
+	    return data;
+
+	  },
+	  /**
+	   * 布置模块,构建最终信息
+	   * @param  {} data
+	   * @param  {} maskPattern
+	   * @return {}
+	   */
+	  mapData: function(data, maskPattern) {
+
+	    var inc = -1;
+	    var row = this.moduleCount - 1;
+	    var bitIndex = 7;
+	    var byteIndex = 0;
+
+	    for (var col = this.moduleCount - 1; col > 0; col -= 2) {
+
+	      if (col == 6) col--;
+
+	      while (true) {
+
+	        for (var c = 0; c < 2; c++) {
+
+	          if (this.modules[row][col - c] == null) {
+
+	            var dark = false;
+
+	            if (byteIndex < data.length) {
+	              dark = (((data[byteIndex] >>> bitIndex) & 1) == 1);
+	            }
+
+	            var mask = QRUtil.getMask(maskPattern, row, col - c);
+
+	            if (mask) {
+	              dark = !dark;
+	            }
+
+	            this.modules[row][col - c] = dark;
+	            bitIndex--;
+
+	            if (bitIndex == -1) {
+	              byteIndex++;
+	              bitIndex = 7;
+	            }
+	          }
+	        }
+
+	        row += inc;
+
+	        if (row < 0 || this.moduleCount <= row) {
+	          row -= inc;
+	          inc = -inc;
+	          break;
+	        }
+	      }
+	    }
+	  }
+
+	};
+	/**
+	 * 填充字段
+	 */
+	QRCodeAlg.PAD0 = 0xEC;
+	QRCodeAlg.PAD1 = 0x11;
+
+
+	//---------------------------------------------------------------------
+	// 纠错等级对应的编码
+	//---------------------------------------------------------------------
+
+	var QRErrorCorrectLevel = [1, 0, 3, 2];
+
+	//---------------------------------------------------------------------
+	// 掩膜版本
+	//---------------------------------------------------------------------
+
+	var QRMaskPattern = {
+	  PATTERN000: 0,
+	  PATTERN001: 1,
+	  PATTERN010: 2,
+	  PATTERN011: 3,
+	  PATTERN100: 4,
+	  PATTERN101: 5,
+	  PATTERN110: 6,
+	  PATTERN111: 7
+	};
+
+	//---------------------------------------------------------------------
+	// 工具类
+	//---------------------------------------------------------------------
+
+	var QRUtil = {
+
+	  /*
+	   每个版本矫正图形的位置
+	   */
+	  PATTERN_POSITION_TABLE: [
+	    [],
+	    [6, 18],
+	    [6, 22],
+	    [6, 26],
+	    [6, 30],
+	    [6, 34],
+	    [6, 22, 38],
+	    [6, 24, 42],
+	    [6, 26, 46],
+	    [6, 28, 50],
+	    [6, 30, 54],
+	    [6, 32, 58],
+	    [6, 34, 62],
+	    [6, 26, 46, 66],
+	    [6, 26, 48, 70],
+	    [6, 26, 50, 74],
+	    [6, 30, 54, 78],
+	    [6, 30, 56, 82],
+	    [6, 30, 58, 86],
+	    [6, 34, 62, 90],
+	    [6, 28, 50, 72, 94],
+	    [6, 26, 50, 74, 98],
+	    [6, 30, 54, 78, 102],
+	    [6, 28, 54, 80, 106],
+	    [6, 32, 58, 84, 110],
+	    [6, 30, 58, 86, 114],
+	    [6, 34, 62, 90, 118],
+	    [6, 26, 50, 74, 98, 122],
+	    [6, 30, 54, 78, 102, 126],
+	    [6, 26, 52, 78, 104, 130],
+	    [6, 30, 56, 82, 108, 134],
+	    [6, 34, 60, 86, 112, 138],
+	    [6, 30, 58, 86, 114, 142],
+	    [6, 34, 62, 90, 118, 146],
+	    [6, 30, 54, 78, 102, 126, 150],
+	    [6, 24, 50, 76, 102, 128, 154],
+	    [6, 28, 54, 80, 106, 132, 158],
+	    [6, 32, 58, 84, 110, 136, 162],
+	    [6, 26, 54, 82, 110, 138, 166],
+	    [6, 30, 58, 86, 114, 142, 170]
+	  ],
+
+	  G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),
+	  G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),
+	  G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),
+
+	  /*
+	   BCH编码格式信息
+	   */
+	  getBCHTypeInfo: function(data) {
+	    var d = data << 10;
+	    while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
+	      d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15)));
+	    }
+	    return ((data << 10) | d) ^ QRUtil.G15_MASK;
+	  },
+	  /*
+	   BCH编码版本信息
+	   */
+	  getBCHTypeNumber: function(data) {
+	    var d = data << 12;
+	    while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
+	      d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18)));
+	    }
+	    return (data << 12) | d;
+	  },
+	  /*
+	   获取BCH位信息
+	   */
+	  getBCHDigit: function(data) {
+
+	    var digit = 0;
+
+	    while (data != 0) {
+	      digit++;
+	      data >>>= 1;
+	    }
+
+	    return digit;
+	  },
+	  /*
+	   获取版本对应的矫正图形位置
+	   */
+	  getPatternPosition: function(typeNumber) {
+	    return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
+	  },
+	  /*
+	   掩膜算法
+	   */
+	  getMask: function(maskPattern, i, j) {
+
+	    switch (maskPattern) {
+
+	      case QRMaskPattern.PATTERN000:
+	        return (i + j) % 2 == 0;
+	      case QRMaskPattern.PATTERN001:
+	        return i % 2 == 0;
+	      case QRMaskPattern.PATTERN010:
+	        return j % 3 == 0;
+	      case QRMaskPattern.PATTERN011:
+	        return (i + j) % 3 == 0;
+	      case QRMaskPattern.PATTERN100:
+	        return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
+	      case QRMaskPattern.PATTERN101:
+	        return (i * j) % 2 + (i * j) % 3 == 0;
+	      case QRMaskPattern.PATTERN110:
+	        return ((i * j) % 2 + (i * j) % 3) % 2 == 0;
+	      case QRMaskPattern.PATTERN111:
+	        return ((i * j) % 3 + (i + j) % 2) % 2 == 0;
+
+	      default:
+	        throw new Error("bad maskPattern:" + maskPattern);
+	    }
+	  },
+	  /*
+	   获取RS的纠错多项式
+	   */
+	  getErrorCorrectPolynomial: function(errorCorrectLength) {
+
+	    var a = new QRPolynomial([1], 0);
+
+	    for (var i = 0; i < errorCorrectLength; i++) {
+	      a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
+	    }
+
+	    return a;
+	  },
+	  /*
+	   获取评价
+	   */
+	  getLostPoint: function(qrCode) {
+
+	    var moduleCount = qrCode.getModuleCount(),
+	      lostPoint = 0,
+	      darkCount = 0;
+
+	    for (var row = 0; row < moduleCount; row++) {
+
+	      var sameCount = 0;
+	      var head = qrCode.modules[row][0];
+
+	      for (var col = 0; col < moduleCount; col++) {
+
+	        var current = qrCode.modules[row][col];
+
+	        //level 3 评价
+	        if (col < moduleCount - 6) {
+	          if (current && !qrCode.modules[row][col + 1] && qrCode.modules[row][col + 2] && qrCode.modules[row][col + 3] && qrCode.modules[row][col + 4] && !qrCode.modules[row][col + 5] && qrCode.modules[row][col + 6]) {
+	            if (col < moduleCount - 10) {
+	              if (qrCode.modules[row][col + 7] && qrCode.modules[row][col + 8] && qrCode.modules[row][col + 9] && qrCode.modules[row][col + 10]) {
+	                lostPoint += 40;
+	              }
+	            } else if (col > 3) {
+	              if (qrCode.modules[row][col - 1] && qrCode.modules[row][col - 2] && qrCode.modules[row][col - 3] && qrCode.modules[row][col - 4]) {
+	                lostPoint += 40;
+	              }
+	            }
+
+	          }
+	        }
+
+	        //level 2 评价
+	        if ((row < moduleCount - 1) && (col < moduleCount - 1)) {
+	          var count = 0;
+	          if (current) count++;
+	          if (qrCode.modules[row + 1][col]) count++;
+	          if (qrCode.modules[row][col + 1]) count++;
+	          if (qrCode.modules[row + 1][col + 1]) count++;
+	          if (count == 0 || count == 4) {
+	            lostPoint += 3;
+	          }
+	        }
+
+	        //level 1 评价
+	        if (head ^ current) {
+	          sameCount++;
+	        } else {
+	          head = current;
+	          if (sameCount >= 5) {
+	            lostPoint += (3 + sameCount - 5);
+	          }
+	          sameCount = 1;
+	        }
+
+	        //level 4 评价
+	        if (current) {
+	          darkCount++;
+	        }
+
+	      }
+	    }
+
+	    for (var col = 0; col < moduleCount; col++) {
+
+	      var sameCount = 0;
+	      var head = qrCode.modules[0][col];
+
+	      for (var row = 0; row < moduleCount; row++) {
+
+	        var current = qrCode.modules[row][col];
+
+	        //level 3 评价
+	        if (row < moduleCount - 6) {
+	          if (current && !qrCode.modules[row + 1][col] && qrCode.modules[row + 2][col] && qrCode.modules[row + 3][col] && qrCode.modules[row + 4][col] && !qrCode.modules[row + 5][col] && qrCode.modules[row + 6][col]) {
+	            if (row < moduleCount - 10) {
+	              if (qrCode.modules[row + 7][col] && qrCode.modules[row + 8][col] && qrCode.modules[row + 9][col] && qrCode.modules[row + 10][col]) {
+	                lostPoint += 40;
+	              }
+	            } else if (row > 3) {
+	              if (qrCode.modules[row - 1][col] && qrCode.modules[row - 2][col] && qrCode.modules[row - 3][col] && qrCode.modules[row - 4][col]) {
+	                lostPoint += 40;
+	              }
+	            }
+	          }
+	        }
+
+	        //level 1 评价
+	        if (head ^ current) {
+	          sameCount++;
+	        } else {
+	          head = current;
+	          if (sameCount >= 5) {
+	            lostPoint += (3 + sameCount - 5);
+	          }
+	          sameCount = 1;
+	        }
+
+	      }
+	    }
+
+	    // LEVEL4
+
+	    var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
+	    lostPoint += ratio * 10;
+
+	    return lostPoint;
+	  }
+
+	};
+
+
+	//---------------------------------------------------------------------
+	// QRMath使用的数学工具
+	//---------------------------------------------------------------------
+
+	var QRMath = {
+	  /*
+	   将n转化为a^m
+	   */
+	  glog: function(n) {
+
+	    if (n < 1) {
+	      throw new Error("glog(" + n + ")");
+	    }
+
+	    return QRMath.LOG_TABLE[n];
+	  },
+	  /*
+	   将a^m转化为n
+	   */
+	  gexp: function(n) {
+
+	    while (n < 0) {
+	      n += 255;
+	    }
+
+	    while (n >= 256) {
+	      n -= 255;
+	    }
+
+	    return QRMath.EXP_TABLE[n];
+	  },
+
+	  EXP_TABLE: new Array(256),
+
+	  LOG_TABLE: new Array(256)
+
+	};
+
+	for (var i = 0; i < 8; i++) {
+	  QRMath.EXP_TABLE[i] = 1 << i;
+	}
+	for (var i = 8; i < 256; i++) {
+	  QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8];
+	}
+	for (var i = 0; i < 255; i++) {
+	  QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
+	}
+
+	//---------------------------------------------------------------------
+	// QRPolynomial 多项式
+	//---------------------------------------------------------------------
+	/**
+	 * 多项式类
+	 * @param {Array} num   系数
+	 * @param {num} shift a^shift
+	 */
+	function QRPolynomial(num, shift) {
+
+	  if (num.length == undefined) {
+	    throw new Error(num.length + "/" + shift);
+	  }
+
+	  var offset = 0;
+
+	  while (offset < num.length && num[offset] == 0) {
+	    offset++;
+	  }
+
+	  this.num = new Array(num.length - offset + shift);
+	  for (var i = 0; i < num.length - offset; i++) {
+	    this.num[i] = num[i + offset];
+	  }
+	}
+
+	QRPolynomial.prototype = {
+
+	  get: function(index) {
+	    return this.num[index];
+	  },
+
+	  getLength: function() {
+	    return this.num.length;
+	  },
+	  /**
+	   * 多项式乘法
+	   * @param  {QRPolynomial} e 被乘多项式
+	   * @return {[type]}   [description]
+	   */
+	  multiply: function(e) {
+
+	    var num = new Array(this.getLength() + e.getLength() - 1);
+
+	    for (var i = 0; i < this.getLength(); i++) {
+	      for (var j = 0; j < e.getLength(); j++) {
+	        num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j)));
+	      }
+	    }
+
+	    return new QRPolynomial(num, 0);
+	  },
+	  /**
+	   * 多项式模运算
+	   * @param  {QRPolynomial} e 模多项式
+	   * @return {}
+	   */
+	  mod: function(e) {
+	    var tl = this.getLength(),
+	      el = e.getLength();
+	    if (tl - el < 0) {
+	      return this;
+	    }
+	    var num = new Array(tl);
+	    for (var i = 0; i < tl; i++) {
+	      num[i] = this.get(i);
+	    }
+	    while (num.length >= el) {
+	      var ratio = QRMath.glog(num[0]) - QRMath.glog(e.get(0));
+
+	      for (var i = 0; i < e.getLength(); i++) {
+	        num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio);
+	      }
+	      while (num[0] == 0) {
+	        num.shift();
+	      }
+	    }
+	    return new QRPolynomial(num, 0);
+	  }
+	};
+
+	//---------------------------------------------------------------------
+	// RS_BLOCK_TABLE
+	//---------------------------------------------------------------------
+	/*
+	 二维码各个版本信息[块数, 每块中的数据块数, 每块中的信息块数]
+	 */
+	var RS_BLOCK_TABLE = [
+
+	  // L
+	  // M
+	  // Q
+	  // H
+
+	  // 1
+	  [1, 26, 19],
+	  [1, 26, 16],
+	  [1, 26, 13],
+	  [1, 26, 9],
+
+	  // 2
+	  [1, 44, 34],
+	  [1, 44, 28],
+	  [1, 44, 22],
+	  [1, 44, 16],
+
+	  // 3
+	  [1, 70, 55],
+	  [1, 70, 44],
+	  [2, 35, 17],
+	  [2, 35, 13],
+
+	  // 4
+	  [1, 100, 80],
+	  [2, 50, 32],
+	  [2, 50, 24],
+	  [4, 25, 9],
+
+	  // 5
+	  [1, 134, 108],
+	  [2, 67, 43],
+	  [2, 33, 15, 2, 34, 16],
+	  [2, 33, 11, 2, 34, 12],
+
+	  // 6
+	  [2, 86, 68],
+	  [4, 43, 27],
+	  [4, 43, 19],
+	  [4, 43, 15],
+
+	  // 7
+	  [2, 98, 78],
+	  [4, 49, 31],
+	  [2, 32, 14, 4, 33, 15],
+	  [4, 39, 13, 1, 40, 14],
+
+	  // 8
+	  [2, 121, 97],
+	  [2, 60, 38, 2, 61, 39],
+	  [4, 40, 18, 2, 41, 19],
+	  [4, 40, 14, 2, 41, 15],
+
+	  // 9
+	  [2, 146, 116],
+	  [3, 58, 36, 2, 59, 37],
+	  [4, 36, 16, 4, 37, 17],
+	  [4, 36, 12, 4, 37, 13],
+
+	  // 10
+	  [2, 86, 68, 2, 87, 69],
+	  [4, 69, 43, 1, 70, 44],
+	  [6, 43, 19, 2, 44, 20],
+	  [6, 43, 15, 2, 44, 16],
+
+	  // 11
+	  [4, 101, 81],
+	  [1, 80, 50, 4, 81, 51],
+	  [4, 50, 22, 4, 51, 23],
+	  [3, 36, 12, 8, 37, 13],
+
+	  // 12
+	  [2, 116, 92, 2, 117, 93],
+	  [6, 58, 36, 2, 59, 37],
+	  [4, 46, 20, 6, 47, 21],
+	  [7, 42, 14, 4, 43, 15],
+
+	  // 13
+	  [4, 133, 107],
+	  [8, 59, 37, 1, 60, 38],
+	  [8, 44, 20, 4, 45, 21],
+	  [12, 33, 11, 4, 34, 12],
+
+	  // 14
+	  [3, 145, 115, 1, 146, 116],
+	  [4, 64, 40, 5, 65, 41],
+	  [11, 36, 16, 5, 37, 17],
+	  [11, 36, 12, 5, 37, 13],
+
+	  // 15
+	  [5, 109, 87, 1, 110, 88],
+	  [5, 65, 41, 5, 66, 42],
+	  [5, 54, 24, 7, 55, 25],
+	  [11, 36, 12],
+
+	  // 16
+	  [5, 122, 98, 1, 123, 99],
+	  [7, 73, 45, 3, 74, 46],
+	  [15, 43, 19, 2, 44, 20],
+	  [3, 45, 15, 13, 46, 16],
+
+	  // 17
+	  [1, 135, 107, 5, 136, 108],
+	  [10, 74, 46, 1, 75, 47],
+	  [1, 50, 22, 15, 51, 23],
+	  [2, 42, 14, 17, 43, 15],
+
+	  // 18
+	  [5, 150, 120, 1, 151, 121],
+	  [9, 69, 43, 4, 70, 44],
+	  [17, 50, 22, 1, 51, 23],
+	  [2, 42, 14, 19, 43, 15],
+
+	  // 19
+	  [3, 141, 113, 4, 142, 114],
+	  [3, 70, 44, 11, 71, 45],
+	  [17, 47, 21, 4, 48, 22],
+	  [9, 39, 13, 16, 40, 14],
+
+	  // 20
+	  [3, 135, 107, 5, 136, 108],
+	  [3, 67, 41, 13, 68, 42],
+	  [15, 54, 24, 5, 55, 25],
+	  [15, 43, 15, 10, 44, 16],
+
+	  // 21
+	  [4, 144, 116, 4, 145, 117],
+	  [17, 68, 42],
+	  [17, 50, 22, 6, 51, 23],
+	  [19, 46, 16, 6, 47, 17],
+
+	  // 22
+	  [2, 139, 111, 7, 140, 112],
+	  [17, 74, 46],
+	  [7, 54, 24, 16, 55, 25],
+	  [34, 37, 13],
+
+	  // 23
+	  [4, 151, 121, 5, 152, 122],
+	  [4, 75, 47, 14, 76, 48],
+	  [11, 54, 24, 14, 55, 25],
+	  [16, 45, 15, 14, 46, 16],
+
+	  // 24
+	  [6, 147, 117, 4, 148, 118],
+	  [6, 73, 45, 14, 74, 46],
+	  [11, 54, 24, 16, 55, 25],
+	  [30, 46, 16, 2, 47, 17],
+
+	  // 25
+	  [8, 132, 106, 4, 133, 107],
+	  [8, 75, 47, 13, 76, 48],
+	  [7, 54, 24, 22, 55, 25],
+	  [22, 45, 15, 13, 46, 16],
+
+	  // 26
+	  [10, 142, 114, 2, 143, 115],
+	  [19, 74, 46, 4, 75, 47],
+	  [28, 50, 22, 6, 51, 23],
+	  [33, 46, 16, 4, 47, 17],
+
+	  // 27
+	  [8, 152, 122, 4, 153, 123],
+	  [22, 73, 45, 3, 74, 46],
+	  [8, 53, 23, 26, 54, 24],
+	  [12, 45, 15, 28, 46, 16],
+
+	  // 28
+	  [3, 147, 117, 10, 148, 118],
+	  [3, 73, 45, 23, 74, 46],
+	  [4, 54, 24, 31, 55, 25],
+	  [11, 45, 15, 31, 46, 16],
+
+	  // 29
+	  [7, 146, 116, 7, 147, 117],
+	  [21, 73, 45, 7, 74, 46],
+	  [1, 53, 23, 37, 54, 24],
+	  [19, 45, 15, 26, 46, 16],
+
+	  // 30
+	  [5, 145, 115, 10, 146, 116],
+	  [19, 75, 47, 10, 76, 48],
+	  [15, 54, 24, 25, 55, 25],
+	  [23, 45, 15, 25, 46, 16],
+
+	  // 31
+	  [13, 145, 115, 3, 146, 116],
+	  [2, 74, 46, 29, 75, 47],
+	  [42, 54, 24, 1, 55, 25],
+	  [23, 45, 15, 28, 46, 16],
+
+	  // 32
+	  [17, 145, 115],
+	  [10, 74, 46, 23, 75, 47],
+	  [10, 54, 24, 35, 55, 25],
+	  [19, 45, 15, 35, 46, 16],
+
+	  // 33
+	  [17, 145, 115, 1, 146, 116],
+	  [14, 74, 46, 21, 75, 47],
+	  [29, 54, 24, 19, 55, 25],
+	  [11, 45, 15, 46, 46, 16],
+
+	  // 34
+	  [13, 145, 115, 6, 146, 116],
+	  [14, 74, 46, 23, 75, 47],
+	  [44, 54, 24, 7, 55, 25],
+	  [59, 46, 16, 1, 47, 17],
+
+	  // 35
+	  [12, 151, 121, 7, 152, 122],
+	  [12, 75, 47, 26, 76, 48],
+	  [39, 54, 24, 14, 55, 25],
+	  [22, 45, 15, 41, 46, 16],
+
+	  // 36
+	  [6, 151, 121, 14, 152, 122],
+	  [6, 75, 47, 34, 76, 48],
+	  [46, 54, 24, 10, 55, 25],
+	  [2, 45, 15, 64, 46, 16],
+
+	  // 37
+	  [17, 152, 122, 4, 153, 123],
+	  [29, 74, 46, 14, 75, 47],
+	  [49, 54, 24, 10, 55, 25],
+	  [24, 45, 15, 46, 46, 16],
+
+	  // 38
+	  [4, 152, 122, 18, 153, 123],
+	  [13, 74, 46, 32, 75, 47],
+	  [48, 54, 24, 14, 55, 25],
+	  [42, 45, 15, 32, 46, 16],
+
+	  // 39
+	  [20, 147, 117, 4, 148, 118],
+	  [40, 75, 47, 7, 76, 48],
+	  [43, 54, 24, 22, 55, 25],
+	  [10, 45, 15, 67, 46, 16],
+
+	  // 40
+	  [19, 148, 118, 6, 149, 119],
+	  [18, 75, 47, 31, 76, 48],
+	  [34, 54, 24, 34, 55, 25],
+	  [20, 45, 15, 61, 46, 16]
+	];
+
+	/**
+	 * 根据数据获取对应版本
+	 * @return {[type]} [description]
+	 */
+	QRCodeAlg.prototype.getRightType = function() {
+	  for (var typeNumber = 1; typeNumber < 41; typeNumber++) {
+	    var rsBlock = RS_BLOCK_TABLE[(typeNumber - 1) * 4 + this.errorCorrectLevel];
+	    if (rsBlock == undefined) {
+	      throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + this.errorCorrectLevel);
+	    }
+	    var length = rsBlock.length / 3;
+	    var totalDataCount = 0;
+	    for (var i = 0; i < length; i++) {
+	      var count = rsBlock[i * 3 + 0];
+	      var dataCount = rsBlock[i * 3 + 2];
+	      totalDataCount += dataCount * count;
+	    }
+
+	    var lengthBytes = typeNumber > 9 ? 2 : 1;
+	    if (this.utf8bytes.length + lengthBytes < totalDataCount || typeNumber == 40) {
+	      this.typeNumber = typeNumber;
+	      this.rsBlock = rsBlock;
+	      this.totalDataCount = totalDataCount;
+	      break;
+	    }
+	  }
+	};
+
+	//---------------------------------------------------------------------
+	// QRBitBuffer
+	//---------------------------------------------------------------------
+
+	function QRBitBuffer() {
+	  this.buffer = new Array();
+	  this.length = 0;
+	}
+
+	QRBitBuffer.prototype = {
+
+	  get: function(index) {
+	    var bufIndex = Math.floor(index / 8);
+	    return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1);
+	  },
+
+	  put: function(num, length) {
+	    for (var i = 0; i < length; i++) {
+	      this.putBit(((num >>> (length - i - 1)) & 1));
+	    }
+	  },
+
+	  putBit: function(bit) {
+
+	    var bufIndex = Math.floor(this.length / 8);
+	    if (this.buffer.length <= bufIndex) {
+	      this.buffer.push(0);
+	    }
+
+	    if (bit) {
+	      this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));
+	    }
+
+	    this.length++;
+	  }
+	};
+	/**
+	 * 获取单个字符的utf8编码
+	 * unicode BMP平面约65535个字符
+	 * @param {num} code
+	 * return {array}
+	 */
+	function unicodeFormat8(code) {
+	  // 1 byte
+	  if (code < 128) {
+	    return [code];
+	    // 2 bytes
+	  } else if (code < 2048) {
+	    c0 = 192 + (code >> 6);
+	    c1 = 128 + (code & 63);
+	    return [c0, c1];
+	    // 3 bytes
+	  } else {
+	    c0 = 224 + (code >> 12);
+	    c1 = 128 + (code >> 6 & 63);
+	    c2 = 128 + (code & 63);
+	    return [c0, c1, c2];
+	  }
+	}
+
+	/**
+	 * 获取字符串的utf8编码字节串
+	 * @param {string} string
+	 * @return {array}
+	 */
+	function getUTF8Bytes(string) {
+	  var utf8codes = [];
+	  for (var i = 0; i < string.length; i++) {
+	    var code = string.charCodeAt(i);
+	    var utf8 = unicodeFormat8(code);
+	    for (var j = 0; j < utf8.length; j++) {
+	      utf8codes.push(utf8[j]);
+	    }
+	  }
+	  return utf8codes;
+	}
+
+	/**
+	 * 二维码算法实现
+	 * @param {string} data              要编码的信息字符串
+	 * @param {num} errorCorrectLevel 纠错等级
+	 */
+	function QRCodeAlg(data, errorCorrectLevel) {
+	  this.typeNumber = -1; //版本
+	  this.errorCorrectLevel = errorCorrectLevel;
+	  this.modules = null;  //二维矩阵,存放最终结果
+	  this.moduleCount = 0; //矩阵大小
+	  this.dataCache = null; //数据缓存
+	  this.rsBlocks = null; //版本数据信息
+	  this.totalDataCount = -1; //可使用的数据量
+	  this.data = data;
+	  this.utf8bytes = getUTF8Bytes(data);
+	  this.make();
+	}
+
+	QRCodeAlg.prototype = {
+	  constructor: QRCodeAlg,
+	  /**
+	   * 获取二维码矩阵大小
+	   * @return {num} 矩阵大小
+	   */
+	  getModuleCount: function() {
+	    return this.moduleCount;
+	  },
+	  /**
+	   * 编码
+	   */
+	  make: function() {
+	    this.getRightType();
+	    this.dataCache = this.createData();
+	    this.createQrcode();
+	  },
+	  /**
+	   * 设置二位矩阵功能图形
+	   * @param  {bool} test 表示是否在寻找最好掩膜阶段
+	   * @param  {num} maskPattern 掩膜的版本
+	   */
+	  makeImpl: function(maskPattern) {
+
+	    this.moduleCount = this.typeNumber * 4 + 17;
+	    this.modules = new Array(this.moduleCount);
+
+	    for (var row = 0; row < this.moduleCount; row++) {
+
+	      this.modules[row] = new Array(this.moduleCount);
+
+	    }
+	    this.setupPositionProbePattern(0, 0);
+	    this.setupPositionProbePattern(this.moduleCount - 7, 0);
+	    this.setupPositionProbePattern(0, this.moduleCount - 7);
+	    this.setupPositionAdjustPattern();
+	    this.setupTimingPattern();
+	    this.setupTypeInfo(true, maskPattern);
+
+	    if (this.typeNumber >= 7) {
+	      this.setupTypeNumber(true);
+	    }
+	    this.mapData(this.dataCache, maskPattern);
+	  },
+	  /**
+	   * 设置二维码的位置探测图形
+	   * @param  {num} row 探测图形的中心横坐标
+	   * @param  {num} col 探测图形的中心纵坐标
+	   */
+	  setupPositionProbePattern: function(row, col) {
+
+	    for (var r = -1; r <= 7; r++) {
+
+	      if (row + r <= -1 || this.moduleCount <= row + r) continue;
+
+	      for (var c = -1; c <= 7; c++) {
+
+	        if (col + c <= -1 || this.moduleCount <= col + c) continue;
+
+	        if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) {
+	          this.modules[row + r][col + c] = true;
+	        } else {
+	          this.modules[row + r][col + c] = false;
+	        }
+	      }
+	    }
+	  },
+	  /**
+	   * 创建二维码
+	   * @return {[type]} [description]
+	   */
+	  createQrcode: function() {
+
+	    var minLostPoint = 0;
+	    var pattern = 0;
+	    var bestModules = null;
+
+	    for (var i = 0; i < 8; i++) {
+
+	      this.makeImpl(i);
+
+	      var lostPoint = QRUtil.getLostPoint(this);
+	      if (i == 0 || minLostPoint > lostPoint) {
+	        minLostPoint = lostPoint;
+	        pattern = i;
+	        bestModules = this.modules;
+	      }
+	    }
+	    this.modules = bestModules;
+	    this.setupTypeInfo(false, pattern);
+
+	    if (this.typeNumber >= 7) {
+	      this.setupTypeNumber(false);
+	    }
+
+	  },
+	  /**
+	   * 设置定位图形
+	   * @return {[type]} [description]
+	   */
+	  setupTimingPattern: function() {
+
+	    for (var r = 8; r < this.moduleCount - 8; r++) {
+	      if (this.modules[r][6] != null) {
+	        continue;
+	      }
+	      this.modules[r][6] = (r % 2 == 0);
+
+	      if (this.modules[6][r] != null) {
+	        continue;
+	      }
+	      this.modules[6][r] = (r % 2 == 0);
+	    }
+	  },
+	  /**
+	   * 设置矫正图形
+	   * @return {[type]} [description]
+	   */
+	  setupPositionAdjustPattern: function() {
+
+	    var pos = QRUtil.getPatternPosition(this.typeNumber);
+
+	    for (var i = 0; i < pos.length; i++) {
+
+	      for (var j = 0; j < pos.length; j++) {
+
+	        var row = pos[i];
+	        var col = pos[j];
+
+	        if (this.modules[row][col] != null) {
+	          continue;
+	        }
+
+	        for (var r = -2; r <= 2; r++) {
+
+	          for (var c = -2; c <= 2; c++) {
+
+	            if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) {
+	              this.modules[row + r][col + c] = true;
+	            } else {
+	              this.modules[row + r][col + c] = false;
+	            }
+	          }
+	        }
+	      }
+	    }
+	  },
+	  /**
+	   * 设置版本信息(7以上版本才有)
+	   * @param  {bool} test 是否处于判断最佳掩膜阶段
+	   * @return {[type]}      [description]
+	   */
+	  setupTypeNumber: function(test) {
+
+	    var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
+
+	    for (var i = 0; i < 18; i++) {
+	      var mod = (!test && ((bits >> i) & 1) == 1);
+	      this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
+	      this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
+	    }
+	  },
+	  /**
+	   * 设置格式信息(纠错等级和掩膜版本)
+	   * @param  {bool} test
+	   * @param  {num} maskPattern 掩膜版本
+	   * @return {}
+	   */
+	  setupTypeInfo: function(test, maskPattern) {
+
+	    var data = (QRErrorCorrectLevel[this.errorCorrectLevel] << 3) | maskPattern;
+	    var bits = QRUtil.getBCHTypeInfo(data);
+
+	    // vertical
+	    for (var i = 0; i < 15; i++) {
+
+	      var mod = (!test && ((bits >> i) & 1) == 1);
+
+	      if (i < 6) {
+	        this.modules[i][8] = mod;
+	      } else if (i < 8) {
+	        this.modules[i + 1][8] = mod;
+	      } else {
+	        this.modules[this.moduleCount - 15 + i][8] = mod;
+	      }
+
+	      // horizontal
+	      var mod = (!test && ((bits >> i) & 1) == 1);
+
+	      if (i < 8) {
+	        this.modules[8][this.moduleCount - i - 1] = mod;
+	      } else if (i < 9) {
+	        this.modules[8][15 - i - 1 + 1] = mod;
+	      } else {
+	        this.modules[8][15 - i - 1] = mod;
+	      }
+	    }
+
+	    // fixed module
+	    this.modules[this.moduleCount - 8][8] = (!test);
+
+	  },
+	  /**
+	   * 数据编码
+	   * @return {[type]} [description]
+	   */
+	  createData: function() {
+	    var buffer = new QRBitBuffer();
+	    var lengthBits = this.typeNumber > 9 ? 16 : 8;
+	    buffer.put(4, 4); //添加模式
+	    buffer.put(this.utf8bytes.length, lengthBits);
+	    for (var i = 0, l = this.utf8bytes.length; i < l; i++) {
+	      buffer.put(this.utf8bytes[i], 8);
+	    }
+	    if (buffer.length + 4 <= this.totalDataCount * 8) {
+	      buffer.put(0, 4);
+	    }
+
+	    // padding
+	    while (buffer.length % 8 != 0) {
+	      buffer.putBit(false);
+	    }
+
+	    // padding
+	    while (true) {
+
+	      if (buffer.length >= this.totalDataCount * 8) {
+	        break;
+	      }
+	      buffer.put(QRCodeAlg.PAD0, 8);
+
+	      if (buffer.length >= this.totalDataCount * 8) {
+	        break;
+	      }
+	      buffer.put(QRCodeAlg.PAD1, 8);
+	    }
+	    return this.createBytes(buffer);
+	  },
+	  /**
+	   * 纠错码编码
+	   * @param  {buffer} buffer 数据编码
+	   * @return {[type]}
+	   */
+	  createBytes: function(buffer) {
+
+	    var offset = 0;
+
+	    var maxDcCount = 0;
+	    var maxEcCount = 0;
+
+	    var length = this.rsBlock.length / 3;
+
+	    var rsBlocks = new Array();
+
+	    for (var i = 0; i < length; i++) {
+
+	      var count = this.rsBlock[i * 3 + 0];
+	      var totalCount = this.rsBlock[i * 3 + 1];
+	      var dataCount = this.rsBlock[i * 3 + 2];
+
+	      for (var j = 0; j < count; j++) {
+	        rsBlocks.push([dataCount, totalCount]);
+	      }
+	    }
+
+	    var dcdata = new Array(rsBlocks.length);
+	    var ecdata = new Array(rsBlocks.length);
+
+	    for (var r = 0; r < rsBlocks.length; r++) {
+
+	      var dcCount = rsBlocks[r][0];
+	      var ecCount = rsBlocks[r][1] - dcCount;
+
+	      maxDcCount = Math.max(maxDcCount, dcCount);
+	      maxEcCount = Math.max(maxEcCount, ecCount);
+
+	      dcdata[r] = new Array(dcCount);
+
+	      for (var i = 0; i < dcdata[r].length; i++) {
+	        dcdata[r][i] = 0xff & buffer.buffer[i + offset];
+	      }
+	      offset += dcCount;
+
+	      var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
+	      var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
+
+	      var modPoly = rawPoly.mod(rsPoly);
+	      ecdata[r] = new Array(rsPoly.getLength() - 1);
+	      for (var i = 0; i < ecdata[r].length; i++) {
+	        var modIndex = i + modPoly.getLength() - ecdata[r].length;
+	        ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0;
+	      }
+	    }
+
+	    var data = new Array(this.totalDataCount);
+	    var index = 0;
+
+	    for (var i = 0; i < maxDcCount; i++) {
+	      for (var r = 0; r < rsBlocks.length; r++) {
+	        if (i < dcdata[r].length) {
+	          data[index++] = dcdata[r][i];
+	        }
+	      }
+	    }
+
+	    for (var i = 0; i < maxEcCount; i++) {
+	      for (var r = 0; r < rsBlocks.length; r++) {
+	        if (i < ecdata[r].length) {
+	          data[index++] = ecdata[r][i];
+	        }
+	      }
+	    }
+
+	    return data;
+
+	  },
+	  /**
+	   * 布置模块,构建最终信息
+	   * @param  {} data
+	   * @param  {} maskPattern
+	   * @return {}
+	   */
+	  mapData: function(data, maskPattern) {
+
+	    var inc = -1;
+	    var row = this.moduleCount - 1;
+	    var bitIndex = 7;
+	    var byteIndex = 0;
+
+	    for (var col = this.moduleCount - 1; col > 0; col -= 2) {
+
+	      if (col == 6) col--;
+
+	      while (true) {
+
+	        for (var c = 0; c < 2; c++) {
+
+	          if (this.modules[row][col - c] == null) {
+
+	            var dark = false;
+
+	            if (byteIndex < data.length) {
+	              dark = (((data[byteIndex] >>> bitIndex) & 1) == 1);
+	            }
+
+	            var mask = QRUtil.getMask(maskPattern, row, col - c);
+
+	            if (mask) {
+	              dark = !dark;
+	            }
+
+	            this.modules[row][col - c] = dark;
+	            bitIndex--;
+
+	            if (bitIndex == -1) {
+	              byteIndex++;
+	              bitIndex = 7;
+	            }
+	          }
+	        }
+
+	        row += inc;
+
+	        if (row < 0 || this.moduleCount <= row) {
+	          row -= inc;
+	          inc = -inc;
+	          break;
+	        }
+	      }
+	    }
+	  }
+
+	};
+	/**
+	 * 填充字段
+	 */
+	QRCodeAlg.PAD0 = 0xEC;
+	QRCodeAlg.PAD1 = 0x11;
+
+
+	//---------------------------------------------------------------------
+	// 纠错等级对应的编码
+	//---------------------------------------------------------------------
+
+	var QRErrorCorrectLevel = [1, 0, 3, 2];
+
+	//---------------------------------------------------------------------
+	// 掩膜版本
+	//---------------------------------------------------------------------
+
+	var QRMaskPattern = {
+	  PATTERN000: 0,
+	  PATTERN001: 1,
+	  PATTERN010: 2,
+	  PATTERN011: 3,
+	  PATTERN100: 4,
+	  PATTERN101: 5,
+	  PATTERN110: 6,
+	  PATTERN111: 7
+	};
+
+	//---------------------------------------------------------------------
+	// 工具类
+	//---------------------------------------------------------------------
+
+	var QRUtil = {
+
+	  /*
+	   每个版本矫正图形的位置
+	   */
+	  PATTERN_POSITION_TABLE: [
+	    [],
+	    [6, 18],
+	    [6, 22],
+	    [6, 26],
+	    [6, 30],
+	    [6, 34],
+	    [6, 22, 38],
+	    [6, 24, 42],
+	    [6, 26, 46],
+	    [6, 28, 50],
+	    [6, 30, 54],
+	    [6, 32, 58],
+	    [6, 34, 62],
+	    [6, 26, 46, 66],
+	    [6, 26, 48, 70],
+	    [6, 26, 50, 74],
+	    [6, 30, 54, 78],
+	    [6, 30, 56, 82],
+	    [6, 30, 58, 86],
+	    [6, 34, 62, 90],
+	    [6, 28, 50, 72, 94],
+	    [6, 26, 50, 74, 98],
+	    [6, 30, 54, 78, 102],
+	    [6, 28, 54, 80, 106],
+	    [6, 32, 58, 84, 110],
+	    [6, 30, 58, 86, 114],
+	    [6, 34, 62, 90, 118],
+	    [6, 26, 50, 74, 98, 122],
+	    [6, 30, 54, 78, 102, 126],
+	    [6, 26, 52, 78, 104, 130],
+	    [6, 30, 56, 82, 108, 134],
+	    [6, 34, 60, 86, 112, 138],
+	    [6, 30, 58, 86, 114, 142],
+	    [6, 34, 62, 90, 118, 146],
+	    [6, 30, 54, 78, 102, 126, 150],
+	    [6, 24, 50, 76, 102, 128, 154],
+	    [6, 28, 54, 80, 106, 132, 158],
+	    [6, 32, 58, 84, 110, 136, 162],
+	    [6, 26, 54, 82, 110, 138, 166],
+	    [6, 30, 58, 86, 114, 142, 170]
+	  ],
+
+	  G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),
+	  G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),
+	  G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),
+
+	  /*
+	   BCH编码格式信息
+	   */
+	  getBCHTypeInfo: function(data) {
+	    var d = data << 10;
+	    while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
+	      d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15)));
+	    }
+	    return ((data << 10) | d) ^ QRUtil.G15_MASK;
+	  },
+	  /*
+	   BCH编码版本信息
+	   */
+	  getBCHTypeNumber: function(data) {
+	    var d = data << 12;
+	    while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
+	      d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18)));
+	    }
+	    return (data << 12) | d;
+	  },
+	  /*
+	   获取BCH位信息
+	   */
+	  getBCHDigit: function(data) {
+
+	    var digit = 0;
+
+	    while (data != 0) {
+	      digit++;
+	      data >>>= 1;
+	    }
+
+	    return digit;
+	  },
+	  /*
+	   获取版本对应的矫正图形位置
+	   */
+	  getPatternPosition: function(typeNumber) {
+	    return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
+	  },
+	  /*
+	   掩膜算法
+	   */
+	  getMask: function(maskPattern, i, j) {
+
+	    switch (maskPattern) {
+
+	      case QRMaskPattern.PATTERN000:
+	        return (i + j) % 2 == 0;
+	      case QRMaskPattern.PATTERN001:
+	        return i % 2 == 0;
+	      case QRMaskPattern.PATTERN010:
+	        return j % 3 == 0;
+	      case QRMaskPattern.PATTERN011:
+	        return (i + j) % 3 == 0;
+	      case QRMaskPattern.PATTERN100:
+	        return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
+	      case QRMaskPattern.PATTERN101:
+	        return (i * j) % 2 + (i * j) % 3 == 0;
+	      case QRMaskPattern.PATTERN110:
+	        return ((i * j) % 2 + (i * j) % 3) % 2 == 0;
+	      case QRMaskPattern.PATTERN111:
+	        return ((i * j) % 3 + (i + j) % 2) % 2 == 0;
+
+	      default:
+	        throw new Error("bad maskPattern:" + maskPattern);
+	    }
+	  },
+	  /*
+	   获取RS的纠错多项式
+	   */
+	  getErrorCorrectPolynomial: function(errorCorrectLength) {
+
+	    var a = new QRPolynomial([1], 0);
+
+	    for (var i = 0; i < errorCorrectLength; i++) {
+	      a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
+	    }
+
+	    return a;
+	  },
+	  /*
+	   获取评价
+	   */
+	  getLostPoint: function(qrCode) {
+
+	    var moduleCount = qrCode.getModuleCount(),
+	      lostPoint = 0,
+	      darkCount = 0;
+
+	    for (var row = 0; row < moduleCount; row++) {
+
+	      var sameCount = 0;
+	      var head = qrCode.modules[row][0];
+
+	      for (var col = 0; col < moduleCount; col++) {
+
+	        var current = qrCode.modules[row][col];
+
+	        //level 3 评价
+	        if (col < moduleCount - 6) {
+	          if (current && !qrCode.modules[row][col + 1] && qrCode.modules[row][col + 2] && qrCode.modules[row][col + 3] && qrCode.modules[row][col + 4] && !qrCode.modules[row][col + 5] && qrCode.modules[row][col + 6]) {
+	            if (col < moduleCount - 10) {
+	              if (qrCode.modules[row][col + 7] && qrCode.modules[row][col + 8] && qrCode.modules[row][col + 9] && qrCode.modules[row][col + 10]) {
+	                lostPoint += 40;
+	              }
+	            } else if (col > 3) {
+	              if (qrCode.modules[row][col - 1] && qrCode.modules[row][col - 2] && qrCode.modules[row][col - 3] && qrCode.modules[row][col - 4]) {
+	                lostPoint += 40;
+	              }
+	            }
+
+	          }
+	        }
+
+	        //level 2 评价
+	        if ((row < moduleCount - 1) && (col < moduleCount - 1)) {
+	          var count = 0;
+	          if (current) count++;
+	          if (qrCode.modules[row + 1][col]) count++;
+	          if (qrCode.modules[row][col + 1]) count++;
+	          if (qrCode.modules[row + 1][col + 1]) count++;
+	          if (count == 0 || count == 4) {
+	            lostPoint += 3;
+	          }
+	        }
+
+	        //level 1 评价
+	        if (head ^ current) {
+	          sameCount++;
+	        } else {
+	          head = current;
+	          if (sameCount >= 5) {
+	            lostPoint += (3 + sameCount - 5);
+	          }
+	          sameCount = 1;
+	        }
+
+	        //level 4 评价
+	        if (current) {
+	          darkCount++;
+	        }
+
+	      }
+	    }
+
+	    for (var col = 0; col < moduleCount; col++) {
+
+	      var sameCount = 0;
+	      var head = qrCode.modules[0][col];
+
+	      for (var row = 0; row < moduleCount; row++) {
+
+	        var current = qrCode.modules[row][col];
+
+	        //level 3 评价
+	        if (row < moduleCount - 6) {
+	          if (current && !qrCode.modules[row + 1][col] && qrCode.modules[row + 2][col] && qrCode.modules[row + 3][col] && qrCode.modules[row + 4][col] && !qrCode.modules[row + 5][col] && qrCode.modules[row + 6][col]) {
+	            if (row < moduleCount - 10) {
+	              if (qrCode.modules[row + 7][col] && qrCode.modules[row + 8][col] && qrCode.modules[row + 9][col] && qrCode.modules[row + 10][col]) {
+	                lostPoint += 40;
+	              }
+	            } else if (row > 3) {
+	              if (qrCode.modules[row - 1][col] && qrCode.modules[row - 2][col] && qrCode.modules[row - 3][col] && qrCode.modules[row - 4][col]) {
+	                lostPoint += 40;
+	              }
+	            }
+	          }
+	        }
+
+	        //level 1 评价
+	        if (head ^ current) {
+	          sameCount++;
+	        } else {
+	          head = current;
+	          if (sameCount >= 5) {
+	            lostPoint += (3 + sameCount - 5);
+	          }
+	          sameCount = 1;
+	        }
+
+	      }
+	    }
+
+	    // LEVEL4
+
+	    var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
+	    lostPoint += ratio * 10;
+
+	    return lostPoint;
+	  }
+
+	};
+
+
+	//---------------------------------------------------------------------
+	// QRMath使用的数学工具
+	//---------------------------------------------------------------------
+
+	var QRMath = {
+	  /*
+	   将n转化为a^m
+	   */
+	  glog: function(n) {
+
+	    if (n < 1) {
+	      throw new Error("glog(" + n + ")");
+	    }
+
+	    return QRMath.LOG_TABLE[n];
+	  },
+	  /*
+	   将a^m转化为n
+	   */
+	  gexp: function(n) {
+
+	    while (n < 0) {
+	      n += 255;
+	    }
+
+	    while (n >= 256) {
+	      n -= 255;
+	    }
+
+	    return QRMath.EXP_TABLE[n];
+	  },
+
+	  EXP_TABLE: new Array(256),
+
+	  LOG_TABLE: new Array(256)
+
+	};
+
+	for (var i = 0; i < 8; i++) {
+	  QRMath.EXP_TABLE[i] = 1 << i;
+	}
+	for (var i = 8; i < 256; i++) {
+	  QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8];
+	}
+	for (var i = 0; i < 255; i++) {
+	  QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
+	}
+
+	//---------------------------------------------------------------------
+	// QRPolynomial 多项式
+	//---------------------------------------------------------------------
+	/**
+	 * 多项式类
+	 * @param {Array} num   系数
+	 * @param {num} shift a^shift
+	 */
+	function QRPolynomial(num, shift) {
+
+	  if (num.length == undefined) {
+	    throw new Error(num.length + "/" + shift);
+	  }
+
+	  var offset = 0;
+
+	  while (offset < num.length && num[offset] == 0) {
+	    offset++;
+	  }
+
+	  this.num = new Array(num.length - offset + shift);
+	  for (var i = 0; i < num.length - offset; i++) {
+	    this.num[i] = num[i + offset];
+	  }
+	}
+
+	QRPolynomial.prototype = {
+
+	  get: function(index) {
+	    return this.num[index];
+	  },
+
+	  getLength: function() {
+	    return this.num.length;
+	  },
+	  /**
+	   * 多项式乘法
+	   * @param  {QRPolynomial} e 被乘多项式
+	   * @return {[type]}   [description]
+	   */
+	  multiply: function(e) {
+
+	    var num = new Array(this.getLength() + e.getLength() - 1);
+
+	    for (var i = 0; i < this.getLength(); i++) {
+	      for (var j = 0; j < e.getLength(); j++) {
+	        num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j)));
+	      }
+	    }
+
+	    return new QRPolynomial(num, 0);
+	  },
+	  /**
+	   * 多项式模运算
+	   * @param  {QRPolynomial} e 模多项式
+	   * @return {}
+	   */
+	  mod: function(e) {
+	    var tl = this.getLength(),
+	      el = e.getLength();
+	    if (tl - el < 0) {
+	      return this;
+	    }
+	    var num = new Array(tl);
+	    for (var i = 0; i < tl; i++) {
+	      num[i] = this.get(i);
+	    }
+	    while (num.length >= el) {
+	      var ratio = QRMath.glog(num[0]) - QRMath.glog(e.get(0));
+
+	      for (var i = 0; i < e.getLength(); i++) {
+	        num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio);
+	      }
+	      while (num[0] == 0) {
+	        num.shift();
+	      }
+	    }
+	    return new QRPolynomial(num, 0);
+	  }
+	};
+
+	//---------------------------------------------------------------------
+	// RS_BLOCK_TABLE
+	//---------------------------------------------------------------------
+	/*
+	 二维码各个版本信息[块数, 每块中的数据块数, 每块中的信息块数]
+	 */
+	RS_BLOCK_TABLE = [
+
+	  // L
+	  // M
+	  // Q
+	  // H
+
+	  // 1
+	  [1, 26, 19],
+	  [1, 26, 16],
+	  [1, 26, 13],
+	  [1, 26, 9],
+
+	  // 2
+	  [1, 44, 34],
+	  [1, 44, 28],
+	  [1, 44, 22],
+	  [1, 44, 16],
+
+	  // 3
+	  [1, 70, 55],
+	  [1, 70, 44],
+	  [2, 35, 17],
+	  [2, 35, 13],
+
+	  // 4
+	  [1, 100, 80],
+	  [2, 50, 32],
+	  [2, 50, 24],
+	  [4, 25, 9],
+
+	  // 5
+	  [1, 134, 108],
+	  [2, 67, 43],
+	  [2, 33, 15, 2, 34, 16],
+	  [2, 33, 11, 2, 34, 12],
+
+	  // 6
+	  [2, 86, 68],
+	  [4, 43, 27],
+	  [4, 43, 19],
+	  [4, 43, 15],
+
+	  // 7
+	  [2, 98, 78],
+	  [4, 49, 31],
+	  [2, 32, 14, 4, 33, 15],
+	  [4, 39, 13, 1, 40, 14],
+
+	  // 8
+	  [2, 121, 97],
+	  [2, 60, 38, 2, 61, 39],
+	  [4, 40, 18, 2, 41, 19],
+	  [4, 40, 14, 2, 41, 15],
+
+	  // 9
+	  [2, 146, 116],
+	  [3, 58, 36, 2, 59, 37],
+	  [4, 36, 16, 4, 37, 17],
+	  [4, 36, 12, 4, 37, 13],
+
+	  // 10
+	  [2, 86, 68, 2, 87, 69],
+	  [4, 69, 43, 1, 70, 44],
+	  [6, 43, 19, 2, 44, 20],
+	  [6, 43, 15, 2, 44, 16],
+
+	  // 11
+	  [4, 101, 81],
+	  [1, 80, 50, 4, 81, 51],
+	  [4, 50, 22, 4, 51, 23],
+	  [3, 36, 12, 8, 37, 13],
+
+	  // 12
+	  [2, 116, 92, 2, 117, 93],
+	  [6, 58, 36, 2, 59, 37],
+	  [4, 46, 20, 6, 47, 21],
+	  [7, 42, 14, 4, 43, 15],
+
+	  // 13
+	  [4, 133, 107],
+	  [8, 59, 37, 1, 60, 38],
+	  [8, 44, 20, 4, 45, 21],
+	  [12, 33, 11, 4, 34, 12],
+
+	  // 14
+	  [3, 145, 115, 1, 146, 116],
+	  [4, 64, 40, 5, 65, 41],
+	  [11, 36, 16, 5, 37, 17],
+	  [11, 36, 12, 5, 37, 13],
+
+	  // 15
+	  [5, 109, 87, 1, 110, 88],
+	  [5, 65, 41, 5, 66, 42],
+	  [5, 54, 24, 7, 55, 25],
+	  [11, 36, 12],
+
+	  // 16
+	  [5, 122, 98, 1, 123, 99],
+	  [7, 73, 45, 3, 74, 46],
+	  [15, 43, 19, 2, 44, 20],
+	  [3, 45, 15, 13, 46, 16],
+
+	  // 17
+	  [1, 135, 107, 5, 136, 108],
+	  [10, 74, 46, 1, 75, 47],
+	  [1, 50, 22, 15, 51, 23],
+	  [2, 42, 14, 17, 43, 15],
+
+	  // 18
+	  [5, 150, 120, 1, 151, 121],
+	  [9, 69, 43, 4, 70, 44],
+	  [17, 50, 22, 1, 51, 23],
+	  [2, 42, 14, 19, 43, 15],
+
+	  // 19
+	  [3, 141, 113, 4, 142, 114],
+	  [3, 70, 44, 11, 71, 45],
+	  [17, 47, 21, 4, 48, 22],
+	  [9, 39, 13, 16, 40, 14],
+
+	  // 20
+	  [3, 135, 107, 5, 136, 108],
+	  [3, 67, 41, 13, 68, 42],
+	  [15, 54, 24, 5, 55, 25],
+	  [15, 43, 15, 10, 44, 16],
+
+	  // 21
+	  [4, 144, 116, 4, 145, 117],
+	  [17, 68, 42],
+	  [17, 50, 22, 6, 51, 23],
+	  [19, 46, 16, 6, 47, 17],
+
+	  // 22
+	  [2, 139, 111, 7, 140, 112],
+	  [17, 74, 46],
+	  [7, 54, 24, 16, 55, 25],
+	  [34, 37, 13],
+
+	  // 23
+	  [4, 151, 121, 5, 152, 122],
+	  [4, 75, 47, 14, 76, 48],
+	  [11, 54, 24, 14, 55, 25],
+	  [16, 45, 15, 14, 46, 16],
+
+	  // 24
+	  [6, 147, 117, 4, 148, 118],
+	  [6, 73, 45, 14, 74, 46],
+	  [11, 54, 24, 16, 55, 25],
+	  [30, 46, 16, 2, 47, 17],
+
+	  // 25
+	  [8, 132, 106, 4, 133, 107],
+	  [8, 75, 47, 13, 76, 48],
+	  [7, 54, 24, 22, 55, 25],
+	  [22, 45, 15, 13, 46, 16],
+
+	  // 26
+	  [10, 142, 114, 2, 143, 115],
+	  [19, 74, 46, 4, 75, 47],
+	  [28, 50, 22, 6, 51, 23],
+	  [33, 46, 16, 4, 47, 17],
+
+	  // 27
+	  [8, 152, 122, 4, 153, 123],
+	  [22, 73, 45, 3, 74, 46],
+	  [8, 53, 23, 26, 54, 24],
+	  [12, 45, 15, 28, 46, 16],
+
+	  // 28
+	  [3, 147, 117, 10, 148, 118],
+	  [3, 73, 45, 23, 74, 46],
+	  [4, 54, 24, 31, 55, 25],
+	  [11, 45, 15, 31, 46, 16],
+
+	  // 29
+	  [7, 146, 116, 7, 147, 117],
+	  [21, 73, 45, 7, 74, 46],
+	  [1, 53, 23, 37, 54, 24],
+	  [19, 45, 15, 26, 46, 16],
+
+	  // 30
+	  [5, 145, 115, 10, 146, 116],
+	  [19, 75, 47, 10, 76, 48],
+	  [15, 54, 24, 25, 55, 25],
+	  [23, 45, 15, 25, 46, 16],
+
+	  // 31
+	  [13, 145, 115, 3, 146, 116],
+	  [2, 74, 46, 29, 75, 47],
+	  [42, 54, 24, 1, 55, 25],
+	  [23, 45, 15, 28, 46, 16],
+
+	  // 32
+	  [17, 145, 115],
+	  [10, 74, 46, 23, 75, 47],
+	  [10, 54, 24, 35, 55, 25],
+	  [19, 45, 15, 35, 46, 16],
+
+	  // 33
+	  [17, 145, 115, 1, 146, 116],
+	  [14, 74, 46, 21, 75, 47],
+	  [29, 54, 24, 19, 55, 25],
+	  [11, 45, 15, 46, 46, 16],
+
+	  // 34
+	  [13, 145, 115, 6, 146, 116],
+	  [14, 74, 46, 23, 75, 47],
+	  [44, 54, 24, 7, 55, 25],
+	  [59, 46, 16, 1, 47, 17],
+
+	  // 35
+	  [12, 151, 121, 7, 152, 122],
+	  [12, 75, 47, 26, 76, 48],
+	  [39, 54, 24, 14, 55, 25],
+	  [22, 45, 15, 41, 46, 16],
+
+	  // 36
+	  [6, 151, 121, 14, 152, 122],
+	  [6, 75, 47, 34, 76, 48],
+	  [46, 54, 24, 10, 55, 25],
+	  [2, 45, 15, 64, 46, 16],
+
+	  // 37
+	  [17, 152, 122, 4, 153, 123],
+	  [29, 74, 46, 14, 75, 47],
+	  [49, 54, 24, 10, 55, 25],
+	  [24, 45, 15, 46, 46, 16],
+
+	  // 38
+	  [4, 152, 122, 18, 153, 123],
+	  [13, 74, 46, 32, 75, 47],
+	  [48, 54, 24, 14, 55, 25],
+	  [42, 45, 15, 32, 46, 16],
+
+	  // 39
+	  [20, 147, 117, 4, 148, 118],
+	  [40, 75, 47, 7, 76, 48],
+	  [43, 54, 24, 22, 55, 25],
+	  [10, 45, 15, 67, 46, 16],
+
+	  // 40
+	  [19, 148, 118, 6, 149, 119],
+	  [18, 75, 47, 31, 76, 48],
+	  [34, 54, 24, 34, 55, 25],
+	  [20, 45, 15, 61, 46, 16]
+	];
+
+	/**
+	 * 根据数据获取对应版本
+	 * @return {[type]} [description]
+	 */
+	QRCodeAlg.prototype.getRightType = function() {
+	  for (var typeNumber = 1; typeNumber < 41; typeNumber++) {
+	    var rsBlock = RS_BLOCK_TABLE[(typeNumber - 1) * 4 + this.errorCorrectLevel];
+	    if (rsBlock == undefined) {
+	      throw new Error('bad rs block @ typeNumber:' + typeNumber + '/errorCorrectLevel:' + this.errorCorrectLevel);
+	    }
+	    var length = rsBlock.length / 3;
+	    var totalDataCount = 0;
+	    for (var i = 0; i < length; i++) {
+	      var count = rsBlock[i * 3 + 0];
+	      var dataCount = rsBlock[i * 3 + 2];
+	      totalDataCount += dataCount * count;
+	    }
+
+	    var lengthBytes = typeNumber > 9 ? 2 : 1;
+	    if (this.utf8bytes.length + lengthBytes < totalDataCount || typeNumber == 40) {
+	      this.typeNumber = typeNumber;
+	      this.rsBlock = rsBlock;
+	      this.totalDataCount = totalDataCount;
+	      break;
+	    }
+	  }
+	};
+
+	// ---------------------------------------------------------------------
+	// QRBitBuffer
+	// ---------------------------------------------------------------------
+
+	function QRBitBuffer() {
+	  this.buffer = new Array();
+	  this.length = 0;
+	}
+
+	QRBitBuffer.prototype = {
+	  get: function(index) {
+	    var bufIndex = Math.floor(index / 8);
+	    return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1);
+	  },
+
+	  put: function(num, length) {
+	    for (var i = 0; i < length; i++) {
+	      this.putBit(((num >>> (length - i - 1)) & 1));
+	    }
+	  },
+
+	  putBit: function(bit) {
+
+	    var bufIndex = Math.floor(this.length / 8);
+	    if (this.buffer.length <= bufIndex) {
+	      this.buffer.push(0);
+	    }
+
+	    if (bit) {
+	      this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));
+	    }
+
+	    this.length++;
+	  }
+	};
+
+	$.fn.qrcode = function QRCodePlugin(option) {
+	  return this.each(function() {
+	    $(this).append(new QRCode(option));
+	  });
+	};
+
+	module.exports = UI.qrcode = QRCode;
+
+
+/***/ },
+/* 27 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	/**
+	 * @via https://github.com/uikit/uikit/blob/master/src/js/addons/sticky.js
+	 * @license https://github.com/uikit/uikit/blob/master/LICENSE.md
+	 */
+
+	// Sticky Class
+	var Sticky = function(element, options) {
+	  var _this = this;
+
+	  this.options = $.extend({}, Sticky.DEFAULTS, options);
+	  this.$element = $(element);
+	  this.sticked = null;
+	  this.inited = null;
+	  this.$holder = undefined;
+
+	  this.$window = $(window).
+	    on('scroll.sticky.amui',
+	    UI.utils.debounce($.proxy(this.checkPosition, this), 10)).
+	    on('resize.sticky.amui orientationchange.sticky.amui',
+	    UI.utils.debounce(function() {
+	      _this.reset(true, function() {
+	        _this.checkPosition();
+	      });
+	    }, 50)).
+	    on('load.sticky.amui', $.proxy(this.checkPosition, this));
+
+	  // the `.offset()` is diff between jQuery & Zepto.js
+	  // jQuery: return `top` and `left`
+	  // Zepto.js: return `top`, `left`, `width`, `height`
+	  this.offset = this.$element.offset();
+
+	  this.init();
+	};
+
+	Sticky.DEFAULTS = {
+	  top: 0,
+	  bottom: 0,
+	  animation: '',
+	  className: {
+	    sticky: 'am-sticky',
+	    resetting: 'am-sticky-resetting',
+	    stickyBtm: 'am-sticky-bottom',
+	    animationRev: 'am-animation-reverse'
+	  }
+	};
+
+	Sticky.prototype.init = function() {
+	  var result = this.check();
+
+	  if (!result) {
+	    return false;
+	  }
+
+	  var $element = this.$element;
+	  var $elementMargin = '';
+
+	  $.each($element.css(
+	      ['marginTop', 'marginRight', 'marginBottom', 'marginLeft']),
+	    function(name, value) {
+	      return $elementMargin += ' ' + value;
+	    });
+
+	  var $holder = $('<div class="am-sticky-placeholder"></div>').css({
+	    height: $element.css('position') !== 'absolute' ?
+	      $element.outerHeight() : '',
+	    float: $element.css('float') != 'none' ? $element.css('float') : '',
+	    margin: $elementMargin
+	  });
+
+	  this.$holder = $element.css('margin', 0).wrap($holder).parent();
+	  this.inited = 1;
+
+	  return true;
+	};
+
+	Sticky.prototype.reset = function(force, cb) {
+	  var options = this.options;
+	  var $element = this.$element;
+	  var animation = (options.animation) ?
+	  ' am-animation-' + options.animation : '';
+	  var complete = function() {
+	    $element.css({position: '', top: '', width: '', left: '', margin: 0});
+	    $element.removeClass([
+	      animation,
+	      options.className.animationRev,
+	      options.className.sticky,
+	      options.className.resetting
+	    ].join(' '));
+
+	    this.animating = false;
+	    this.sticked = false;
+	    this.offset = $element.offset();
+	    cb && cb();
+	  }.bind(this);
+
+	  $element.addClass(options.className.resetting);
+
+	  if (!force && options.animation && UI.support.animation) {
+
+	    this.animating = true;
+
+	    $element.removeClass(animation).one(UI.support.animation.end, function() {
+	      complete();
+	    }).width(); // force redraw
+
+	    $element.addClass(animation + ' ' + options.className.animationRev);
+	  } else {
+	    complete();
+	  }
+	};
+
+	Sticky.prototype.check = function() {
+	  if (!this.$element.is(':visible')) {
+	    return false;
+	  }
+
+	  var media = this.options.media;
+
+	  if (media) {
+	    switch (typeof(media)) {
+	      case 'number':
+	        if (window.innerWidth < media) {
+	          return false;
+	        }
+	        break;
+
+	      case 'string':
+	        if (window.matchMedia && !window.matchMedia(media).matches) {
+	          return false;
+	        }
+	        break;
+	    }
+	  }
+
+	  return true;
+	};
+
+	Sticky.prototype.checkPosition = function() {
+	  if (!this.inited) {
+	    var initialized = this.init();
+	    if (!initialized) {
+	      return;
+	    }
+	  }
+
+	  var options = this.options;
+	  var scrollTop = this.$window.scrollTop();
+	  var offsetTop = options.top;
+	  var offsetBottom = options.bottom;
+	  var $element = this.$element;
+	  var animation = (options.animation) ?
+	    ' am-animation-' + options.animation : '';
+	  var className = [options.className.sticky, animation].join(' ');
+
+	  if (typeof offsetBottom == 'function') {
+	    offsetBottom = offsetBottom(this.$element);
+	  }
+
+	  var checkResult = (scrollTop > this.$holder.offset().top);
+
+	  if (!this.sticked && checkResult) {
+	    $element.addClass(className);
+	  } else if (this.sticked && !checkResult) {
+	    this.reset();
+	  }
+
+	  this.$holder.css({
+	    height: $element.is(':visible') && $element.css('position') !== 'absolute' ?
+	      $element.outerHeight() : ''
+	  });
+
+	  if (checkResult) {
+	    $element.css({
+	      top: offsetTop,
+	      left: this.$holder.offset().left,
+	      width: this.$holder.width()
+	    });
+
+	    /*
+	     if (offsetBottom) {
+	     // (底部边距 + 元素高度 > 窗口高度) 时定位到底部
+	     if ((offsetBottom + this.offset.height > $(window).height()) &&
+	     (scrollTop + $(window).height() >= scrollHeight - offsetBottom)) {
+	     $element.addClass(options.className.stickyBtm).
+	     css({top: $(window).height() - offsetBottom - this.offset.height});
+	     } else {
+	     $element.removeClass(options.className.stickyBtm).css({top: offsetTop});
+	     }
+	     }
+	     */
+	  }
+
+	  this.sticked = checkResult;
+	};
+
+	// Sticky Plugin
+	UI.plugin('sticky', Sticky);
+
+	// Init code
+	$(window).on('load', function() {
+	  $('[data-am-sticky]').sticky();
+	});
+
+	module.exports = Sticky;
+
+
+/***/ },
+/* 28 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var Hammer = __webpack_require__(3);
+	var supportTransition = UI.support.transition;
+	var animation = UI.support.animation;
+
+	/**
+	 * @via https://github.com/twbs/bootstrap/blob/master/js/tab.js
+	 * @copyright 2011-2014 Twitter, Inc.
+	 * @license MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+	 */
+
+	/**
+	 * Tabs
+	 * @param {HTMLElement} element
+	 * @param {Object} options
+	 * @constructor
+	 */
+	var Tabs = function(element, options) {
+	  this.$element = $(element);
+	  this.options = $.extend({}, Tabs.DEFAULTS, options || {});
+	  this.transitioning = this.activeIndex = null;
+
+	  this.refresh();
+	  this.init();
+	};
+
+	Tabs.DEFAULTS = {
+	  selector: {
+	    nav: '> .am-tabs-nav',
+	    content: '> .am-tabs-bd',
+	    panel: '> .am-tab-panel'
+	  },
+	  activeClass: 'am-active'
+	};
+
+	Tabs.prototype.refresh = function() {
+	  var selector = this.options.selector;
+
+	  this.$tabNav = this.$element.find(selector.nav);
+	  this.$navs = this.$tabNav.find('a');
+
+	  this.$content = this.$element.find(selector.content);
+	  this.$tabPanels = this.$content.find(selector.panel);
+
+	  var $active = this.$tabNav.find('> .' + this.options.activeClass);
+
+	  // Activate the first Tab when no active Tab or multiple active Tabs
+	  if ($active.length !== 1) {
+	    this.open(0);
+	  } else {
+	    this.activeIndex = this.$navs.index($active.children('a'));
+	  }
+	};
+
+	Tabs.prototype.init = function() {
+	  var _this = this;
+	  var options = this.options;
+
+	  this.$element.on('click.tabs.amui', options.selector.nav + ' a', function(e) {
+	    e.preventDefault();
+	    _this.open($(this));
+	  });
+
+	  // TODO: nested Tabs touch events
+	  if (!options.noSwipe) {
+	    if (!this.$content.length) {
+	      return this;
+	    }
+
+	    var hammer = new Hammer.Manager(this.$content[0]);
+	    var swipe = new Hammer.Swipe({
+	      direction: Hammer.DIRECTION_HORIZONTAL
+	      // threshold: 40
+	    });
+
+	    hammer.add(swipe);
+
+	    hammer.on('swipeleft', UI.utils.debounce(function(e) {
+	      e.preventDefault();
+	      _this.goTo('next');
+	    }, 100));
+
+	    hammer.on('swiperight', UI.utils.debounce(function(e) {
+	      e.preventDefault();
+	      _this.goTo('prev');
+	    }, 100));
+
+	    this._hammer = hammer;
+	  }
+	};
+
+	/**
+	 * Open $nav tab
+	 * @param {jQuery|HTMLElement|Number} $nav
+	 * @returns {Tabs}
+	 */
+	Tabs.prototype.open = function($nav) {
+	  var activeClass = this.options.activeClass;
+	  var activeIndex = typeof $nav === 'number' ? $nav : this.$navs.index($($nav));
+
+	  $nav = typeof $nav === 'number' ? this.$navs.eq(activeIndex) : $($nav);
+
+	  if (!$nav ||
+	    !$nav.length ||
+	    this.transitioning ||
+	    $nav.parent('li').hasClass(activeClass)) {
+	    return;
+	  }
+
+	  var $tabNav = this.$tabNav;
+	  var href = $nav.attr('href');
+	  var regexHash = /^#.+$/;
+	  var $target = regexHash.test(href) && this.$content.find(href) ||
+	    this.$tabPanels.eq(activeIndex);
+	  var previous = $tabNav.find('.' + activeClass + ' a')[0];
+	  var e = $.Event('open.tabs.amui', {
+	    relatedTarget: previous
+	  });
+
+	  $nav.trigger(e);
+
+	  if (e.isDefaultPrevented()) {
+	    return;
+	  }
+
+	  // activate Tab nav
+	  this.activate($nav.closest('li'), $tabNav);
+
+	  // activate Tab content
+	  this.activate($target, this.$content, function() {
+	    $nav.trigger({
+	      type: 'opened.tabs.amui',
+	      relatedTarget: previous
+	    });
+	  });
+
+	  this.activeIndex = activeIndex;
+	};
+
+	Tabs.prototype.activate = function($element, $container, callback) {
+	  this.transitioning = true;
+
+	  var activeClass = this.options.activeClass;
+	  var $active = $container.find('> .' + activeClass);
+	  var transition = callback && supportTransition && !!$active.length;
+
+	  $active.removeClass(activeClass + ' am-in');
+
+	  $element.addClass(activeClass);
+
+	  if (transition) {
+	    $element.redraw(); // reflow for transition
+	    $element.addClass('am-in');
+	  } else {
+	    $element.removeClass('am-fade');
+	  }
+
+	  var complete = $.proxy(function complete() {
+	    callback && callback();
+	    this.transitioning = false;
+	  }, this);
+
+
+
+	  transition && !this.$content.is('.am-tabs-bd-ofv') ?
+	    $active.one(supportTransition.end, complete) : complete();
+	};
+
+	/**
+	 * Go to `next` or `prev` tab
+	 * @param {String} direction - `next` or `prev`
+	 */
+	Tabs.prototype.goTo = function(direction) {
+	  var navIndex = this.activeIndex;
+	  var isNext = direction === 'next';
+	  var spring = isNext ? 'am-animation-right-spring' :
+	    'am-animation-left-spring';
+
+	  if ((isNext && navIndex + 1 >= this.$navs.length) || // last one
+	    (!isNext && navIndex === 0)) { // first one
+	    var $panel = this.$tabPanels.eq(navIndex);
+
+	    animation && $panel.addClass(spring).on(animation.end, function() {
+	      $panel.removeClass(spring);
+	    });
+	  } else {
+	    this.open(isNext ? navIndex + 1 : navIndex - 1);
+	  }
+	};
+
+	Tabs.prototype.destroy = function() {
+	  this.$element.off('.tabs.amui');
+	  Hammer.off(this.$content[0], 'swipeleft swiperight');
+	  this._hammer && this._hammer.destroy();
+	  $.removeData(this.$element, 'amui.tabs');
+	};
+
+	// Plugin
+	function Plugin(option) {
+	  var args = Array.prototype.slice.call(arguments, 1);
+	  var methodReturn;
+
+	  this.each(function() {
+	    var $this = $(this);
+	    var $tabs = $this.is('.am-tabs') && $this || $this.closest('.am-tabs');
+	    var data = $tabs.data('amui.tabs');
+	    var options = $.extend({}, UI.utils.parseOptions($this.data('amTabs')),
+	      $.isPlainObject(option) && option);
+
+	    if (!data) {
+	      $tabs.data('amui.tabs', (data = new Tabs($tabs[0], options)));
+	    }
+
+	    if (typeof option === 'string') {
+	      if (option === 'open' && $this.is('.am-tabs-nav a')) {
+	        data.open($this);
+	      } else {
+	        methodReturn = typeof data[option] === 'function' ?
+	          data[option].apply(data, args) : data[option];
+	      }
+	    }
+	  });
+
+	  return methodReturn === undefined ? this : methodReturn;
+	}
+
+	$.fn.tabs = Plugin;
+
+	// Init code
+	UI.ready(function(context) {
+	  $('[data-am-tabs]', context).tabs();
+	});
+
+	$(document).on('click.tabs.amui.data-api', '[data-am-tabs] .am-tabs-nav a',
+	  function(e) {
+	  e.preventDefault();
+	  Plugin.call($(this), 'open');
+	});
+
+	module.exports = UI.tabs = Tabs;
+
+	// TODO: 1. Ajax 支持
+	//       2. touch 事件处理逻辑优化
+
+
+/***/ },
+/* 29 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	/**
+	 * UCheck
+	 * @via https://github.com/designmodo/Flat-UI/blob/8ef98df23ba7f5033e596a9bd05b53b535a9fe99/js/radiocheck.js
+	 * @license CC BY 3.0 & MIT
+	 * @param {HTMLElement} element
+	 * @param {object} options
+	 * @constructor
+	 */
+
+	var UCheck = function(element, options) {
+	  this.options = $.extend({}, UCheck.DEFAULTS, options);
+	  // this.options = $.extend({}, UCheck.DEFAULTS, this.$element.data(), options);
+	  this.$element = $(element);
+	  this.init();
+	};
+
+	UCheck.DEFAULTS = {
+	  checkboxClass: 'am-ucheck-checkbox',
+	  radioClass: 'am-ucheck-radio',
+	  checkboxTpl: '<span class="am-ucheck-icons">' +
+	  '<i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>',
+	  radioTpl: '<span class="am-ucheck-icons">' +
+	  '<i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>'
+	};
+
+	UCheck.prototype.init = function() {
+	  var $element = this.$element;
+	  var element = $element[0];
+	  var options = this.options;
+
+	  if (element.type === 'checkbox') {
+	    $element.addClass(options.checkboxClass)
+	      .after(options.checkboxTpl);
+	  } else if (element.type === 'radio') {
+	    $element.addClass(options.radioClass)
+	      .after(options.radioTpl);
+	  }
+	};
+
+	UCheck.prototype.check = function() {
+	  this.$element
+	    .prop('checked', true)
+	    .trigger('change.ucheck.amui')
+	    .trigger('checked.ucheck.amui');
+	},
+
+	UCheck.prototype.uncheck = function() {
+	  this.$element
+	    .prop('checked', false)
+	    // trigger `change` event for form validation, etc.
+	    // @see https://forum.jquery.com/topic/should-chk-prop-checked-true-trigger-change-event
+	    .trigger('change')
+	    .trigger('unchecked.ucheck.amui');
+	},
+
+	UCheck.prototype.toggle = function() {
+	  this.$element.
+	    prop('checked', function(i, value) {
+	      return !value;
+	    })
+	    .trigger('change.ucheck.amui')
+	    .trigger('toggled.ucheck.amui');
+	},
+
+	UCheck.prototype.disable = function() {
+	  this.$element
+	    .prop('disabled', true)
+	    .trigger('change.ucheck.amui')
+	    .trigger('disabled.ucheck.amui');
+	},
+
+	UCheck.prototype.enable = function() {
+	  this.$element.prop('disabled', false);
+	  this.$element.trigger('change.ucheck.amui').trigger('enabled.ucheck.amui');
+	},
+
+	UCheck.prototype.destroy = function() {
+	  this.$element
+	    .removeData('amui.ucheck')
+	    .removeClass(this.options.checkboxClass + ' ' + this.options.radioClass)
+	    .next('.am-ucheck-icons')
+	    .remove()
+	  .end()
+	    .trigger('destroyed.ucheck.amui');
+	};
+
+	UI.plugin('uCheck', UCheck, {
+	  after: function() {
+	    // Adding 'am-nohover' class for touch devices
+	    if (UI.support.touch) {
+	      this.parent().hover(function() {
+	        $(this).addClass('am-nohover');
+	      }, function() {
+	        $(this).removeClass('am-nohover');
+	      });
+	    }
+	  }
+	});
+
+	UI.ready(function(context) {
+	  $('[data-am-ucheck]', context).uCheck();
+	});
+
+	module.exports = UCheck;
+
+	// TODO: 与表单验证结合使用的情况
+
+
+/***/ },
+/* 30 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	var Validator = function(element, options) {
+	  this.options = $.extend({}, Validator.DEFAULTS, options);
+	  this.options.patterns = $.extend({}, Validator.patterns,
+	    this.options.patterns);
+	  var locales = this.options.locales;
+	  !Validator.validationMessages[locales] && (this.options.locales = 'zh_CN');
+	  this.$element = $(element);
+	  this.init();
+	};
+
+	Validator.DEFAULTS = {
+	  debug: false,
+	  locales: 'zh_CN',
+	  H5validation: false,
+	  H5inputType: ['email', 'url', 'number'],
+	  patterns: {},
+	  patternClassPrefix: 'js-pattern-',
+	  activeClass: 'am-active',
+	  inValidClass: 'am-field-error',
+	  validClass: 'am-field-valid',
+
+	  validateOnSubmit: true,
+	  alwaysRevalidate: false,
+	  // Elements to validate with allValid (only validating visible elements)
+	  // :input: selects all input, textarea, select and button elements.
+	  // @since 2.5: move `:visible` to `ignore` option (became to `:hidden`)
+	  allFields: ':input:not(:submit, :button, :disabled, .am-novalidate)',
+
+	  // ignored elements
+	  // @since 2.5
+	  ignore: ':hidden:not([data-am-selected], .am-validate)',
+
+	  // Custom events
+	  customEvents: 'validate',
+
+	  // Keyboard events
+	  keyboardFields: ':input:not(:submit, :button, :disabled, .am-novalidate)',
+	  keyboardEvents: 'focusout, change', // keyup, focusin
+
+	  // bind `keyup` event to active field
+	  activeKeyup: false,
+	  textareaMaxlenthKeyup: true,
+
+	  // Mouse events
+	  pointerFields: 'input[type="range"]:not(:disabled, .am-novalidate), ' +
+	  'input[type="radio"]:not(:disabled, .am-novalidate), ' +
+	  'input[type="checkbox"]:not(:disabled, .am-novalidate), ' +
+	  'select:not(:disabled, .am-novalidate), ' +
+	  'option:not(:disabled, .am-novalidate)',
+	  pointerEvents: 'click',
+
+	  onValid: function(validity) {
+	  },
+
+	  onInValid: function(validity) {
+	  },
+
+	  markValid: function(validity) {
+	    // this is Validator instance
+	    var options = this.options;
+	    var $field = $(validity.field);
+	    var $parent = $field.closest('.am-form-group');
+
+	    $field.addClass(options.validClass).removeClass(options.inValidClass);
+	    $parent.addClass('am-form-success').removeClass('am-form-error');
+	    options.onValid.call(this, validity);
+	  },
+
+	  markInValid: function(validity) {
+	    var options = this.options;
+	    var $field = $(validity.field);
+	    var $parent = $field.closest('.am-form-group');
+
+	    $field.addClass(options.inValidClass + ' ' + options.activeClass).
+	      removeClass(options.validClass);
+	    $parent.addClass('am-form-error').removeClass('am-form-success');
+	    options.onInValid.call(this, validity);
+	  },
+
+	  validate: function(validity) {
+	    // return validity;
+	  },
+
+	  submit: null
+	};
+
+	Validator.VERSION = '2.7.2';
+
+	/* jshint -W101 */
+	Validator.patterns = {
+	  email: /^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/,
+
+	  url: /^(https?|ftp):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,
+
+	  // Number, including positive, negative, and floating decimal
+	  number: /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/,
+	  dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,
+	  integer: /^-?\d+$/
+	};
+	/* jshint +W101 */
+
+	Validator.validationMessages = {
+	  zh_CN: {
+	    valueMissing: '请填写(选择)此字段',
+	    customError: {
+	      tooShort: '至少填写 %s 个字符',
+	      checkedOverflow: '至多选择 %s 项',
+	      checkedUnderflow: '至少选择 %s 项'
+	    },
+	    patternMismatch: '请按照要求的格式填写',
+	    rangeOverflow: '请填写小于等于 %s 的值',
+	    rangeUnderflow: '请填写大于等于 %s 的值',
+	    stepMismatch: '',
+	    tooLong: '至多填写 %s 个字符',
+	    typeMismatch: '请按照要求的类型填写'
+	  }
+	};
+
+	Validator.ERROR_MAP = {
+	  tooShort: 'minlength',
+	  checkedOverflow: 'maxchecked',
+	  checkedUnderflow: 'minchecked',
+	  rangeOverflow: 'max',
+	  rangeUnderflow: 'min',
+	  tooLong: 'maxlength'
+	};
+
+	// TODO: 考虑表单元素不是 form 子元素的情形
+	// TODO: change/click/focusout 同时触发时处理重复
+	// TODO: 显示提示信息
+
+	Validator.prototype.init = function() {
+	  var _this = this;
+	  var $element = this.$element;
+	  var options = this.options;
+
+	  // using H5 form validation if option set and supported
+	  if (options.H5validation && UI.support.formValidation) {
+	    return false;
+	  }
+
+	  // disable HTML5 form validation
+	  $element.attr('novalidate', 'novalidate');
+
+	  function regexToPattern(regex) {
+	    var pattern = regex.toString();
+	    return pattern.substring(1, pattern.length - 1);
+	  }
+
+	  // add pattern to H5 input type
+	  $.each(options.H5inputType, function(i, type) {
+	    var $field = $element.find('input[type=' + type + ']');
+	    if (!$field.attr('pattern') &&
+	      !$field.is('[class*=' + options.patternClassPrefix + ']')) {
+	      $field.attr('pattern', regexToPattern(options.patterns[type]));
+	    }
+	  });
+
+	  // add pattern to .js-pattern-xx
+	  $.each(options.patterns, function(key, value) {
+	    var $field = $element.find('.' + options.patternClassPrefix + key);
+	    !$field.attr('pattern') && $field.attr('pattern', regexToPattern(value));
+	  });
+
+	  $element.on('submit.validator.amui', function(e) {
+	    // user custom submit handler
+	    if (typeof options.submit === 'function') {
+	      return options.submit.call(_this, e);
+	    }
+
+	    if (options.validateOnSubmit) {
+	      var formValidity = _this.isFormValid();
+
+	      // sync validate, return result
+	      if ($.type(formValidity) === 'boolean') {
+	        return formValidity;
+	      }
+
+	      if ($element.data('amui.checked')) {
+	        return true;
+	      } else {
+	        $.when(formValidity).then(function() {
+	          // done, submit form
+	          $element.data('amui.checked', true).submit();
+	        }, function() {
+	          // fail
+	          $element.data('amui.checked', false).
+	            find('.' + options.inValidClass).eq(0).focus();
+	        });
+	        return false;
+	      }
+	    }
+	  });
+
+	  function bindEvents(fields, eventFlags, debounce) {
+	    var events = eventFlags.split(',');
+	    var validate = function(e) {
+	      // console.log(e.type);
+	      _this.validate(this);
+	    };
+
+	    if (debounce) {
+	      validate = UI.utils.debounce(validate, debounce);
+	    }
+
+	    $.each(events, function(i, event) {
+	      $element.on(event + '.validator.amui', fields, validate);
+	    });
+	  }
+
+	  bindEvents(':input', options.customEvents);
+	  bindEvents(options.keyboardFields, options.keyboardEvents);
+	  bindEvents(options.pointerFields, options.pointerEvents);
+
+	  if (options.textareaMaxlenthKeyup) {
+	    bindEvents('textarea[maxlength]', 'keyup', 50);
+	  }
+
+	  if (options.activeKeyup) {
+	    bindEvents('.am-active', 'keyup', 50);
+	  }
+
+	  /*if (options.errorMessage === 'tooltip') {
+	    this.$tooltip = $('<div></div>', {
+	      'class': 'am-validator-message',
+	      id: UI.utils.generateGUID('am-validator-message')
+	    });
+
+	    $(document.body).append(this.$tooltip);
+	  }*/
+	};
+
+	Validator.prototype.isValid = function(field) {
+	  var $field = $(field);
+	  var options = this.options;
+	  // valid field not has been validated
+	  if ($field.data('validity') === undefined || options.alwaysRevalidate) {
+	    this.validate(field);
+	  }
+
+	  return $field.data('validity') && $field.data('validity').valid;
+	};
+
+	Validator.prototype.validate = function(field) {
+	  var _this = this;
+	  var $element = this.$element;
+	  var options = this.options;
+	  var $field = $(field);
+
+	  // Validate equal, e.g. confirm password
+	  var equalTo = $field.data('equalTo');
+	  if (equalTo) {
+	    $field.attr('pattern', '^' + $element.find(equalTo).val() + '$');
+	  }
+
+	  var pattern = $field.attr('pattern') || false;
+	  var re = new RegExp(pattern);
+	  var $radioGroup = null;
+	  var $checkboxGroup = null;
+	  // if checkbox, return `:chcked` length
+	  // NOTE: checkbox and radio should have name attribute
+	  var value = ($field.is('[type=checkbox]')) ?
+	    ($checkboxGroup = $element.find('input[name="' + field.name + '"]')).
+	      filter(':checked').length : ($field.is('[type=radio]') ?
+	  ($radioGroup = this.$element.find('input[name="' + field.name + '"]')).
+	    filter(':checked').length > 0 : $field.val());
+
+	  // if checkbox, valid the first input of checkbox group
+	  $field = ($checkboxGroup && $checkboxGroup.length) ?
+	    $checkboxGroup.first() : $field;
+
+	  var required = ($field.attr('required') !== undefined) &&
+	    ($field.attr('required') !== 'false');
+	  var maxLength = parseInt($field.attr('maxlength'), 10);
+	  var minLength = parseInt($field.attr('minlength'), 10);
+	  var min = Number($field.attr('min'));
+	  var max = Number($field.attr('max'));
+	  var validity = this.createValidity({field: $field[0], valid: true});
+
+	  // Debug
+	  if (options.debug && window.console) {
+	    console.log('Validate: value -> [' + value + ', regex -> [' + re +
+	    '], required -> ' + required);
+	    console.log('Regex test: ' + re.test(value) + ', Pattern: ' + pattern);
+	  }
+
+	  // check value length
+	  if (!isNaN(maxLength) && value.length > maxLength) {
+	    validity.valid = false;
+	    validity.tooLong = true;
+	  }
+
+	  if (!isNaN(minLength) && value.length < minLength) {
+	    validity.valid = false;
+	    validity.customError = 'tooShort';
+	  }
+
+	  // check minimum and maximum
+	  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input
+	  // TODO: 日期验证最小值和最大值 min/max
+	  if (!isNaN(min) && Number(value) < min) {
+	    validity.valid = false;
+	    validity.rangeUnderflow = true;
+	  }
+
+	  if (!isNaN(max) && Number(value) > max) {
+	    validity.valid = false;
+	    validity.rangeOverflow = true;
+	  }
+
+	  // check required
+	  if (required && !value) {
+	    validity.valid = false;
+	    validity.valueMissing = true;
+	  } else if (($checkboxGroup || $field.is('select[multiple="multiple"]')) &&
+	    value) {
+	    // check checkboxes / multiple select with `minchecked`/`maxchecked` attr
+	    // var $multipleField = $checkboxGroup ? $checkboxGroup.first() : $field;
+
+	    // if is select[multiple="multiple"], return selected length
+	    value = $checkboxGroup ? value : value.length;
+
+	    // at least checked
+	    var minChecked = parseInt($field.attr('minchecked'), 10);
+	    // at most checked
+	    var maxChecked = parseInt($field.attr('maxchecked'), 10);
+
+	    if (!isNaN(minChecked) && value < minChecked) {
+	      // console.log('At least [%d] items checked!', maxChecked);
+	      validity.valid = false;
+	      validity.customError = 'checkedUnderflow';
+	    }
+
+	    if (!isNaN(maxChecked) && value > maxChecked) {
+	      // console.log('At most [%d] items checked!', maxChecked);
+	      validity.valid = false;
+	      validity.customError = 'checkedOverflow';
+	    }
+	  } else if (pattern && !re.test(value) && value) { // check pattern
+	    validity.valid = false;
+	    validity.patternMismatch = true;
+	  }
+
+	  var validateComplete = function(validity) {
+	    this.markField(validity);
+
+	    var event = $.Event('validated.field.validator.amui');
+	    event.validity = validity;
+
+	    $field.trigger(event).data('validity', validity);
+
+	    // validate the radios/checkboxes with the same name
+	    var $fields = $radioGroup || $checkboxGroup;
+	    if ($fields) {
+	      $fields.not($field).data('validity', validity).each(function() {
+	        validity.field = this;
+	        _this.markField(validity);
+	      });
+	    }
+
+	    return validity;
+	  };
+
+	  // Run custom validate
+	  // NOTE: async custom validate should return Deferred project
+	  var customValidate;
+	  (typeof options.validate === 'function') &&
+	    (customValidate = options.validate.call(this, validity));
+
+	  // Deferred
+	  if (customValidate) {
+	    var dfd = new $.Deferred();
+	    $field.data('amui.dfdValidity', dfd.promise());
+	    return $.when(customValidate).always(function(validity) {
+	      dfd[validity.valid ? 'resolve' : 'reject'](validity);
+	      validateComplete.call(_this, validity);
+	    });
+	  }
+
+	  validateComplete.call(this, validity);
+	};
+
+	Validator.prototype.markField = function(validity) {
+	  var options = this.options;
+	  var flag = 'mark' + (validity.valid ? '' : 'In') + 'Valid';
+	  options[flag] && options[flag].call(this, validity);
+	};
+
+	// check all fields in the form are valid
+	Validator.prototype.validateForm = function() {
+	  var _this = this;
+	  var $element = this.$element;
+	  var options = this.options;
+	  var $allFields = $element.find(options.allFields).not(options.ignore);
+	  var radioNames = [];
+	  var valid = true;
+	  var formValidity = [];
+	  var $inValidFields = $([]);
+	  var promises = [];
+	  // for async validate
+	  var async = false;
+
+	  $element.trigger('validate.form.validator.amui');
+
+	  // Filter radio with the same name and keep only one,
+	  //   since they will be checked as a group by validate()
+	  var $filteredFields = $allFields.filter(function(index) {
+	    var name;
+	    if (this.tagName === 'INPUT' && this.type === 'radio') {
+	      name = this.name;
+	      if (radioNames[name] === true) {
+	        return false;
+	      }
+	      radioNames[name] = true;
+	    }
+	    return true;
+	  });
+
+	  $filteredFields.each(function() {
+	    var $this = $(this);
+	    var fieldValid = _this.isValid(this);
+	    var fieldValidity = $this.data('validity');
+
+	    valid = !!fieldValid && valid;
+	    formValidity.push(fieldValidity);
+
+	    if (!fieldValid) {
+	      $inValidFields = $inValidFields.add($(this), $element);
+	    }
+
+	    // async validity
+	    var promise = $this.data('amui.dfdValidity');
+
+	    if (promise) {
+	      promises.push(promise);
+	      async = true;
+	    } else {
+	      // convert sync validity to Promise
+	      var dfd = new $.Deferred();
+	      promises.push(dfd.promise());
+	      dfd[fieldValid ? 'resolve' : 'reject'](fieldValidity);
+	    }
+	  });
+
+	  // NOTE: If there are async validity, the valid may be not exact result.
+	  var validity = {
+	    valid: valid,
+	    $invalidFields: $inValidFields,
+	    validity: formValidity,
+	    promises: promises,
+	    async: async
+	  };
+
+	  $element.trigger('validated.form.validator.amui', validity);
+
+	  return validity;
+	};
+
+	Validator.prototype.isFormValid = function() {
+	  var _this = this;
+	  var formValidity = this.validateForm();
+	  var triggerValid = function(type) {
+	    _this.$element.trigger(type + '.validator.amui');
+	  };
+
+	  if (formValidity.async) {
+	    var masterDfd = new $.Deferred();
+
+	    $.when.apply(null, formValidity.promises).then(function() {
+	      masterDfd.resolve();
+	      triggerValid('valid');
+	    }, function() {
+	      masterDfd.reject();
+	      triggerValid('invalid');
+	    });
+
+	    return masterDfd.promise();
+	  } else {
+	    if (!formValidity.valid) {
+	      var $first = formValidity.$invalidFields.first();
+
+	      // Selected plugin support
+	      // @since 2.5
+	      if ($first.is('[data-am-selected]')) {
+	        $first = $first.next('.am-selected').find('.am-selected-btn');
+	      }
+
+	      $first.focus();
+	      triggerValid('invalid');
+	      return false;
+	    }
+
+	    triggerValid('valid');
+	    return true;
+	  }
+	};
+
+	// customErrors:
+	//    1. tooShort
+	//    2. checkedOverflow
+	//    3. checkedUnderflow
+	Validator.prototype.createValidity = function(validity) {
+	  return $.extend({
+	    customError: validity.customError || false,
+	    patternMismatch: validity.patternMismatch || false,
+	    rangeOverflow: validity.rangeOverflow || false, // higher than maximum
+	    rangeUnderflow: validity.rangeUnderflow || false, // lower than  minimum
+	    stepMismatch: validity.stepMismatch || false,
+	    tooLong: validity.tooLong || false,
+	    // value is not in the correct syntax
+	    typeMismatch: validity.typeMismatch || false,
+	    valid: validity.valid || true,
+	    // Returns true if the element has no value but is a required field
+	    valueMissing: validity.valueMissing || false
+	  }, validity);
+	};
+
+	Validator.prototype.getValidationMessage = function(validity) {
+	  var messages = Validator.validationMessages[this.options.locales];
+	  var error;
+	  var message;
+	  var placeholder = '%s';
+	  var $field = $(validity.field);
+
+	  if ($field.is('[type="checkbox"]') || $field.is('[type="radio"]')) {
+	    $field = this.$element.find('[name=' + $field.attr('name') + ']').first();
+	  }
+
+	  // get error name
+	  $.each(validity, function(key, val) {
+	    // skip `field` and `valid`
+	    if (key === 'field' || key === 'valid') {
+	      return key;
+	    }
+
+	    // Amaze UI custom error type
+	    if (key === 'customError' && val) {
+	      error = val;
+	      messages = messages.customError;
+	      return false;
+	    }
+
+	    // W3C specs error type
+	    if (val === true) {
+	      error = key;
+	      return false;
+	    }
+	  });
+
+	  message = messages[error] || undefined;
+
+	  if (message && Validator.ERROR_MAP[error]) {
+	    message = message.replace(placeholder,
+	      $field.attr(Validator.ERROR_MAP[error]) || '规定的');
+	  }
+
+	  return message;
+	};
+
+	// remove valid mark
+	Validator.prototype.removeMark = function() {
+	  this.$element
+	    .find('.am-form-success, .am-form-error, .' + this.options.inValidClass +
+	      ', .' + this.options.validClass)
+	    .removeClass([
+	      'am-form-success',
+	      'am-form-error',
+	      this.options.inValidClass,
+	      this.options.validClass
+	    ].join(' '));
+	};
+
+	// @since 2.5
+	Validator.prototype.destroy = function() {
+	  this.removeMark();
+
+	  // Remove data
+	  // - Validator.prototype.init -> $element.data('amui.checked')
+	  // - Validator.prototype.validateForm
+	  // - Validator.prototype.isValid
+	  this.$element.removeData('amui.validator amui.checked')
+	    .off('.validator.amui')
+	    .find(this.options.allFields).removeData('validity amui.dfdValidity');
+	};
+
+	UI.plugin('validator', Validator);
+
+	// init code
+	UI.ready(function(context) {
+	  $('[data-am-validator]', context).validator();
+	});
+
+	module.exports = Validator;
+
+
+/***/ },
+/* 31 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var UI = __webpack_require__(2);
+
+	var cookie = {
+	  get: function(name) {
+	    var cookieName = encodeURIComponent(name) + '=';
+	    var cookieStart = document.cookie.indexOf(cookieName);
+	    var cookieValue = null;
+	    var cookieEnd;
+
+	    if (cookieStart > -1) {
+	      cookieEnd = document.cookie.indexOf(';', cookieStart);
+	      if (cookieEnd == -1) {
+	        cookieEnd = document.cookie.length;
+	      }
+	      cookieValue = decodeURIComponent(document.cookie.substring(cookieStart +
+	      cookieName.length, cookieEnd));
+	    }
+
+	    return cookieValue;
+	  },
+
+	  set: function(name, value, expires, path, domain, secure) {
+	    var cookieText = encodeURIComponent(name) + '=' +
+	      encodeURIComponent(value);
+
+	    if (expires instanceof Date) {
+	      cookieText += '; expires=' + expires.toUTCString();
+	    }
+
+	    if (path) {
+	      cookieText += '; path=' + path;
+	    }
+
+	    if (domain) {
+	      cookieText += '; domain=' + domain;
+	    }
+
+	    if (secure) {
+	      cookieText += '; secure';
+	    }
+
+	    document.cookie = cookieText;
+	  },
+
+	  unset: function(name, path, domain, secure) {
+	    this.set(name, '', new Date(0), path, domain, secure);
+	  }
+	};
+
+	UI.utils = UI.utils || {};
+
+	module.exports = UI.utils.cookie = cookie;
+
+
+/***/ },
+/* 32 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	/**
+	 * @see https://github.com/sindresorhus/screenfull.js
+	 * @license MIT © Sindre Sorhus
+	 */
+
+	var UI = __webpack_require__(2);
+	var screenfull = (function() {
+	  var keyboardAllowed = typeof Element !== 'undefined' &&
+	    'ALLOW_KEYBOARD_INPUT' in Element;
+
+	  var fn = (function() {
+	    var val;
+	    var valLength;
+
+	    var fnMap = [
+	      [
+	        'requestFullscreen',
+	        'exitFullscreen',
+	        'fullscreenElement',
+	        'fullscreenEnabled',
+	        'fullscreenchange',
+	        'fullscreenerror'
+	      ],
+	      // new WebKit
+	      [
+	        'webkitRequestFullscreen',
+	        'webkitExitFullscreen',
+	        'webkitFullscreenElement',
+	        'webkitFullscreenEnabled',
+	        'webkitfullscreenchange',
+	        'webkitfullscreenerror'
+
+	      ],
+	      // old WebKit (Safari 5.1)
+	      [
+	        'webkitRequestFullScreen',
+	        'webkitCancelFullScreen',
+	        'webkitCurrentFullScreenElement',
+	        'webkitCancelFullScreen',
+	        'webkitfullscreenchange',
+	        'webkitfullscreenerror'
+
+	      ],
+	      [
+	        'mozRequestFullScreen',
+	        'mozCancelFullScreen',
+	        'mozFullScreenElement',
+	        'mozFullScreenEnabled',
+	        'mozfullscreenchange',
+	        'mozfullscreenerror'
+	      ],
+	      [
+	        'msRequestFullscreen',
+	        'msExitFullscreen',
+	        'msFullscreenElement',
+	        'msFullscreenEnabled',
+	        'MSFullscreenChange',
+	        'MSFullscreenError'
+	      ]
+	    ];
+
+	    var i = 0;
+	    var l = fnMap.length;
+	    var ret = {};
+
+	    for (; i < l; i++) {
+	      val = fnMap[i];
+	      if (val && val[1] in document) {
+	        for (i = 0, valLength = val.length; i < valLength; i++) {
+	          ret[fnMap[0][i]] = val[i];
+	        }
+	        return ret;
+	      }
+	    }
+
+	    return false;
+	  })();
+
+	  var screenfull = {
+	    request: function(elem) {
+	      var request = fn.requestFullscreen;
+
+	      elem = elem || document.documentElement;
+
+	      // Work around Safari 5.1 bug: reports support for
+	      // keyboard in fullscreen even though it doesn't.
+	      // Browser sniffing, since the alternative with
+	      // setTimeout is even worse.
+	      if (/5\.1[\.\d]* Safari/.test(navigator.userAgent)) {
+	        elem[request]();
+	      } else {
+	        elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT);
+	      }
+	    },
+	    exit: function() {
+	      document[fn.exitFullscreen]();
+	    },
+	    toggle: function(elem) {
+	      if (this.isFullscreen) {
+	        this.exit();
+	      } else {
+	        this.request(elem);
+	      }
+	    },
+	    raw: fn
+	  };
+
+	  if (!fn) {
+	    return false;
+	  }
+
+	  Object.defineProperties(screenfull, {
+	    isFullscreen: {
+	      get: function() {
+	        return !!document[fn.fullscreenElement];
+	      }
+	    },
+	    element: {
+	      enumerable: true,
+	      get: function() {
+	        return document[fn.fullscreenElement];
+	      }
+	    },
+	    enabled: {
+	      enumerable: true,
+	      get: function() {
+	        // Coerce to boolean in case of old WebKit
+	        return !!document[fn.fullscreenEnabled];
+	      }
+	    }
+	  });
+
+	  screenfull.VERSION = '3.0.0';
+
+	  return screenfull;
+	})();
+
+	module.exports = UI.fullscreen = screenfull;
+
+
+/***/ },
+/* 33 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	UI.support.geolocation = window.navigator && window.navigator.geolocation;
+
+	var geo = UI.support.geolocation;
+
+	var Geolocation = function(options) {
+	  this.options = options || {};
+	};
+
+	Geolocation.MESSAGES = {
+	  unsupportedBrowser: 'Browser does not support location services',
+	  permissionDenied: 'You have rejected access to your location',
+	  positionUnavailable: 'Unable to determine your location',
+	  timeout: 'Service timeout has been reached'
+	};
+
+	Geolocation.ERROR_CODE = {
+	  0: 'unsupportedBrowser',
+	  1: 'permissionDenied',
+	  2: 'positionUnavailable',
+	  3: 'timeout'
+	};
+
+	Geolocation.prototype.get = function(options) {
+	  var _this = this;
+	  options = $.extend({}, this.options, options);
+	  var deferred = new $.Deferred();
+
+	  if (geo) {
+	    this.watchID = geo.getCurrentPosition(function(position) {
+	      deferred.resolve.call(_this, position);
+	    }, function(error) {
+	      deferred.reject(Geolocation.MESSAGES[Geolocation.ERROR_CODE[error.code]]);
+	    }, options);
+	  } else {
+	    deferred.reject(Geolocation.MESSAGES.unsupportedBrowser);
+	  }
+
+	  return deferred.promise();
+	};
+
+	Geolocation.prototype.watch = function(options) {
+	  if (!geo) {
+	    return;
+	  }
+
+	  options = $.extend({}, this.options, options);
+
+	  if (!$.isFunction(options.done)) {
+	    return;
+	  }
+
+	  this.clearWatch();
+
+	  var fail = $.isFunction(options.fail) ? options.fail : null;
+
+	  this.watchID = geo.watchPosition(options.done, fail, options);
+
+	  return this.watchID;
+	};
+
+	Geolocation.prototype.clearWatch = function() {
+	  if (!geo || !this.watchID) {
+	    return;
+	  }
+	  geo.clearWatch(this.watchID);
+	  this.watchID = null;
+	};
+
+	module.exports = UI.Geolocation = Geolocation;
+
+
+/***/ },
+/* 34 */
+/***/ function(module, exports, __webpack_require__) {
+
+	/* WEBPACK VAR INJECTION */(function(global) {'use strict';
+
+	var UI = __webpack_require__(2);
+
+	/**
+	 * store.js
+	 * @see https://github.com/marcuswestin/store.js
+	 * @license https://github.com/marcuswestin/store.js/blob/master/LICENSE
+	 */
+
+	var store = {};
+	var win = (typeof window != 'undefined' ? window : global);
+	var localStorageName = 'localStorage';
+	var storage;
+
+	store.disabled = false;
+	store.version = '1.3.20';
+
+	store.set = function(key, value) {
+	};
+
+	store.get = function(key, defaultVal) {
+	};
+
+	store.has = function(key) {
+	  return store.get(key) !== undefined;
+	};
+
+	store.remove = function(key) {
+	};
+
+	store.clear = function() {
+	};
+
+	store.transact = function(key, defaultVal, transactionFn) {
+	  if (transactionFn == null) {
+	    transactionFn = defaultVal;
+	    defaultVal = null;
+	  }
+	  if (defaultVal == null) {
+	    defaultVal = {};
+	  }
+
+	  var val = store.get(key, defaultVal);
+	  transactionFn(val);
+	  store.set(key, val);
+	};
+
+	store.getAll = function() {
+	};
+
+	store.forEach = function() {
+	};
+
+	store.serialize = function(value) {
+	  return JSON.stringify(value);
+	};
+
+	store.deserialize = function(value) {
+	  if (typeof value != 'string') {
+	    return undefined;
+	  }
+
+	  try {
+	    return JSON.parse(value);
+	  } catch (e) {
+	    return value || undefined;
+	  }
+	};
+
+	// Functions to encapsulate questionable FireFox 3.6.13 behavior
+	// when about.config::dom.storage.enabled === false
+	// See https://github.com/marcuswestin/store.js/issues#issue/13
+	function isLocalStorageNameSupported() {
+	  try {
+	    return (localStorageName in win && win[localStorageName]);
+	  } catch (err) {
+	    return false;
+	  }
+	}
+
+	if (isLocalStorageNameSupported()) {
+	  storage = win[localStorageName];
+
+	  store.set = function(key, val) {
+	    if (val === undefined) {
+	      return store.remove(key);
+	    }
+	    storage.setItem(key, store.serialize(val));
+	    return val;
+	  };
+
+	  store.get = function(key, defaultVal) {
+	    var val = store.deserialize(storage.getItem(key));
+	    return (val === undefined ? defaultVal : val);
+	  };
+
+	  store.remove = function(key) {
+	    storage.removeItem(key);
+	  };
+
+	  store.clear = function() {
+	    storage.clear();
+	  };
+
+	  store.getAll = function() {
+	    var ret = {};
+	    store.forEach(function(key, val) {
+	      ret[key] = val;
+	    });
+	    return ret;
+	  };
+
+	  store.forEach = function(callback) {
+	    for (var i = 0; i < storage.length; i++) {
+	      var key = storage.key(i);
+	      callback(key, store.get(key));
+	    }
+	  };
+	}
+
+	try {
+	  var testKey = '__storejs__';
+	  store.set(testKey, testKey);
+	  if (store.get(testKey) != testKey) {
+	    store.disabled = true;
+	  }
+	  store.remove(testKey);
+	} catch (e) {
+	  store.disabled = true;
+	}
+
+	store.enabled = !store.disabled;
+
+	module.exports = UI.store = store;
+
+	/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
+
+/***/ },
+/* 35 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(7);
+
+	function accordionInit() {
+	  var $accordion = $('[data-am-widget="accordion"]');
+	  var selector = {
+	    item: '.am-accordion-item',
+	    title: '.am-accordion-title',
+	    body: '.am-accordion-bd',
+	    disabled: '.am-disabled'
+	  };
+
+	  $accordion.each(function(i, item) {
+	    var options = UI.utils.parseOptions($(item).attr('data-am-accordion'));
+	    var $title = $(item).find(selector.title);
+
+	    $title.on('click.accordion.amui', function() {
+	      var $collapse = $(this).next(selector.body);
+	      var $parent = $(this).parent(selector.item);
+	      var data = $collapse.data('amui.collapse');
+
+	      if ($parent.is(selector.disabled)) {
+	        return;
+	      }
+
+	      $parent.toggleClass('am-active');
+
+	      if (!data) {
+	        $collapse.collapse();
+	      } else {
+	        $collapse.collapse('toggle');
+	      }
+
+	      !options.multiple &&
+	      $(item).children('.am-active').
+	        not($parent).not(selector.disabled).removeClass('am-active').
+	        find(selector.body + '.am-in').collapse('close');
+	    });
+	  });
+	}
+
+	// Init on DOM ready
+	$(accordionInit);
+
+	module.exports = UI.accordion = {
+	  VERSION: '2.1.0',
+	  init: accordionInit
+	};
+
+
+/***/ },
+/* 36 */
+/***/ function(module, exports) {
+
+	'use strict';
+
+	module.exports = {
+	  VERSION: '2.0.1'
+	};
+
+
+/***/ },
+/* 37 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	function duoshuoInit() {
+	  var $dsThread = $('.ds-thread');
+	  var dsShortName = $dsThread.parent('[data-am-widget="duoshuo"]').
+	    attr('data-ds-short-name');
+	  var dsSrc = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
+	    '//static.duoshuo.com/embed.js';
+
+	  if (!$dsThread.length || !dsShortName) {
+	    return;
+	  }
+
+	  window.duoshuoQuery = {
+	    short_name: dsShortName
+	  };
+
+	  // 已经有多说脚本
+	  if ($('script[src="' + dsSrc + '"]').length) {
+	    return;
+	  }
+
+	  var $dsJS = $('<script>', {
+	    async: true,
+	    type: 'text/javascript',
+	    src: dsSrc,
+	    charset: 'utf-8'
+	  });
+
+	  $('body').append($dsJS);
+	}
+
+	$(window).on('load', duoshuoInit);
+
+	module.exports = UI.duoshuo = {
+	  VERSION: '2.0.1',
+	  init: duoshuoInit
+	};
+
+
+/***/ },
+/* 38 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(20);
+
+	/**
+	 * Is Images zoomable
+	 * @return {Boolean}
+	 */
+	$.isImgZoomAble = function(element) {
+	  var t = new Image();
+	  t.src = element.src;
+
+	  var zoomAble = ($(element).width() < t.width);
+
+	  if (zoomAble) {
+	    $(element).closest('.am-figure').addClass('am-figure-zoomable');
+	  }
+
+	  return zoomAble;
+	};
+
+	function figureInit() {
+	  $('.am-figure').each(function(i, item) {
+	    var options = UI.utils.parseOptions($(item).attr('data-am-figure'));
+	    var $item = $(item);
+	    var data;
+
+	    if (options.pureview) {
+	      if (options.pureview === 'auto') {
+	        var zoomAble = $.isImgZoomAble($item.find('img')[0]);
+	        zoomAble && $item.pureview();
+	      } else {
+	        $item.addClass('am-figure-zoomable').pureview();
+	      }
+	    }
+
+	    data = $item.data('amui.pureview');
+
+	    if (data) {
+	      $item.on('click', ':not(img)', function() {
+	        data.open(0);
+	      });
+	    }
+	  });
+	}
+
+	$(window).on('load', figureInit);
+
+	module.exports = UI.figure = {
+	  VERSION: '2.0.3',
+	  init: figureInit
+	};
+
+
+/***/ },
+/* 39 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(15);
+	var addToHS = __webpack_require__(4);
+	var cookie = __webpack_require__(31);
+
+	function footerInit() {
+	  // modal mode
+	  $('.am-footer-ysp').on('click', function() {
+	    $('#am-footer-modal').modal();
+	  });
+
+	  var options = UI.utils.parseOptions($('.am-footer').data('amFooter'));
+	  options.addToHS && addToHS();
+
+	  // switch mode
+	  // switch to desktop
+	  $('[data-rel="desktop"]').on('click', function(e) {
+	    e.preventDefault();
+	    if (window.AMPlatform) { // front end
+	      window.AMPlatform.util.goDesktop();
+	    } else { // back end
+	      cookie.set('allmobilize', 'desktop', '', '/');
+	      window.location = window.location;
+	    }
+	  });
+	}
+
+	$(footerInit);
+
+	module.exports = UI.footer = {
+	  VERSION: '3.1.2',
+	  init: footerInit
+	};
+
+
+/***/ },
+/* 40 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(20);
+
+	function galleryInit() {
+	  var $gallery = $('[data-am-widget="gallery"]');
+
+	  $gallery.each(function() {
+	    var options = UI.utils.parseOptions($(this).attr('data-am-gallery'));
+
+	    if (options.pureview) {
+	      (typeof options.pureview === 'object') ?
+	        $(this).pureview(options.pureview) : $(this).pureview();
+	    }
+	  });
+	}
+
+	$(galleryInit);
+
+	module.exports = UI.gallery = {
+	  VERSION: '3.0.0',
+	  init: galleryInit
+	};
+
+
+/***/ },
+/* 41 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(23);
+
+	function goTopInit() {
+	  var $goTop = $('[data-am-widget="gotop"]');
+	  var $fixed = $goTop.filter('.am-gotop-fixed');
+	  var $win = $(window);
+
+	  if ($goTop.data('init')) {
+	    return;
+	  }
+
+	  $goTop.find('a').on('click', function(e) {
+	    e.preventDefault();
+	    $win.smoothScroll();
+	  });
+
+	  function checkPosition() {
+	    $fixed[($win.scrollTop() > 50 ? 'add' : 'remove') + 'Class']('am-active');
+	  }
+
+	  checkPosition();
+
+	  $win.on('scroll.gotop.amui', UI.utils.debounce(checkPosition, 100));
+
+	  $goTop.data('init', true);
+	}
+
+	$(goTopInit);
+
+	module.exports = UI.gotop = {
+	  VERSION: '4.0.2',
+	  init: goTopInit
+	};
+
+
+/***/ },
+/* 42 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	function headerInit() {
+	  $('[data-am-widget="header"]').each(function() {
+	    if ($(this).hasClass('am-header-fixed')) {
+	      $('body').addClass('am-with-fixed-header');
+	      return false;
+	    }
+	  });
+	}
+
+	$(headerInit);
+
+	module.exports = UI.header = {
+	  VERSION: '2.0.0',
+	  init: headerInit
+	};
+
+
+/***/ },
+/* 43 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var UI = __webpack_require__(2);
+
+	module.exports = UI.intro = {
+	  VERSION: '4.0.2',
+	  init: function() {}
+	};
+
+
+/***/ },
+/* 44 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var UI = __webpack_require__(2);
+
+	module.exports = UI.listNews = {
+	  VERSION: '4.0.0',
+	  init: function() {}
+	};
+
+
+/***/ },
+/* 45 */
+/***/ function(module, exports, __webpack_require__) {
+
+	/* jshint strict: false, maxlen: 200 */
+	/* global BMap */
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	function addMapApi(callback) {
+	  var $mapApi0 = $('<script />', {
+	    id: 'am-map-api-0'
+	  });
+
+	  $('body').append($mapApi0);
+
+	  $mapApi0.on('load', function() {
+	    console.log('load');
+	    var $mapApi1 = $('<script/>', {
+	      id: 'am-map-api-1'
+	    });
+
+	    $('body').append($mapApi1);
+
+	    $mapApi1.on('load', function() {
+	      var script = document.createElement('script');
+	      script.textContent = '(' + callback.toString() + ')();';
+	      $('body')[0].appendChild(script);
+	    }).attr('src', 'http://api.map.baidu.com/getscript' +
+	      '?type=quick&file=feature' +
+	      '&ak=WVAXZ05oyNRXS5egLImmentg&t=20140109092002');
+	  }).attr('src', 'http://api.map.baidu.com/getscript' +
+	  '?type=quick&file=api&ak=WVAXZ05oyNRXS5egLImmentg&t=20140109092002');
+
+	  // jQuery 中 `load` 事件触发有问题,动态设置 src 属性才会触发 `load` 事件
+	  // $mapApi0 = $('<script />', {src: 'xxx'}); 这样的写法在 Zepto.js 中则没有问题
+	}
+
+	function addBdMap() {
+	  // 如果使用 $ 选择符,minify 以后会报错: $ is undefined
+	  // 即使传入 $ 也无效,改为使用原生方法
+	  // 这个函数作为 callback 会插入到 body 以后才执行,应该是 $ 引用错误导致
+	  var content = document.querySelector('.am-map');
+	  var defaultLng = 116.331398; // 经度默认值
+	  var defaultLat = 39.897445;  // 纬度默认值
+	  var name = content.getAttribute('data-name');
+	  var address = content.getAttribute('data-address');
+	  var lng = content.getAttribute('data-longitude') || defaultLng;
+	  var lat = content.getAttribute('data-latitude') || defaultLat;
+	  var setZoom = content.getAttribute('data-setZoom') || 17;
+	  var icon = content.getAttribute('data-icon');
+
+	  var map = new BMap.Map('bd-map');
+
+	  // 实例化一个地理坐标点
+	  var point = new BMap.Point(lng, lat);
+
+	  // 设初始化地图, options: 3-18
+	  map.centerAndZoom(point, setZoom);
+
+	  // 添加地图缩放控件
+	  if (content.getAttribute('data-zoomControl')) {
+	    map.addControl(new BMap.ZoomControl());
+	  }
+
+	  // 添加比例尺控件
+	  if (content.getAttribute('data-scaleControl')) {
+	    map.addControl(new BMap.ScaleControl());
+	  }
+
+	  // 创建标准与自定义 icon
+	  var marker = new BMap.Marker(point);
+	  if (icon) {
+	    marker.setIcon(new BMap.Icon(icon, new BMap.Size(40, 40)));
+	  }
+
+	  var opts = {
+	    width: 200,     // 信息窗口宽度
+	    // height: 'auto',     // 信息窗口高度
+	    title: name // 信息窗口标题
+	  };
+
+	  // 创建信息窗口对象
+	  var infoWindow = new BMap.InfoWindow('地址:' + address, opts);
+
+	  // 创建地址解析器实例
+	  var myGeo = new BMap.Geocoder();
+
+	  // 判断有没有使用经纬度
+	  if (lng == defaultLng && lat == defaultLat) {
+	    // 使用地址反解析来设置地图
+	    // 将地址解析结果显示在地图上,并调整地图视野
+	    myGeo.getPoint(address, function(point) {
+	      if (point) {
+	        map.centerAndZoom(point, setZoom);
+	        marker.setPosition(point);
+	        map.addOverlay(marker);
+	        map.openInfoWindow(infoWindow, point); // 开启信息窗口
+	      }
+	    }, '');
+
+	  } else {
+	    // 使用经纬度来设置地图
+	    myGeo.getLocation(point, function(result) {
+	      map.centerAndZoom(point, setZoom);
+	      marker.setPosition(point);
+	      map.addOverlay(marker);
+	      if (address) {
+	        map.openInfoWindow(infoWindow, point); // 开启信息窗口
+	      } else {
+	        map.openInfoWindow(new BMap.InfoWindow(address, opts), point); // 开启信息窗口
+	      }
+	    });
+	  }
+	}
+
+	var mapInit = function() {
+	  $('.am-map').length && addMapApi(addBdMap);
+	};
+
+	$(mapInit);
+
+	module.exports = UI.map = {
+	  VERSION: '2.0.2',
+	  init: mapInit
+	};
+
+
+/***/ },
+/* 46 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	function mechatInit() {
+	  if (!$('#mechat').length) {
+	    return;
+	  }
+
+	  var $mechat = $('[data-am-widget="mechat"]');
+	  var unitid = $mechat.data('am-mechat-unitid');
+	  var $mechatData = $('<script>', {
+	    charset: 'utf-8',
+	    src: 'http://mechatim.com/js/unit/button.js?id=' + unitid
+	  });
+
+	  $('body').append($mechatData);
+	}
+
+	// Lazy load
+	$(window).on('load', mechatInit);
+
+	module.exports = UI.mechat = {
+	  VERSION: '2.0.1',
+	  init: mechatInit
+	};
+
+
+/***/ },
+/* 47 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var IScroll = __webpack_require__(14);
+	__webpack_require__(16);
+	__webpack_require__(7);
+
+	var menuInit = function() {
+	  var $menus = $('[data-am-widget="menu"]');
+
+	  $menus.find('.am-menu-nav .am-parent > a').on('click', function(e) {
+	    e.preventDefault();
+	    var $clicked = $(this);
+	    var $parent = $clicked.parent();
+	    var $subMenu = $clicked.next('.am-menu-sub');
+
+	    $parent.toggleClass('am-open');
+	    $subMenu.collapse('toggle');
+	    $parent.siblings('.am-parent').removeClass('am-open')
+	      .children('.am-menu-sub.am-in').collapse('close');
+	  });
+
+	  // Dropdown/slideDown menu
+	  $menus.
+	    filter('[data-am-menu-collapse]').
+	    find('> .am-menu-toggle').
+	    on('click', function(e) {
+	      e.preventDefault();
+	      var $this = $(this);
+	      var $nav = $this.next('.am-menu-nav');
+
+	      $this.toggleClass('am-active');
+
+	      $nav.collapse('toggle');
+	    });
+
+	  // OffCanvas menu
+	  $menus.
+	    filter('[data-am-menu-offcanvas]').
+	    find('> .am-menu-toggle').
+	    on('click', function(e) {
+	      e.preventDefault();
+	      var $this = $(this);
+	      var $nav = $this.next('.am-offcanvas');
+
+	      $this.toggleClass('am-active');
+
+	      $nav.offCanvas('open');
+	    });
+
+	  // Close offCanvas when link clicked
+	  var autoCloseOffCanvas = '.am-offcanvas[data-dismiss-on="click"]';
+	  var $autoCloseOffCanvas = $(autoCloseOffCanvas);
+
+	  $autoCloseOffCanvas.find('a').not('.am-parent>a').on('click', function(e) {
+	    $(this).parents(autoCloseOffCanvas).offCanvas('close');
+	  });
+
+	  // one theme
+	  $menus.filter('.am-menu-one').each(function(index) {
+	    var $this = $(this);
+	    var $wrap = $('<div class="am-menu-nav-sub-wrap"></div>');
+	    var allWidth = 0;
+	    var $nav = $this.find('.am-menu-nav');
+	    var $navTopItem = $nav.children('li');
+	    var prevIndex;
+
+	    $navTopItem.filter('.am-parent').each(function(index) {
+	      $(this).attr('data-rel', '#am-menu-sub-' + index);
+	      $(this).
+	        find('.am-menu-sub').
+	        attr('id', 'am-menu-sub-' + index).
+	        appendTo($wrap);
+	    });
+
+	    $this.append($wrap);
+
+	    $nav.wrap('<div class="am-menu-nav-wrap" id="am-menu-' + index + '">');
+
+	    // $navTopItem.eq(0).addClass('am-active');
+
+	    // 计算出所有 li 宽度
+	    $navTopItem.each(function(i) {
+	      allWidth += parseFloat($(this).css('width'));
+	    });
+
+	    $nav.width(allWidth);
+
+	    var menuScroll = new IScroll('#am-menu-' + index, {
+	      eventPassthrough: true,
+	      scrollX: true,
+	      scrollY: false,
+	      preventDefault: false
+	    });
+
+	    $navTopItem.on('click', function() {
+	      var $clicked = $(this);
+	      $clicked.addClass('am-active').siblings().removeClass('am-active');
+
+	      $wrap.find('.am-menu-sub.am-in').collapse('close');
+
+	      if ($clicked.is('.am-parent')) {
+	        !$clicked.hasClass('.am-open') &&
+	        $wrap.find($clicked.attr('data-rel')).collapse('open');
+	      } else {
+	        $clicked.siblings().removeClass('am-open');
+	      }
+
+	      // 第一次调用,没有prevIndex
+	      if (prevIndex === undefined) {
+	        prevIndex = $(this).index() ? 0 : 1;
+	      }
+
+	      // 判断方向
+	      var dir = $(this).index() > prevIndex;
+	      var target = $(this)[dir ? 'next' : 'prev']();
+
+	      // 点击的按钮,显示一半
+	      var offset = target.offset() || $(this).offset();
+	      var within = $this.offset();
+
+	      // 父类左边距
+	      var listOffset;
+	      var parentLeft = parseInt($this.css('padding-left'));
+
+	      if (dir ? offset.left + offset.width > within.left + within.width :
+	        offset.left < within.left) {
+	        listOffset = $nav.offset();
+	        menuScroll.scrollTo(dir ?
+	        within.width - offset.left + listOffset.left -
+	        offset.width - parentLeft :
+	        listOffset.left - offset.left, 0, 400);
+	      }
+
+	      prevIndex = $(this).index();
+
+	    });
+
+	    $this.on('touchmove', function(event) {
+	      event.preventDefault();
+	    });
+	  });
+	};
+
+	$(menuInit);
+
+	module.exports = UI.menu = {
+	  VERSION: '4.0.3',
+	  init: menuInit
+	};
+
+
+/***/ },
+/* 48 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var share = __webpack_require__(25);
+	var QRCode = __webpack_require__(26);
+	__webpack_require__(15);
+
+	function navbarInit() {
+	  var $navBar = $('[data-am-widget="navbar"]');
+
+	  if (!$navBar.length) {
+	    return;
+	  }
+
+	  var $win = $(window);
+	  var $body = $('body');
+	  var $navBarNav = $navBar.find('.am-navbar-nav');
+	  var $navItems = $navBar.find('li');
+	  var navItemsCounter = $navItems.length;
+	  var configItems = $navBarNav.attr('class') &&
+	    parseInt($navBarNav.attr('class').
+	      match(/am-avg-sm-(\d+)/)[1]) || 3;
+	  var navMinWidth = 60; // 每个 li 最小宽度
+	  var offsetWidth = 16;
+	  var $share = $navItems.filter('[data-am-navbar-share]');
+	  var $qrcode = $navItems.filter('[data-am-navbar-qrcode]');
+	  var activeStatus = 'am-active';
+	  var $moreActions = $('<ul class="am-navbar-actions"></ul>', {
+	    id: UI.utils.generateGUID('am-navbar-actions')
+	  });
+	  var $moreLink = $('<li class="am-navbar-labels am-navbar-more">' +
+	  '<a href="javascript: void(0);">' +
+	  '<span class="am-icon-angle-up"></span>' +
+	  '<span class="am-navbar-label">更多</span></a></li>');
+
+	  // 如果有 Fix 的工具栏则设置 body 的 padding-bottom
+	  if ($navBar.css('position') == 'fixed') {
+	    $body.addClass('am-with-fixed-navbar');
+	  }
+
+	  if ($qrcode.length) {
+	    var qrId = 'am-navbar-qrcode';
+	    $qrModal = $('#' + qrId);
+
+	    if (!$qrModal.length) {
+	      var qrImg = $qrcode.attr('data-am-navbar-qrcode');
+	      var $qrModal = $('<div class="am-modal am-modal-no-btn" id="">' +
+	      '<div class="am-modal-dialog">' +
+	      '<div class="am-modal-bd"></div></div>' +
+	      '</div>', {
+	        id: qrId
+	      });
+	      var $qrContainer = $qrModal.find('.am-modal-bd');
+
+	      // 判断上传自定义的二维码没有,否则生成二维码
+	      if (qrImg) {
+	        $qrContainer.html('<img src="' + qrImg + '"/>');
+	      } else {
+	        var qrnode = new QRCode({
+	          render: 'canvas',
+	          correctLevel: 0,
+	          text: window.location.href,
+	          width: 200,
+	          height: 200,
+	          background: '#fff',
+	          foreground: '#000'
+	        });
+	        $qrContainer.html(qrnode);
+	      }
+
+	      $body.append($qrModal);
+	    }
+
+	    $qrcode.on('click', function(e) {
+	      e.preventDefault();
+	      $qrModal.modal();
+	    });
+	  }
+
+	  if (navItemsCounter > configItems && navItemsCounter > calcSuiteItems()) {
+	    initActions();
+	  }
+
+	  // console.log('NavItems: %d, config: %d, best: %d',
+	  //    navItemsCounter, configItems, calcSuiteItems());
+
+	  function initActions() {
+	    $navBarNav.append($moreLink);
+
+	    $navBarNav.
+	      find('li').
+	      not('.am-navbar-more').
+	      slice(calcSuiteItems() - 1).
+	      appendTo($moreActions);
+
+	    // Append more actions
+	    $navBar.append($moreActions);
+	  }
+
+	  function checkNavBarItems() {
+	    if (calcSuiteItems() >= navItemsCounter) {
+	      // 显示所有链接,隐藏 more
+	      $moreLink.hide();
+	      $moreActions.find('li').insertBefore($moreLink);
+	      return;
+	    }
+
+	    !$navBar.find('.am-navbar-actions').length && initActions();
+
+	    $moreLink.show();
+
+	    if ($navBarNav.find('li').length < calcSuiteItems()) {
+	      $moreActions.find('li').
+	        slice(0, calcSuiteItems() - $navBarNav.find('li').length).
+	        insertBefore($moreLink);
+	    } else if ($navBarNav.find('li').length > calcSuiteItems()) {
+	      if ($moreActions.find('li').length) {
+	        $navBarNav.find('li').not($moreLink).slice(calcSuiteItems() - 1).
+	          insertBefore($moreActions.find('li').first());
+	      } else {
+	        $navBarNav.find('li').not($moreLink).slice(calcSuiteItems() - 1).
+	          appendTo($moreActions);
+	      }
+	    }
+	  }
+
+	  /**
+	   * 计算最适合显示的条目个数
+	   * @returns {number}
+	   */
+	  function calcSuiteItems() {
+	    return Math.floor(($win.width() - offsetWidth) / navMinWidth);
+	  }
+
+	  $navBar.on('click.navbar.amui', '.am-navbar-more', function(e) {
+	    e.preventDefault();
+
+	    $moreLink[$moreActions.hasClass(activeStatus) ?
+	      'removeClass' : 'addClass'](activeStatus);
+
+	    $moreActions.toggleClass(activeStatus);
+	  });
+
+	  if ($share.length) {
+	    $share.on('click.navbar.amui', function(e) {
+	      e.preventDefault();
+	      share.toggle();
+	    });
+	  }
+
+	  $win.on('resize.navbar.amui orientationchange.navbar.amui',
+	    UI.utils.debounce(checkNavBarItems, 150));
+	}
+
+	// DOMContent ready
+	$(navbarInit);
+
+	module.exports = UI.navbar = {
+	  VERSION: '2.0.2',
+	  init: navbarInit
+	};
+
+
+/***/ },
+/* 49 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var UI = __webpack_require__(2);
+
+	module.exports = UI.pagination = {
+	  VERSION: '3.0.1'
+	};
+
+
+/***/ },
+/* 50 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	var IScroll = __webpack_require__(14);
+	__webpack_require__(20);
+
+	/**
+	 * 表格滚动
+	 * @param {number} index ID 标识,多个 paragraph 里面多个 table
+	 */
+	$.fn.scrollTable = function(index) {
+	  var $this = $(this);
+	  var $parent;
+
+	  $this.wrap('<div class="am-paragraph-table-container" ' +
+	  'id="am-paragraph-table-' + index + '">' +
+	  '<div class="am-paragraph-table-scroller"></div></div>');
+
+	  $parent = $this.parent();
+	  $parent.width($this.width());
+	  $parent.height($this.height());
+
+	  new IScroll('#am-paragraph-table-' + index, {
+	    eventPassthrough: true,
+	    scrollX: true,
+	    scrollY: false,
+	    preventDefault: false
+	  });
+	};
+
+	function paragraphInit() {
+	  var $paragraph = $('[data-am-widget="paragraph"]');
+
+	  $paragraph.each(function(index) {
+	    var $this = $(this);
+	    var options = UI.utils.parseOptions($this.attr('data-am-paragraph'));
+	    var $index = index;
+
+	    if (options.pureview) {
+	      $this.pureview();
+	    }
+
+	    if (options.tableScrollable) {
+	      $this.find('table').each(function(index) {
+	        if ($(this).width() > $(window).width()) {
+	          $(this).scrollTable($index + '-' + index);
+	        }
+	      });
+	    }
+	  });
+	}
+
+	$(window).on('load', paragraphInit);
+
+	module.exports = UI.paragraph = {
+	  VERSION: '2.0.1',
+	  init: paragraphInit
+	};
+
+
+/***/ },
+/* 51 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(11);
+
+	function sliderInit() {
+	  var $sliders = $('[data-am-widget="slider"]');
+	  $sliders.not('.am-slider-manual').each(function(i, item) {
+	    var options = UI.utils.parseOptions($(item).attr('data-am-slider'));
+	    $(item).flexslider(options);
+	  });
+	}
+
+	$(sliderInit);
+
+	module.exports = UI.slider = {
+	  VERSION: '3.0.1',
+	  init: sliderInit
+	};
+
+
+/***/ },
+/* 52 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+	__webpack_require__(28);
+
+	function tabsInit() {
+	  $('[data-am-widget="tabs"]').each(function() {
+	    var options = $(this).data('amTabsNoswipe') ? {noSwipe: 1} : {};
+	    $(this).tabs(options);
+	  });
+	}
+
+	$(tabsInit);
+
+	module.exports = UI.tab = {
+	  VERSION: '4.0.1',
+	  init: tabsInit
+	};
+
+
+/***/ },
+/* 53 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var UI = __webpack_require__(2);
+
+	module.exports = UI.titlebar = {
+	  VERSION: '4.0.1'
+	};
+
+
+/***/ },
+/* 54 */
+/***/ function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var $ = __webpack_require__(1);
+	var UI = __webpack_require__(2);
+
+	var isWeChat = window.navigator.userAgent.indexOf('MicroMessenger') > -1;
+
+	/* global wx,alert */
+
+	function appendWeChatSDK(callback) {
+	  var $weChatSDK = $('<script/>', {
+	    id: 'wechat-sdk'
+	  });
+
+	  $('body').append($weChatSDK);
+
+	  $weChatSDK.on('load', function() {
+	    callback && callback();
+	  }).attr('src', 'http://res.wx.qq.com/open/js/jweixin-1.0.0.js');
+	}
+
+	function payHandler() {
+	  var $paymentBtn = $('[data-am-widget="wechatpay"]');
+
+	  if (!isWeChat) {
+	    $paymentBtn.hide();
+	    return false;
+	  }
+
+	  $paymentBtn.on('click', '.am-wechatpay-btn', function(e) {
+	    e.preventDefault();
+	    var options = UI.utils.parseOptions($(this).parent().data('wechatPay'));
+	    // console.log(options);
+	    // alert('pay button clicked');
+	    if (!window.wx) {
+	      alert('没有微信 JS SDK');
+	      return;
+	    }
+
+	    wx.checkJsApi({
+	      jsApiList: ['chooseWXPay'],
+	      success: function(res) {
+	        if (res.checkResult.chooseWXPay) {
+	          wx.chooseWXPay(options);
+	        } else {
+	          alert('微信版本不支持支付接口或没有开启!');
+	        }
+	      },
+	      fail: function() {
+	        alert('调用 checkJsApi 接口时发生错误!');
+	      }
+	    });
+	  });
+	}
+
+	var payInit = payHandler;
+
+	// Init on DOM ready
+	$(payInit);
+
+	module.exports = UI.pay = {
+	  VERSION: '1.0.0',
+	  init: payInit
+	};
+
+
+/***/ }
+/******/ ])
+});
+;

File diff suppressed because it is too large
+ 1 - 0
Public/js/amazeui.min.js


File diff suppressed because it is too large
+ 52 - 0
Public/js/amazeui.widgets.helper.js


File diff suppressed because it is too large
+ 1 - 0
Public/js/amazeui.widgets.helper.min.js


+ 14 - 0
Public/js/app.js

@@ -0,0 +1,14 @@
+(function($) {
+  'use strict';
+
+  $(function() {
+    var $fullText = $('.admin-fullText');
+    $('#admin-fullscreen').on('click', function() {
+      $.AMUI.fullscreen.toggle();
+    });
+
+    $(document).on($.AMUI.fullscreen.raw.fullscreenchange, function() {
+      $fullText.text($.AMUI.fullscreen.isFullscreen ? '退出全屏' : '开启全屏');
+    });
+  });
+})(jQuery);

File diff suppressed because it is too large
+ 26 - 0
Public/js/handlebars.min.js


File diff suppressed because it is too large
+ 1 - 0
Public/js/jquery.min.js


+ 12 - 0
Public/templates/footer.html

@@ -0,0 +1,12 @@
+	<footer class="admin-content-footer">
+      <hr>
+      <p class="am-padding-left">Copyright © 2016</p>
+    </footer>
+  </div>
+  <!-- content end -->
+
+</div>
+
+<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
+</body>
+</html>

+ 51 - 0
Public/templates/header.html

@@ -0,0 +1,51 @@
+<!doctype html>
+<html class="no-js fixed-layout">
+    <head>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <title>花园后台管理</title>
+        <meta name="description" content="花园后台管理">
+        <meta name="keywords" content="index">
+        <meta name="viewport" content="width=device-width, initial-scale=1">
+        <meta name="renderer" content="webkit">
+        <meta http-equiv="Cache-Control" content="no-siteapp" />
+        <link rel="icon" type="image/png" href="__ROOT__/Public/i/favicon.png">
+        <link rel="apple-touch-icon-precomposed" href="__ROOT__/Public/i/app-icon72x72@2x.png">
+
+    <import type="css" file="css.amazeui"/>
+    <import type="css" file="css.admin"/>
+    <import type="css" file="css.app"/>
+    <load href="__PUBLIC__/js/jquery.min.js"/>
+    <import file="js.amazeui"/>
+    <import file="js.app"/> 
+
+</head>
+<body>
+
+    <header class="am-topbar am-topbar-inverse admin-header">
+        <div class="am-topbar-brand">
+            <strong>花园后台管理</strong>
+        </div>
+
+        <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>
+
+        <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
+
+            <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list">
+                <li class="am-dropdown" data-am-dropdown>
+                    <a class="am-dropdown-toggle" data-am-dropdown-toggle href="javascript:;">
+                        <span class="am-icon-users"></span> ({$Think.session.admin.realname}) <span class="am-icon-caret-down"></span>
+                    </a>
+                    <ul class="am-dropdown-content">
+                        <li><a href="#"><span class="am-icon-user"></span> 资料</a></li>
+                        <li><a href="#"><span class="am-icon-cog"></span> 设置</a></li>
+                        <li><a href="__APP__/Home/Login/outLogin"><span class="am-icon-power-off"></span> 退出</a></li>
+                    </ul>
+                </li>
+                <li class="am-hide-sm-only"><a href="javascript:;" id="admin-fullscreen"><span class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>
+            </ul>
+        </div>
+    </header>
+
+
+    <div class="am-cf admin-main">

+ 38 - 0
Public/templates/menu.html

@@ -0,0 +1,38 @@
+<!-- sidebar start -->
+<div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
+    <div class="am-offcanvas-bar admin-offcanvas-bar">
+        <ul class="am-list admin-sidebar-list">
+			<foreach name="menu" key="k" item="v">
+				<if condition="!isset($v['children'])"> 
+            		<li><a href="__ROOT__/index.php/{$v.url}"><span class="am-icon-{$v.icon}"></span> {$v.name}</a></li>
+            	<else/>
+            		<li class="admin-parent">
+            		<a class="am-cf" data-am-collapse="{target: '#collapse-nav{$v.id}'}"><span class="am-icon-{$v.icon}"></span> {$v.name}<span class="am-icon-angle-right am-fr am-margin-right"></span></a>
+            		<ul class="am-list am-collapse admin-sidebar-sub" id="collapse-nav{$v.id}">
+            		<foreach name="v.children" key="key" item="val">
+	                    <li>
+	                    	<a href="__ROOT__/index.php/{$val.url}"><span class="am-icon-{$val.url}"></span> {$val.name}
+	                    	<if condition="$val.ispush eq 1"><span class="am-icon-star am-fr am-margin-right admin-icon-yellow"></span></if>
+	                    	</a>
+	                    </li>
+	                </foreach>	
+                	</ul>
+            		</li>
+            	</if>
+            </foreach>
+            
+            
+        </ul>
+
+        <div class="am-panel am-panel-default admin-sidebar-panel">
+            <div class="am-panel-bd">
+                <p><span class="am-icon-bookmark"></span> 公告</p>
+                <p>时光静好,与君语;细水流年,与君同。</p>
+            </div>
+        </div>
+    </div>
+</div>
+<!-- sidebar end -->
+
+<!-- content start -->
+<div class="admin-content">

+ 1550 - 0
ThinkPHP/Common/functions.php

@@ -0,0 +1,1550 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+/**
+ * Think 系统函数库
+ */
+
+/**
+ * 获取和设置配置参数 支持批量定义
+ * @param string|array $name 配置变量
+ * @param mixed $value 配置值
+ * @param mixed $default 默认值
+ * @return mixed
+ */
+function C($name=null, $value=null,$default=null) {
+    static $_config = array();
+    // 无参数时获取所有
+    if (empty($name)) {
+        return $_config;
+    }
+    // 优先执行设置获取或赋值
+    if (is_string($name)) {
+        if (!strpos($name, '.')) {
+            $name = strtoupper($name);
+            if (is_null($value))
+                return isset($_config[$name]) ? $_config[$name] : $default;
+            $_config[$name] = $value;
+            return null;
+        }
+        // 二维数组设置和获取支持
+        $name = explode('.', $name);
+        $name[0]   =  strtoupper($name[0]);
+        if (is_null($value))
+            return isset($_config[$name[0]][$name[1]]) ? $_config[$name[0]][$name[1]] : $default;
+        $_config[$name[0]][$name[1]] = $value;
+        return null;
+    }
+    // 批量设置
+    if (is_array($name)){
+        $_config = array_merge($_config, array_change_key_case($name,CASE_UPPER));
+        return null;
+    }
+    return null; // 避免非法参数
+}
+
+/**
+ * 加载配置文件 支持格式转换 仅支持一级配置
+ * @param string $file 配置文件名
+ * @param string $parse 配置解析方法 有些格式需要用户自己解析
+ * @return array
+ */
+function load_config($file,$parse=CONF_PARSE){
+    $ext  = pathinfo($file,PATHINFO_EXTENSION);
+    switch($ext){
+        case 'php':
+            return include $file;
+        case 'ini':
+            return parse_ini_file($file);
+        case 'yaml':
+            return yaml_parse_file($file);
+        case 'xml': 
+            return (array)simplexml_load_file($file);
+        case 'json':
+            return json_decode(file_get_contents($file), true);
+        default:
+            if(function_exists($parse)){
+                return $parse($file);
+            }else{
+                E(L('_NOT_SUPPORT_').':'.$ext);
+            }
+    }
+}
+
+/**
+ * 解析yaml文件返回一个数组
+ * @param string $file 配置文件名
+ * @return array
+ */
+if (!function_exists('yaml_parse_file')) {
+    function yaml_parse_file($file) {
+        vendor('spyc.Spyc');
+        return Spyc::YAMLLoad($file);
+    }
+}
+
+/**
+ * 抛出异常处理
+ * @param string $msg 异常消息
+ * @param integer $code 异常代码 默认为0
+ * @throws Think\Exception
+ * @return void
+ */
+function E($msg, $code=0) {
+    throw new Think\Exception($msg, $code);
+}
+
+/**
+ * 记录和统计时间(微秒)和内存使用情况
+ * 使用方法:
+ * <code>
+ * G('begin'); // 记录开始标记位
+ * // ... 区间运行代码
+ * G('end'); // 记录结束标签位
+ * echo G('begin','end',6); // 统计区间运行时间 精确到小数后6位
+ * echo G('begin','end','m'); // 统计区间内存使用情况
+ * 如果end标记位没有定义,则会自动以当前作为标记位
+ * 其中统计内存使用需要 MEMORY_LIMIT_ON 常量为true才有效
+ * </code>
+ * @param string $start 开始标签
+ * @param string $end 结束标签
+ * @param integer|string $dec 小数位或者m
+ * @return mixed
+ */
+function G($start,$end='',$dec=4) {
+    static $_info       =   array();
+    static $_mem        =   array();
+    if(is_float($end)) { // 记录时间
+        $_info[$start]  =   $end;
+    }elseif(!empty($end)){ // 统计时间和内存使用
+        if(!isset($_info[$end])) $_info[$end]       =  microtime(TRUE);
+        if(MEMORY_LIMIT_ON && $dec=='m'){
+            if(!isset($_mem[$end])) $_mem[$end]     =  memory_get_usage();
+            return number_format(($_mem[$end]-$_mem[$start])/1024);
+        }else{
+            return number_format(($_info[$end]-$_info[$start]),$dec);
+        }
+
+    }else{ // 记录时间和内存使用
+        $_info[$start]  =  microtime(TRUE);
+        if(MEMORY_LIMIT_ON) $_mem[$start]           =  memory_get_usage();
+    }
+    return null;
+}
+
+/**
+ * 获取和设置语言定义(不区分大小写)
+ * @param string|array $name 语言变量
+ * @param mixed $value 语言值或者变量
+ * @return mixed
+ */
+function L($name=null, $value=null) {
+    static $_lang = array();
+    // 空参数返回所有定义
+    if (empty($name))
+        return $_lang;
+    // 判断语言获取(或设置)
+    // 若不存在,直接返回全大写$name
+    if (is_string($name)) {
+        $name   =   strtoupper($name);
+        if (is_null($value)){
+            return isset($_lang[$name]) ? $_lang[$name] : $name;
+        }elseif(is_array($value)){
+            // 支持变量
+            $replace = array_keys($value);
+            foreach($replace as &$v){
+                $v = '{$'.$v.'}';
+            }
+            return str_replace($replace,$value,isset($_lang[$name]) ? $_lang[$name] : $name);        
+        }
+        $_lang[$name] = $value; // 语言定义
+        return null;
+    }
+    // 批量定义
+    if (is_array($name))
+        $_lang = array_merge($_lang, array_change_key_case($name, CASE_UPPER));
+    return null;
+}
+
+/**
+ * 添加和获取页面Trace记录
+ * @param string $value 变量
+ * @param string $label 标签
+ * @param string $level 日志级别
+ * @param boolean $record 是否记录日志
+ * @return void|array
+ */
+function trace($value='[think]',$label='',$level='DEBUG',$record=false) {
+    return Think\Think::trace($value,$label,$level,$record);
+}
+
+/**
+ * 编译文件
+ * @param string $filename 文件名
+ * @return string
+ */
+function compile($filename) {
+    $content    =   php_strip_whitespace($filename);
+    $content    =   trim(substr($content, 5));
+    // 替换预编译指令
+    $content    =   preg_replace('/\/\/\[RUNTIME\](.*?)\/\/\[\/RUNTIME\]/s', '', $content);
+    if(0===strpos($content,'namespace')){
+        $content    =   preg_replace('/namespace\s(.*?);/','namespace \\1{',$content,1);
+    }else{
+        $content    =   'namespace {'.$content;
+    }
+    if ('?>' == substr($content, -2))
+        $content    = substr($content, 0, -2);
+    return $content.'}';
+}
+
+/**
+ * 获取模版文件 格式 资源://模块@主题/控制器/操作
+ * @param string $template 模版资源地址
+ * @param string $layer 视图层(目录)名称
+ * @return string
+ */
+function T($template='',$layer=''){
+
+    // 解析模版资源地址
+    if(false === strpos($template,'://')){
+        $template   =   'http://'.str_replace(':', '/',$template);
+    }
+    $info   =   parse_url($template);
+    $file   =   $info['host'].(isset($info['path'])?$info['path']:'');
+    $module =   isset($info['user'])?$info['user'].'/':MODULE_NAME.'/';
+    $extend =   $info['scheme'];
+    $layer  =   $layer?$layer:C('DEFAULT_V_LAYER');
+
+    // 获取当前主题的模版路径
+    $auto   =   C('AUTOLOAD_NAMESPACE');
+    if($auto && isset($auto[$extend])){ // 扩展资源
+        $baseUrl    =   $auto[$extend].$module.$layer.'/';
+    }elseif(C('VIEW_PATH')){ 
+        // 改变模块视图目录
+        $baseUrl    =   C('VIEW_PATH');
+    }elseif(defined('TMPL_PATH')){ 
+        // 指定全局视图目录
+        $baseUrl    =   TMPL_PATH.$module;
+    }else{
+        $baseUrl    =   APP_PATH.$module.$layer.'/';
+    }
+
+    // 获取主题
+    $theme  =   substr_count($file,'/')<2 ? C('DEFAULT_THEME') : '';
+
+    // 分析模板文件规则
+    $depr   =   C('TMPL_FILE_DEPR');
+    if('' == $file) {
+        // 如果模板文件名为空 按照默认规则定位
+        $file = CONTROLLER_NAME . $depr . ACTION_NAME;
+    }elseif(false === strpos($file, '/')){
+        $file = CONTROLLER_NAME . $depr . $file;
+    }elseif('/' != $depr){
+        $file   =   substr_count($file,'/')>1 ? substr_replace($file,$depr,strrpos($file,'/'),1) : str_replace('/', $depr, $file);
+    }
+    return $baseUrl.($theme?$theme.'/':'').$file.C('TMPL_TEMPLATE_SUFFIX');
+}
+
+/**
+ * 获取输入参数 支持过滤和默认值
+ * 使用方法:
+ * <code>
+ * I('id',0); 获取id参数 自动判断get或者post
+ * I('post.name','','htmlspecialchars'); 获取$_POST['name']
+ * I('get.'); 获取$_GET
+ * </code>
+ * @param string $name 变量的名称 支持指定类型
+ * @param mixed $default 不存在的时候默认值
+ * @param mixed $filter 参数过滤方法
+ * @param mixed $datas 要获取的额外数据源
+ * @return mixed
+ */
+function I($name,$default='',$filter=null,$datas=null) {
+	static $_PUT	=	null;
+	if(strpos($name,'/')){ // 指定修饰符
+		list($name,$type) 	=	explode('/',$name,2);
+	}elseif(C('VAR_AUTO_STRING')){ // 默认强制转换为字符串
+        $type   =   's';
+    }
+    if(strpos($name,'.')) { // 指定参数来源
+        list($method,$name) =   explode('.',$name,2);
+    }else{ // 默认为自动判断
+        $method =   'param';
+    }
+    switch(strtolower($method)) {
+        case 'get'     :   
+        	$input =& $_GET;
+        	break;
+        case 'post'    :   
+        	$input =& $_POST;
+        	break;
+        case 'put'     :   
+        	if(is_null($_PUT)){
+            	parse_str(file_get_contents('php://input'), $_PUT);
+        	}
+        	$input 	=	$_PUT;        
+        	break;
+        case 'param'   :
+            switch($_SERVER['REQUEST_METHOD']) {
+                case 'POST':
+                    $input  =  $_POST;
+                    break;
+                case 'PUT':
+                	if(is_null($_PUT)){
+                    	parse_str(file_get_contents('php://input'), $_PUT);
+                	}
+                	$input 	=	$_PUT;
+                    break;
+                default:
+                    $input  =  $_GET;
+            }
+            break;
+        case 'path'    :   
+            $input  =   array();
+            if(!empty($_SERVER['PATH_INFO'])){
+                $depr   =   C('URL_PATHINFO_DEPR');
+                $input  =   explode($depr,trim($_SERVER['PATH_INFO'],$depr));            
+            }
+            break;
+        case 'request' :   
+        	$input =& $_REQUEST;   
+        	break;
+        case 'session' :   
+        	$input =& $_SESSION;   
+        	break;
+        case 'cookie'  :   
+        	$input =& $_COOKIE;    
+        	break;
+        case 'server'  :   
+        	$input =& $_SERVER;    
+        	break;
+        case 'globals' :   
+        	$input =& $GLOBALS;    
+        	break;
+        case 'data'    :   
+        	$input =& $datas;      
+        	break;
+        default:
+            return null;
+    }
+    if(''==$name) { // 获取全部变量
+        $data       =   $input;
+        $filters    =   isset($filter)?$filter:C('DEFAULT_FILTER');
+        if($filters) {
+            if(is_string($filters)){
+                $filters    =   explode(',',$filters);
+            }
+            foreach($filters as $filter){
+                $data   =   array_map_recursive($filter,$data); // 参数过滤
+            }
+        }
+    }elseif(isset($input[$name])) { // 取值操作
+        $data       =   $input[$name];
+        $filters    =   isset($filter)?$filter:C('DEFAULT_FILTER');
+        if($filters) {
+            if(is_string($filters)){
+                if(0 === strpos($filters,'/')){
+                    if(1 !== preg_match($filters,(string)$data)){
+                        // 支持正则验证
+                        return   isset($default) ? $default : null;
+                    }
+                }else{
+                    $filters    =   explode(',',$filters);                    
+                }
+            }elseif(is_int($filters)){
+                $filters    =   array($filters);
+            }
+            
+            if(is_array($filters)){
+                foreach($filters as $filter){
+                    if(function_exists($filter)) {
+                        $data   =   is_array($data) ? array_map_recursive($filter,$data) : $filter($data); // 参数过滤
+                    }else{
+                        $data   =   filter_var($data,is_int($filter) ? $filter : filter_id($filter));
+                        if(false === $data) {
+                            return   isset($default) ? $default : null;
+                        }
+                    }
+                }
+            }
+        }
+        if(!empty($type)){
+        	switch(strtolower($type)){
+        		case 'a':	// 数组
+        			$data 	=	(array)$data;
+        			break;
+        		case 'd':	// 数字
+        			$data 	=	(int)$data;
+        			break;
+        		case 'f':	// 浮点
+        			$data 	=	(float)$data;
+        			break;
+        		case 'b':	// 布尔
+        			$data 	=	(boolean)$data;
+        			break;
+                case 's':   // 字符串
+                default:
+                    $data   =   (string)$data;
+        	}
+        }
+    }else{ // 变量默认值
+        $data       =    isset($default)?$default:null;
+    }
+    is_array($data) && array_walk_recursive($data,'think_filter');
+    return $data;
+}
+
+function array_map_recursive($filter, $data) {
+    $result = array();
+    foreach ($data as $key => $val) {
+        $result[$key] = is_array($val)
+         ? array_map_recursive($filter, $val)
+         : call_user_func($filter, $val);
+    }
+    return $result;
+ }
+
+/**
+ * 设置和获取统计数据
+ * 使用方法:
+ * <code>
+ * N('db',1); // 记录数据库操作次数
+ * N('read',1); // 记录读取次数
+ * echo N('db'); // 获取当前页面数据库的所有操作次数
+ * echo N('read'); // 获取当前页面读取次数
+ * </code>
+ * @param string $key 标识位置
+ * @param integer $step 步进值
+ * @param boolean $save 是否保存结果
+ * @return mixed
+ */
+function N($key, $step=0,$save=false) {
+    static $_num    = array();
+    if (!isset($_num[$key])) {
+        $_num[$key] = (false !== $save)? S('N_'.$key) :  0;
+    }
+    if (empty($step)){
+        return $_num[$key];
+    }else{
+        $_num[$key] = $_num[$key] + (int)$step;
+    }
+    if(false !== $save){ // 保存结果
+        S('N_'.$key,$_num[$key],$save);
+    }
+    return null;
+}
+
+/**
+ * 字符串命名风格转换
+ * type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格
+ * @param string $name 字符串
+ * @param integer $type 转换类型
+ * @return string
+ */
+function parse_name($name, $type=0) {
+    if ($type) {
+        return ucfirst(preg_replace_callback('/_([a-zA-Z])/', function($match){return strtoupper($match[1]);}, $name));
+    } else {
+        return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_"));
+    }
+}
+
+/**
+ * 优化的require_once
+ * @param string $filename 文件地址
+ * @return boolean
+ */
+function require_cache($filename) {
+    static $_importFiles = array();
+    if (!isset($_importFiles[$filename])) {
+        if (file_exists_case($filename)) {
+            require $filename;
+            $_importFiles[$filename] = true;
+        } else {
+            $_importFiles[$filename] = false;
+        }
+    }
+    return $_importFiles[$filename];
+}
+
+/**
+ * 区分大小写的文件存在判断
+ * @param string $filename 文件地址
+ * @return boolean
+ */
+function file_exists_case($filename) {
+    if (is_file($filename)) {
+        if (IS_WIN && APP_DEBUG) {
+            if (basename(realpath($filename)) != basename($filename))
+                return false;
+        }
+        return true;
+    }
+    return false;
+}
+
+/**
+ * 导入所需的类库 同java的Import 本函数有缓存功能
+ * @param string $class 类库命名空间字符串
+ * @param string $baseUrl 起始路径
+ * @param string $ext 导入的文件扩展名
+ * @return boolean
+ */
+function import($class, $baseUrl = '', $ext=EXT) {
+    static $_file = array();
+    $class = str_replace(array('.', '#'), array('/', '.'), $class);
+    if (isset($_file[$class . $baseUrl]))
+        return true;
+    else
+        $_file[$class . $baseUrl] = true;
+    $class_strut     = explode('/', $class);
+    if (empty($baseUrl)) {
+        if ('@' == $class_strut[0] || MODULE_NAME == $class_strut[0]) {
+            //加载当前模块的类库
+            $baseUrl = MODULE_PATH;
+            $class   = substr_replace($class, '', 0, strlen($class_strut[0]) + 1);
+        }elseif ('Common' == $class_strut[0]) {
+            //加载公共模块的类库
+            $baseUrl = COMMON_PATH;
+            $class   = substr($class, 7);
+        }elseif (in_array($class_strut[0],array('Think','Org','Behavior','Com','Vendor')) || is_dir(LIB_PATH.$class_strut[0])) {
+            // 系统类库包和第三方类库包
+            $baseUrl = LIB_PATH;
+        }else { // 加载其他模块的类库
+            $baseUrl = APP_PATH;
+        }
+    }
+    if (substr($baseUrl, -1) != '/')
+        $baseUrl    .= '/';
+    $classfile       = $baseUrl . $class . $ext;
+    if (!class_exists(basename($class),false)) {
+        // 如果类不存在 则导入类库文件
+        return require_cache($classfile);
+    }
+    return null;
+}
+
+/**
+ * 基于命名空间方式导入函数库
+ * load('@.Util.Array')
+ * @param string $name 函数库命名空间字符串
+ * @param string $baseUrl 起始路径
+ * @param string $ext 导入的文件扩展名
+ * @return void
+ */
+function load($name, $baseUrl='', $ext='.php') {
+    $name = str_replace(array('.', '#'), array('/', '.'), $name);
+    if (empty($baseUrl)) {
+        if (0 === strpos($name, '@/')) {//加载当前模块函数库
+            $baseUrl    =   MODULE_PATH.'Common/';
+            $name       =   substr($name, 2);
+        } else { //加载其他模块函数库
+            $array      =   explode('/', $name);
+            $baseUrl    =   APP_PATH . array_shift($array).'/Common/';
+            $name       =   implode('/',$array);
+        }
+    }
+    if (substr($baseUrl, -1) != '/')
+        $baseUrl       .= '/';
+    require_cache($baseUrl . $name . $ext);
+}
+
+/**
+ * 快速导入第三方框架类库 所有第三方框架的类库文件统一放到 系统的Vendor目录下面
+ * @param string $class 类库
+ * @param string $baseUrl 基础目录
+ * @param string $ext 类库后缀
+ * @return boolean
+ */
+function vendor($class, $baseUrl = '', $ext='.php') {
+    if (empty($baseUrl))
+        $baseUrl = VENDOR_PATH;
+    return import($class, $baseUrl, $ext);
+}
+
+/**
+ * 实例化模型类 格式 [资源://][模块/]模型
+ * @param string $name 资源地址
+ * @param string $layer 模型层名称
+ * @return Think\Model
+ */
+function D($name='',$layer='') {
+    if(empty($name)) return new Think\Model;
+    static $_model  =   array();
+    $layer          =   $layer? : C('DEFAULT_M_LAYER');
+    if(isset($_model[$name.$layer]))
+        return $_model[$name.$layer];
+    $class          =   parse_res_name($name,$layer);
+    if(class_exists($class)) {
+        $model      =   new $class(basename($name));
+    }elseif(false === strpos($name,'/')){
+        // 自动加载公共模块下面的模型
+        if(!C('APP_USE_NAMESPACE')){
+            import('Common/'.$layer.'/'.$class);
+        }else{
+            $class      =   '\\Common\\'.$layer.'\\'.$name.$layer;
+        }
+        $model      =   class_exists($class)? new $class($name) : new Think\Model($name);
+    }else {
+        Think\Log::record('D方法实例化没找到模型类'.$class,Think\Log::NOTICE);
+        $model      =   new Think\Model(basename($name));
+    }
+    $_model[$name.$layer]  =  $model;
+    return $model;
+}
+
+/**
+ * 实例化一个没有模型文件的Model
+ * @param string $name Model名称 支持指定基础模型 例如 MongoModel:User
+ * @param string $tablePrefix 表前缀
+ * @param mixed $connection 数据库连接信息
+ * @return Think\Model
+ */
+function M($name='', $tablePrefix='',$connection='') {
+    static $_model  = array();
+    if(strpos($name,':')) {
+        list($class,$name)    =  explode(':',$name);
+    }else{
+        $class      =   'Think\\Model';
+    }
+    $guid           =   (is_array($connection)?implode('',$connection):$connection).$tablePrefix . $name . '_' . $class;
+    if (!isset($_model[$guid]))
+        $_model[$guid] = new $class($name,$tablePrefix,$connection);
+    return $_model[$guid];
+}
+
+/**
+ * 解析资源地址并导入类库文件
+ * 例如 module/controller addon://module/behavior
+ * @param string $name 资源地址 格式:[扩展://][模块/]资源名
+ * @param string $layer 分层名称
+ * @param integer $level 控制器层次
+ * @return string
+ */
+function parse_res_name($name,$layer,$level=1){
+    if(strpos($name,'://')) {// 指定扩展资源
+        list($extend,$name)  =   explode('://',$name);
+    }else{
+        $extend  =   '';
+    }
+    if(strpos($name,'/') && substr_count($name, '/')>=$level){ // 指定模块
+        list($module,$name) =  explode('/',$name,2);
+    }else{
+        $module =   defined('MODULE_NAME') ? MODULE_NAME : '' ;
+    }
+    $array  =   explode('/',$name);
+    if(!C('APP_USE_NAMESPACE')){
+        $class  =   parse_name($name, 1);
+        import($module.'/'.$layer.'/'.$class.$layer);
+    }else{
+        $class  =   $module.'\\'.$layer;
+        foreach($array as $name){
+            $class  .=   '\\'.parse_name($name, 1);
+        }
+        // 导入资源类库
+        if($extend){ // 扩展资源
+            $class      =   $extend.'\\'.$class;
+        }
+    }
+    return $class.$layer;
+}
+
+/**
+ * 用于实例化访问控制器
+ * @param string $name 控制器名
+ * @param string $path 控制器命名空间(路径)
+ * @return Think\Controller|false
+ */
+function controller($name,$path=''){
+    $layer  =   C('DEFAULT_C_LAYER');
+    if(!C('APP_USE_NAMESPACE')){
+        $class  =   parse_name($name, 1).$layer;
+        import(MODULE_NAME.'/'.$layer.'/'.$class);
+    }else{
+        $class  =   ( $path ? basename(ADDON_PATH).'\\'.$path : MODULE_NAME ).'\\'.$layer;
+        $array  =   explode('/',$name);
+        foreach($array as $name){
+            $class  .=   '\\'.parse_name($name, 1);
+        }
+        $class .=   $layer;
+    }
+    if(class_exists($class)) {
+        return new $class();
+    }else {
+        return false;
+    }
+}
+
+/**
+ * 实例化多层控制器 格式:[资源://][模块/]控制器
+ * @param string $name 资源地址
+ * @param string $layer 控制层名称
+ * @param integer $level 控制器层次
+ * @return Think\Controller|false
+ */
+function A($name,$layer='',$level=0) {
+    static $_action = array();
+    $layer  =   $layer? : C('DEFAULT_C_LAYER');
+    $level  =   $level? : ($layer == C('DEFAULT_C_LAYER')?C('CONTROLLER_LEVEL'):1);
+    if(isset($_action[$name.$layer]))
+        return $_action[$name.$layer];
+    
+    $class  =   parse_res_name($name,$layer,$level);
+    if(class_exists($class)) {
+        $action             =   new $class();
+        $_action[$name.$layer]     =   $action;
+        return $action;
+    }else {
+        return false;
+    }
+}
+
+
+/**
+ * 远程调用控制器的操作方法 URL 参数格式 [资源://][模块/]控制器/操作
+ * @param string $url 调用地址
+ * @param string|array $vars 调用参数 支持字符串和数组
+ * @param string $layer 要调用的控制层名称
+ * @return mixed
+ */
+function R($url,$vars=array(),$layer='') {
+    $info   =   pathinfo($url);
+    $action =   $info['basename'];
+    $module =   $info['dirname'];
+    $class  =   A($module,$layer);
+    if($class){
+        if(is_string($vars)) {
+            parse_str($vars,$vars);
+        }
+        return call_user_func_array(array(&$class,$action.C('ACTION_SUFFIX')),$vars);
+    }else{
+        return false;
+    }
+}
+
+/**
+ * 处理标签扩展
+ * @param string $tag 标签名称
+ * @param mixed $params 传入参数
+ * @return void
+ */
+function tag($tag, &$params=NULL) {
+    \Think\Hook::listen($tag,$params);
+}
+
+/**
+ * 执行某个行为
+ * @param string $name 行为名称
+ * @param string $tag 标签名称(行为类无需传入) 
+ * @param Mixed $params 传入的参数
+ * @return void
+ */
+function B($name, $tag='',&$params=NULL) {
+    if(''==$tag){
+        $name   .=  'Behavior';
+    }
+    return \Think\Hook::exec($name,$tag,$params);
+}
+
+/**
+ * 去除代码中的空白和注释
+ * @param string $content 代码内容
+ * @return string
+ */
+function strip_whitespace($content) {
+    $stripStr   = '';
+    //分析php源码
+    $tokens     = token_get_all($content);
+    $last_space = false;
+    for ($i = 0, $j = count($tokens); $i < $j; $i++) {
+        if (is_string($tokens[$i])) {
+            $last_space = false;
+            $stripStr  .= $tokens[$i];
+        } else {
+            switch ($tokens[$i][0]) {
+                //过滤各种PHP注释
+                case T_COMMENT:
+                case T_DOC_COMMENT:
+                    break;
+                //过滤空格
+                case T_WHITESPACE:
+                    if (!$last_space) {
+                        $stripStr  .= ' ';
+                        $last_space = true;
+                    }
+                    break;
+                case T_START_HEREDOC:
+                    $stripStr .= "<<<THINK\n";
+                    break;
+                case T_END_HEREDOC:
+                    $stripStr .= "THINK;\n";
+                    for($k = $i+1; $k < $j; $k++) {
+                        if(is_string($tokens[$k]) && $tokens[$k] == ';') {
+                            $i = $k;
+                            break;
+                        } else if($tokens[$k][0] == T_CLOSE_TAG) {
+                            break;
+                        }
+                    }
+                    break;
+                default:
+                    $last_space = false;
+                    $stripStr  .= $tokens[$i][1];
+            }
+        }
+    }
+    return $stripStr;
+}
+
+/**
+ * 自定义异常处理
+ * @param string $msg 异常消息
+ * @param string $type 异常类型 默认为Think\Exception
+ * @param integer $code 异常代码 默认为0
+ * @return void
+ */
+function throw_exception($msg, $type='Think\\Exception', $code=0) {
+    Think\Log::record('建议使用E方法替代throw_exception',Think\Log::NOTICE);
+    if (class_exists($type, false))
+        throw new $type($msg, $code);
+    else
+        Think\Think::halt($msg);        // 异常类型不存在则输出错误信息字串
+}
+
+/**
+ * 浏览器友好的变量输出
+ * @param mixed $var 变量
+ * @param boolean $echo 是否输出 默认为True 如果为false 则返回输出字符串
+ * @param string $label 标签 默认为空
+ * @param boolean $strict 是否严谨 默认为true
+ * @return void|string
+ */
+function dump($var, $echo=true, $label=null, $strict=true) {
+    $label = ($label === null) ? '' : rtrim($label) . ' ';
+    if (!$strict) {
+        if (ini_get('html_errors')) {
+            $output = print_r($var, true);
+            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';
+        } else {
+            $output = $label . print_r($var, true);
+        }
+    } else {
+        ob_start();
+        var_dump($var);
+        $output = ob_get_clean();
+        if (!extension_loaded('xdebug')) {
+            $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output);
+            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';
+        }
+    }
+    if ($echo) {
+        echo($output);
+        return null;
+    }else
+        return $output;
+}
+
+/**
+ * 设置当前页面的布局
+ * @param string|false $layout 布局名称 为false的时候表示关闭布局
+ * @return void
+ */
+function layout($layout) {
+    if(false !== $layout) {
+        // 开启布局
+        C('LAYOUT_ON',true);
+        if(is_string($layout)) { // 设置新的布局模板
+            C('LAYOUT_NAME',$layout);
+        }
+    }else{// 临时关闭布局
+        C('LAYOUT_ON',false);
+    }
+}
+
+/**
+ * URL组装 支持不同URL模式
+ * @param string $url URL表达式,格式:'[模块/控制器/操作#锚点@域名]?参数1=值1&参数2=值2...'
+ * @param string|array $vars 传入的参数,支持数组和字符串
+ * @param string|boolean $suffix 伪静态后缀,默认为true表示获取配置值
+ * @param boolean $domain 是否显示域名
+ * @return string
+ */
+function U($url='',$vars='',$suffix=true,$domain=false) {
+    // 解析URL
+    $info   =  parse_url($url);
+    $url    =  !empty($info['path'])?$info['path']:ACTION_NAME;
+    if(isset($info['fragment'])) { // 解析锚点
+        $anchor =   $info['fragment'];
+        if(false !== strpos($anchor,'?')) { // 解析参数
+            list($anchor,$info['query']) = explode('?',$anchor,2);
+        }        
+        if(false !== strpos($anchor,'@')) { // 解析域名
+            list($anchor,$host)    =   explode('@',$anchor, 2);
+        }
+    }elseif(false !== strpos($url,'@')) { // 解析域名
+        list($url,$host)    =   explode('@',$info['path'], 2);
+    }
+    // 解析子域名
+    if(isset($host)) {
+        $domain = $host.(strpos($host,'.')?'':strstr($_SERVER['HTTP_HOST'],'.'));
+    }elseif($domain===true){
+        $domain = $_SERVER['HTTP_HOST'];
+        if(C('APP_SUB_DOMAIN_DEPLOY') ) { // 开启子域名部署
+            $domain = $domain=='localhost'?'localhost':'www'.strstr($_SERVER['HTTP_HOST'],'.');
+            // '子域名'=>array('模块[/控制器]');
+            foreach (C('APP_SUB_DOMAIN_RULES') as $key => $rule) {
+                $rule   =   is_array($rule)?$rule[0]:$rule;
+                if(false === strpos($key,'*') && 0=== strpos($url,$rule)) {
+                    $domain = $key.strstr($domain,'.'); // 生成对应子域名
+                    $url    =  substr_replace($url,'',0,strlen($rule));
+                    break;
+                }
+            }
+        }
+    }
+
+    // 解析参数
+    if(is_string($vars)) { // aaa=1&bbb=2 转换成数组
+        parse_str($vars,$vars);
+    }elseif(!is_array($vars)){
+        $vars = array();
+    }
+    if(isset($info['query'])) { // 解析地址里面参数 合并到vars
+        parse_str($info['query'],$params);
+        $vars = array_merge($params,$vars);
+    }
+    
+    // URL组装
+    $depr       =   C('URL_PATHINFO_DEPR');
+    $urlCase    =   C('URL_CASE_INSENSITIVE');
+    if($url) {
+        if(0=== strpos($url,'/')) {// 定义路由
+            $route      =   true;
+            $url        =   substr($url,1);
+            if('/' != $depr) {
+                $url    =   str_replace('/',$depr,$url);
+            }
+        }else{
+            if('/' != $depr) { // 安全替换
+                $url    =   str_replace('/',$depr,$url);
+            }
+            // 解析模块、控制器和操作
+            $url        =   trim($url,$depr);
+            $path       =   explode($depr,$url);
+            $var        =   array();
+            $varModule      =   C('VAR_MODULE');
+            $varController  =   C('VAR_CONTROLLER');
+            $varAction      =   C('VAR_ACTION');
+            $var[$varAction]       =   !empty($path)?array_pop($path):ACTION_NAME;
+            $var[$varController]   =   !empty($path)?array_pop($path):CONTROLLER_NAME;
+            if($maps = C('URL_ACTION_MAP')) {
+                if(isset($maps[strtolower($var[$varController])])) {
+                    $maps    =   $maps[strtolower($var[$varController])];
+                    if($action = array_search(strtolower($var[$varAction]),$maps)){
+                        $var[$varAction] = $action;
+                    }
+                }
+            }
+            if($maps = C('URL_CONTROLLER_MAP')) {
+                if($controller = array_search(strtolower($var[$varController]),$maps)){
+                    $var[$varController] = $controller;
+                }
+            }
+            if($urlCase) {
+                $var[$varController]   =   parse_name($var[$varController]);
+            }
+            $module =   '';
+            
+            if(!empty($path)) {
+                $var[$varModule]    =   implode($depr,$path);
+            }else{
+                if(C('MULTI_MODULE')) {
+                    if(MODULE_NAME != C('DEFAULT_MODULE') || !C('MODULE_ALLOW_LIST')){
+                        $var[$varModule]=   MODULE_NAME;
+                    }
+                }
+            }
+            if($maps = C('URL_MODULE_MAP')) {
+                if($_module = array_search(strtolower($var[$varModule]),$maps)){
+                    $var[$varModule] = $_module;
+                }
+            }
+            if(isset($var[$varModule])){
+                $module =   $var[$varModule];
+                unset($var[$varModule]);
+            }
+            
+        }
+    }
+
+    if(C('URL_MODEL') == 0) { // 普通模式URL转换
+        $url        =   __APP__.'?'.C('VAR_MODULE')."={$module}&".http_build_query(array_reverse($var));
+        if($urlCase){
+            $url    =   strtolower($url);
+        }        
+        if(!empty($vars)) {
+            $vars   =   http_build_query($vars);
+            $url   .=   '&'.$vars;
+        }
+    }else{ // PATHINFO模式或者兼容URL模式
+        if(isset($route)) {
+            $url    =   __APP__.'/'.rtrim($url,$depr);
+        }else{
+            $module =   (defined('BIND_MODULE') && BIND_MODULE==$module )? '' : $module;
+            $url    =   __APP__.'/'.($module?$module.MODULE_PATHINFO_DEPR:'').implode($depr,array_reverse($var));
+        }
+        if($urlCase){
+            $url    =   strtolower($url);
+        }
+        if(!empty($vars)) { // 添加参数
+            foreach ($vars as $var => $val){
+                if('' !== trim($val))   $url .= $depr . $var . $depr . urlencode($val);
+            }                
+        }
+        if($suffix) {
+            $suffix   =  $suffix===true?C('URL_HTML_SUFFIX'):$suffix;
+            if($pos = strpos($suffix, '|')){
+                $suffix = substr($suffix, 0, $pos);
+            }
+            if($suffix && '/' != substr($url,-1)){
+                $url  .=  '.'.ltrim($suffix,'.');
+            }
+        }
+    }
+    if(isset($anchor)){
+        $url  .= '#'.$anchor;
+    }
+    if($domain) {
+        $url   =  (is_ssl()?'https://':'http://').$domain.$url;
+    }
+    return $url;
+}
+
+/**
+ * 渲染输出Widget
+ * @param string $name Widget名称
+ * @param array $data 传入的参数
+ * @return void
+ */
+function W($name, $data=array()) {
+    return R($name,$data,'Widget');
+}
+
+/**
+ * 判断是否SSL协议
+ * @return boolean
+ */
+function is_ssl() {
+    if(isset($_SERVER['HTTPS']) && ('1' == $_SERVER['HTTPS'] || 'on' == strtolower($_SERVER['HTTPS']))){
+        return true;
+    }elseif(isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'] )) {
+        return true;
+    }
+    return false;
+}
+
+/**
+ * URL重定向
+ * @param string $url 重定向的URL地址
+ * @param integer $time 重定向的等待时间(秒)
+ * @param string $msg 重定向前的提示信息
+ * @return void
+ */
+function redirect($url, $time=0, $msg='') {
+    //多行URL地址支持
+    $url        = str_replace(array("\n", "\r"), '', $url);
+    if (empty($msg))
+        $msg    = "系统将在{$time}秒之后自动跳转到{$url}!";
+    if (!headers_sent()) {
+        // redirect
+        if (0 === $time) {
+            header('Location: ' . $url);
+        } else {
+            header("refresh:{$time};url={$url}");
+            echo($msg);
+        }
+        exit();
+    } else {
+        $str    = "<meta http-equiv='Refresh' content='{$time};URL={$url}'>";
+        if ($time != 0)
+            $str .= $msg;
+        exit($str);
+    }
+}
+
+/**
+ * 缓存管理
+ * @param mixed $name 缓存名称,如果为数组表示进行缓存设置
+ * @param mixed $value 缓存值
+ * @param mixed $options 缓存参数
+ * @return mixed
+ */
+function S($name,$value='',$options=null) {
+    static $cache   =   '';
+    if(is_array($options)){
+        // 缓存操作的同时初始化
+        $type       =   isset($options['type'])?$options['type']:'';
+        $cache      =   Think\Cache::getInstance($type,$options);
+    }elseif(is_array($name)) { // 缓存初始化
+        $type       =   isset($name['type'])?$name['type']:'';
+        $cache      =   Think\Cache::getInstance($type,$name);
+        return $cache;
+    }elseif(empty($cache)) { // 自动初始化
+        $cache      =   Think\Cache::getInstance();
+    }
+    if(''=== $value){ // 获取缓存
+        return $cache->get($name);
+    }elseif(is_null($value)) { // 删除缓存
+        return $cache->rm($name);
+    }else { // 缓存数据
+        if(is_array($options)) {
+            $expire     =   isset($options['expire'])?$options['expire']:NULL;
+        }else{
+            $expire     =   is_numeric($options)?$options:NULL;
+        }
+        return $cache->set($name, $value, $expire);
+    }
+}
+
+/**
+ * 快速文件数据读取和保存 针对简单类型数据 字符串、数组
+ * @param string $name 缓存名称
+ * @param mixed $value 缓存值
+ * @param string $path 缓存路径
+ * @return mixed
+ */
+function F($name, $value='', $path=DATA_PATH) {
+    static $_cache  =   array();
+    $filename       =   $path . $name . '.php';
+    if ('' !== $value) {
+        if (is_null($value)) {
+            // 删除缓存
+            if(false !== strpos($name,'*')){
+                return false; // TODO 
+            }else{
+                unset($_cache[$name]);
+                return Think\Storage::unlink($filename,'F');
+            }
+        } else {
+            Think\Storage::put($filename,serialize($value),'F');
+            // 缓存数据
+            $_cache[$name]  =   $value;
+            return null;
+        }
+    }
+    // 获取缓存数据
+    if (isset($_cache[$name]))
+        return $_cache[$name];
+    if (Think\Storage::has($filename,'F')){
+        $value      =   unserialize(Think\Storage::read($filename,'F'));
+        $_cache[$name]  =   $value;
+    } else {
+        $value          =   false;
+    }
+    return $value;
+}
+
+/**
+ * 根据PHP各种类型变量生成唯一标识号
+ * @param mixed $mix 变量
+ * @return string
+ */
+function to_guid_string($mix) {
+    if (is_object($mix)) {
+        return spl_object_hash($mix);
+    } elseif (is_resource($mix)) {
+        $mix = get_resource_type($mix) . strval($mix);
+    } else {
+        $mix = serialize($mix);
+    }
+    return md5($mix);
+}
+
+/**
+ * XML编码
+ * @param mixed $data 数据
+ * @param string $root 根节点名
+ * @param string $item 数字索引的子节点名
+ * @param string $attr 根节点属性
+ * @param string $id   数字索引子节点key转换的属性名
+ * @param string $encoding 数据编码
+ * @return string
+ */
+function xml_encode($data, $root='think', $item='item', $attr='', $id='id', $encoding='utf-8') {
+    if(is_array($attr)){
+        $_attr = array();
+        foreach ($attr as $key => $value) {
+            $_attr[] = "{$key}=\"{$value}\"";
+        }
+        $attr = implode(' ', $_attr);
+    }
+    $attr   = trim($attr);
+    $attr   = empty($attr) ? '' : " {$attr}";
+    $xml    = "<?xml version=\"1.0\" encoding=\"{$encoding}\"?>";
+    $xml   .= "<{$root}{$attr}>";
+    $xml   .= data_to_xml($data, $item, $id);
+    $xml   .= "</{$root}>";
+    return $xml;
+}
+
+/**
+ * 数据XML编码
+ * @param mixed  $data 数据
+ * @param string $item 数字索引时的节点名称
+ * @param string $id   数字索引key转换为的属性名
+ * @return string
+ */
+function data_to_xml($data, $item='item', $id='id') {
+    $xml = $attr = '';
+    foreach ($data as $key => $val) {
+        if(is_numeric($key)){
+            $id && $attr = " {$id}=\"{$key}\"";
+            $key  = $item;
+        }
+        $xml    .=  "<{$key}{$attr}>";
+        $xml    .=  (is_array($val) || is_object($val)) ? data_to_xml($val, $item, $id) : $val;
+        $xml    .=  "</{$key}>";
+    }
+    return $xml;
+}
+
+/**
+ * session管理函数
+ * @param string|array $name session名称 如果为数组则表示进行session设置
+ * @param mixed $value session值
+ * @return mixed
+ */
+function session($name='',$value='') {
+    $prefix   =  C('SESSION_PREFIX');
+    if(is_array($name)) { // session初始化 在session_start 之前调用
+        if(isset($name['prefix'])) C('SESSION_PREFIX',$name['prefix']);
+        if(C('VAR_SESSION_ID') && isset($_REQUEST[C('VAR_SESSION_ID')])){
+            session_id($_REQUEST[C('VAR_SESSION_ID')]);
+        }elseif(isset($name['id'])) {
+            session_id($name['id']);
+        }
+        if('common' == APP_MODE){ // 其它模式可能不支持
+            ini_set('session.auto_start', 0);
+        }
+        if(isset($name['name']))            session_name($name['name']);
+        if(isset($name['path']))            session_save_path($name['path']);
+        if(isset($name['domain']))          ini_set('session.cookie_domain', $name['domain']);
+        if(isset($name['expire']))          {
+            ini_set('session.gc_maxlifetime',   $name['expire']);
+            ini_set('session.cookie_lifetime',  $name['expire']);
+        }
+        if(isset($name['use_trans_sid']))   ini_set('session.use_trans_sid', $name['use_trans_sid']?1:0);
+        if(isset($name['use_cookies']))     ini_set('session.use_cookies', $name['use_cookies']?1:0);
+        if(isset($name['cache_limiter']))   session_cache_limiter($name['cache_limiter']);
+        if(isset($name['cache_expire']))    session_cache_expire($name['cache_expire']);
+        if(isset($name['type']))            C('SESSION_TYPE',$name['type']);
+        if(C('SESSION_TYPE')) { // 读取session驱动
+            $type   =   C('SESSION_TYPE');
+            $class  =   strpos($type,'\\')? $type : 'Think\\Session\\Driver\\'. ucwords(strtolower($type));
+            $hander =   new $class();
+            session_set_save_handler(
+                array(&$hander,"open"), 
+                array(&$hander,"close"), 
+                array(&$hander,"read"), 
+                array(&$hander,"write"), 
+                array(&$hander,"destroy"), 
+                array(&$hander,"gc")); 
+        }
+        // 启动session
+        if(C('SESSION_AUTO_START'))  session_start();
+    }elseif('' === $value){ 
+        if(''===$name){
+            // 获取全部的session
+            return $prefix ? $_SESSION[$prefix] : $_SESSION;
+        }elseif(0===strpos($name,'[')) { // session 操作
+            if('[pause]'==$name){ // 暂停session
+                session_write_close();
+            }elseif('[start]'==$name){ // 启动session
+                session_start();
+            }elseif('[destroy]'==$name){ // 销毁session
+                $_SESSION =  array();
+                session_unset();
+                session_destroy();
+            }elseif('[regenerate]'==$name){ // 重新生成id
+                session_regenerate_id();
+            }
+        }elseif(0===strpos($name,'?')){ // 检查session
+            $name   =  substr($name,1);
+            if(strpos($name,'.')){ // 支持数组
+                list($name1,$name2) =   explode('.',$name);
+                return $prefix?isset($_SESSION[$prefix][$name1][$name2]):isset($_SESSION[$name1][$name2]);
+            }else{
+                return $prefix?isset($_SESSION[$prefix][$name]):isset($_SESSION[$name]);
+            }
+        }elseif(is_null($name)){ // 清空session
+            if($prefix) {
+                unset($_SESSION[$prefix]);
+            }else{
+                $_SESSION = array();
+            }
+        }elseif($prefix){ // 获取session
+            if(strpos($name,'.')){
+                list($name1,$name2) =   explode('.',$name);
+                return isset($_SESSION[$prefix][$name1][$name2])?$_SESSION[$prefix][$name1][$name2]:null;  
+            }else{
+                return isset($_SESSION[$prefix][$name])?$_SESSION[$prefix][$name]:null;                
+            }            
+        }else{
+            if(strpos($name,'.')){
+                list($name1,$name2) =   explode('.',$name);
+                return isset($_SESSION[$name1][$name2])?$_SESSION[$name1][$name2]:null;  
+            }else{
+                return isset($_SESSION[$name])?$_SESSION[$name]:null;
+            }            
+        }
+    }elseif(is_null($value)){ // 删除session
+        if(strpos($name,'.')){
+            list($name1,$name2) =   explode('.',$name);
+            if($prefix){
+                unset($_SESSION[$prefix][$name1][$name2]);
+            }else{
+                unset($_SESSION[$name1][$name2]);
+            }
+        }else{
+            if($prefix){
+                unset($_SESSION[$prefix][$name]);
+            }else{
+                unset($_SESSION[$name]);
+            }
+        }
+    }else{ // 设置session
+		if(strpos($name,'.')){
+			list($name1,$name2) =   explode('.',$name);
+			if($prefix){
+				$_SESSION[$prefix][$name1][$name2]   =  $value;
+			}else{
+				$_SESSION[$name1][$name2]  =  $value;
+			}
+		}else{
+			if($prefix){
+				$_SESSION[$prefix][$name]   =  $value;
+			}else{
+				$_SESSION[$name]  =  $value;
+			}
+		}
+    }
+    return null;
+}
+
+/**
+ * Cookie 设置、获取、删除
+ * @param string $name cookie名称
+ * @param mixed $value cookie值
+ * @param mixed $option cookie参数
+ * @return mixed
+ */
+function cookie($name='', $value='', $option=null) {
+    // 默认设置
+    $config = array(
+        'prefix'    =>  C('COOKIE_PREFIX'), // cookie 名称前缀
+        'expire'    =>  C('COOKIE_EXPIRE'), // cookie 保存时间
+        'path'      =>  C('COOKIE_PATH'), // cookie 保存路径
+        'domain'    =>  C('COOKIE_DOMAIN'), // cookie 有效域名
+        'secure'    =>  C('COOKIE_SECURE'), //  cookie 启用安全传输
+        'httponly'  =>  C('COOKIE_HTTPONLY'), // httponly设置
+    );
+    // 参数设置(会覆盖黙认设置)
+    if (!is_null($option)) {
+        if (is_numeric($option))
+            $option = array('expire' => $option);
+        elseif (is_string($option))
+            parse_str($option, $option);
+        $config     = array_merge($config, array_change_key_case($option));
+    }
+    if(!empty($config['httponly'])){
+        ini_set("session.cookie_httponly", 1);
+    }
+    // 清除指定前缀的所有cookie
+    if (is_null($name)) {
+        if (empty($_COOKIE))
+            return null;
+        // 要删除的cookie前缀,不指定则删除config设置的指定前缀
+        $prefix = empty($value) ? $config['prefix'] : $value;
+        if (!empty($prefix)) {// 如果前缀为空字符串将不作处理直接返回
+            foreach ($_COOKIE as $key => $val) {
+                if (0 === stripos($key, $prefix)) {
+                    setcookie($key, '', time() - 3600, $config['path'], $config['domain'],$config['secure'],$config['httponly']);
+                    unset($_COOKIE[$key]);
+                }
+            }
+        }
+        return null;
+    }elseif('' === $name){
+        // 获取全部的cookie
+        return $_COOKIE;
+    }
+    $name = $config['prefix'] . str_replace('.', '_', $name);
+    if ('' === $value) {
+        if(isset($_COOKIE[$name])){
+            $value =    $_COOKIE[$name];
+            if(0===strpos($value,'think:')){
+                $value  =   substr($value,6);
+                return array_map('urldecode',json_decode(MAGIC_QUOTES_GPC?stripslashes($value):$value,true));
+            }else{
+                return $value;
+            }
+        }else{
+            return null;
+        }
+    } else {
+        if (is_null($value)) {
+            setcookie($name, '', time() - 3600, $config['path'], $config['domain'],$config['secure'],$config['httponly']);
+            unset($_COOKIE[$name]); // 删除指定cookie
+        } else {
+            // 设置cookie
+            if(is_array($value)){
+                $value  = 'think:'.json_encode(array_map('urlencode',$value));
+            }
+            $expire = !empty($config['expire']) ? time() + intval($config['expire']) : 0;
+            setcookie($name, $value, $expire, $config['path'], $config['domain'],$config['secure'],$config['httponly']);
+            $_COOKIE[$name] = $value;
+        }
+    }
+    return null;
+}
+
+/**
+ * 加载动态扩展文件
+ * @var string $path 文件路径
+ * @return void
+ */
+function load_ext_file($path) {
+    // 加载自定义外部文件
+    if($files = C('LOAD_EXT_FILE')) {
+        $files      =  explode(',',$files);
+        foreach ($files as $file){
+            $file   = $path.'Common/'.$file.'.php';
+            if(is_file($file)) include $file;
+        }
+    }
+    // 加载自定义的动态配置文件
+    if($configs = C('LOAD_EXT_CONFIG')) {
+        if(is_string($configs)) $configs =  explode(',',$configs);
+        foreach ($configs as $key=>$config){
+            $file   = is_file($config)? $config : $path.'Conf/'.$config.CONF_EXT;
+            if(is_file($file)) {
+                is_numeric($key)?C(load_config($file)):C($key,load_config($file));
+            }
+        }
+    }
+}
+
+/**
+ * 获取客户端IP地址
+ * @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字
+ * @param boolean $adv 是否进行高级模式获取(有可能被伪装) 
+ * @return mixed
+ */
+function get_client_ip($type = 0,$adv=false) {
+    $type       =  $type ? 1 : 0;
+    static $ip  =   NULL;
+    if ($ip !== NULL) return $ip[$type];
+    if($adv){
+        if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+            $arr    =   explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+            $pos    =   array_search('unknown',$arr);
+            if(false !== $pos) unset($arr[$pos]);
+            $ip     =   trim($arr[0]);
+        }elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
+            $ip     =   $_SERVER['HTTP_CLIENT_IP'];
+        }elseif (isset($_SERVER['REMOTE_ADDR'])) {
+            $ip     =   $_SERVER['REMOTE_ADDR'];
+        }
+    }elseif (isset($_SERVER['REMOTE_ADDR'])) {
+        $ip     =   $_SERVER['REMOTE_ADDR'];
+    }
+    // IP地址合法验证
+    $long = sprintf("%u",ip2long($ip));
+    $ip   = $long ? array($ip, $long) : array('0.0.0.0', 0);
+    return $ip[$type];
+}
+
+/**
+ * 发送HTTP状态
+ * @param integer $code 状态码
+ * @return void
+ */
+function send_http_status($code) {
+    static $_status = array(
+            // Informational 1xx
+            100 => 'Continue',
+            101 => 'Switching Protocols',
+            // Success 2xx
+            200 => 'OK',
+            201 => 'Created',
+            202 => 'Accepted',
+            203 => 'Non-Authoritative Information',
+            204 => 'No Content',
+            205 => 'Reset Content',
+            206 => 'Partial Content',
+            // Redirection 3xx
+            300 => 'Multiple Choices',
+            301 => 'Moved Permanently',
+            302 => 'Moved Temporarily ',  // 1.1
+            303 => 'See Other',
+            304 => 'Not Modified',
+            305 => 'Use Proxy',
+            // 306 is deprecated but reserved
+            307 => 'Temporary Redirect',
+            // Client Error 4xx
+            400 => 'Bad Request',
+            401 => 'Unauthorized',
+            402 => 'Payment Required',
+            403 => 'Forbidden',
+            404 => 'Not Found',
+            405 => 'Method Not Allowed',
+            406 => 'Not Acceptable',
+            407 => 'Proxy Authentication Required',
+            408 => 'Request Timeout',
+            409 => 'Conflict',
+            410 => 'Gone',
+            411 => 'Length Required',
+            412 => 'Precondition Failed',
+            413 => 'Request Entity Too Large',
+            414 => 'Request-URI Too Long',
+            415 => 'Unsupported Media Type',
+            416 => 'Requested Range Not Satisfiable',
+            417 => 'Expectation Failed',
+            // Server Error 5xx
+            500 => 'Internal Server Error',
+            501 => 'Not Implemented',
+            502 => 'Bad Gateway',
+            503 => 'Service Unavailable',
+            504 => 'Gateway Timeout',
+            505 => 'HTTP Version Not Supported',
+            509 => 'Bandwidth Limit Exceeded'
+    );
+    if(isset($_status[$code])) {
+        header('HTTP/1.1 '.$code.' '.$_status[$code]);
+        // 确保FastCGI模式下正常
+        header('Status:'.$code.' '.$_status[$code]);
+    }
+}
+
+function think_filter(&$value){
+	// TODO 其他安全过滤
+
+	// 过滤查询特殊字符
+    if(preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i',$value)){
+        $value .= ' ';
+    }
+}
+
+// 不区分大小写的in_array实现
+function in_array_case($value,$array){
+    return in_array(strtolower($value),array_map('strtolower',$array));
+}

+ 167 - 0
ThinkPHP/Conf/convention.php

@@ -0,0 +1,167 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+/**
+ * ThinkPHP惯例配置文件
+ * 该文件请不要修改,如果要覆盖惯例配置的值,可在应用配置文件中设定和惯例不符的配置项
+ * 配置名称大小写任意,系统会统一转换成小写
+ * 所有配置参数都可以在生效前动态改变
+ */
+defined('THINK_PATH') or exit();
+return  array(
+    /* 应用设定 */
+    'APP_USE_NAMESPACE'     =>  true,    // 应用类库是否使用命名空间
+    'APP_SUB_DOMAIN_DEPLOY' =>  false,   // 是否开启子域名部署
+    'APP_SUB_DOMAIN_RULES'  =>  array(), // 子域名部署规则
+    'APP_DOMAIN_SUFFIX'     =>  '', // 域名后缀 如果是com.cn net.cn 之类的后缀必须设置    
+    'ACTION_SUFFIX'         =>  '', // 操作方法后缀
+    'MULTI_MODULE'          =>  true, // 是否允许多模块 如果为false 则必须设置 DEFAULT_MODULE
+    'MODULE_DENY_LIST'      =>  array('Common','Runtime'),
+    'CONTROLLER_LEVEL'      =>  1,
+    'APP_AUTOLOAD_LAYER'    =>  'Controller,Model', // 自动加载的应用类库层 关闭APP_USE_NAMESPACE后有效
+    'APP_AUTOLOAD_PATH'     =>  '', // 自动加载的路径 关闭APP_USE_NAMESPACE后有效
+
+    /* Cookie设置 */
+    'COOKIE_EXPIRE'         =>  0,       // Cookie有效期
+    'COOKIE_DOMAIN'         =>  '',      // Cookie有效域名
+    'COOKIE_PATH'           =>  '/',     // Cookie路径
+    'COOKIE_PREFIX'         =>  '',      // Cookie前缀 避免冲突
+    'COOKIE_SECURE'         =>  false,   // Cookie安全传输
+    'COOKIE_HTTPONLY'       =>  '',      // Cookie httponly设置
+
+    /* 默认设定 */
+    'DEFAULT_M_LAYER'       =>  'Model', // 默认的模型层名称
+    'DEFAULT_C_LAYER'       =>  'Controller', // 默认的控制器层名称
+    'DEFAULT_V_LAYER'       =>  'View', // 默认的视图层名称
+    'DEFAULT_LANG'          =>  'zh-cn', // 默认语言
+    'DEFAULT_THEME'         =>  '',	// 默认模板主题名称
+    'DEFAULT_MODULE'        =>  'Home',  // 默认模块
+    'DEFAULT_CONTROLLER'    =>  'Index', // 默认控制器名称
+    'DEFAULT_ACTION'        =>  'index', // 默认操作名称
+    'DEFAULT_CHARSET'       =>  'utf-8', // 默认输出编码
+    'DEFAULT_TIMEZONE'      =>  'PRC',	// 默认时区
+    'DEFAULT_AJAX_RETURN'   =>  'JSON',  // 默认AJAX 数据返回格式,可选JSON XML ...
+    'DEFAULT_JSONP_HANDLER' =>  'jsonpReturn', // 默认JSONP格式返回的处理方法
+    'DEFAULT_FILTER'        =>  'htmlspecialchars', // 默认参数过滤方法 用于I函数...
+
+    /* 数据库设置 */
+    'DB_TYPE'               =>  '',     // 数据库类型
+    'DB_HOST'               =>  '', // 服务器地址
+    'DB_NAME'               =>  '',          // 数据库名
+    'DB_USER'               =>  '',      // 用户名
+    'DB_PWD'                =>  '',          // 密码
+    'DB_PORT'               =>  '',        // 端口
+    'DB_PREFIX'             =>  '',    // 数据库表前缀
+    'DB_PARAMS'          	=>  array(), // 数据库连接参数    
+    'DB_DEBUG'  			=>  TRUE, // 数据库调试模式 开启后可以记录SQL日志
+    'DB_FIELDS_CACHE'       =>  true,        // 启用字段缓存
+    'DB_CHARSET'            =>  'utf8',      // 数据库编码默认采用utf8
+    'DB_DEPLOY_TYPE'        =>  0, // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+    'DB_RW_SEPARATE'        =>  false,       // 数据库读写是否分离 主从式有效
+    'DB_MASTER_NUM'         =>  1, // 读写分离后 主服务器数量
+    'DB_SLAVE_NO'           =>  '', // 指定从服务器序号
+
+    /* 数据缓存设置 */
+    'DATA_CACHE_TIME'       =>  0,      // 数据缓存有效期 0表示永久缓存
+    'DATA_CACHE_COMPRESS'   =>  false,   // 数据缓存是否压缩缓存
+    'DATA_CACHE_CHECK'      =>  false,   // 数据缓存是否校验缓存
+    'DATA_CACHE_PREFIX'     =>  '',     // 缓存前缀
+    'DATA_CACHE_TYPE'       =>  'File',  // 数据缓存类型,支持:File|Db|Apc|Memcache|Shmop|Sqlite|Xcache|Apachenote|Eaccelerator
+    'DATA_CACHE_PATH'       =>  TEMP_PATH,// 缓存路径设置 (仅对File方式缓存有效)
+    'DATA_CACHE_KEY'        =>  '',	// 缓存文件KEY (仅对File方式缓存有效)    
+    'DATA_CACHE_SUBDIR'     =>  false,    // 使用子目录缓存 (自动根据缓存标识的哈希创建子目录)
+    'DATA_PATH_LEVEL'       =>  1,        // 子目录缓存级别
+
+    /* 错误设置 */
+    'ERROR_MESSAGE'         =>  '页面错误!请稍后再试~',//错误显示信息,非调试模式有效
+    'ERROR_PAGE'            =>  '',	// 错误定向页面
+    'SHOW_ERROR_MSG'        =>  false,    // 显示错误信息
+    'TRACE_MAX_RECORD'      =>  100,    // 每个级别的错误信息 最大记录数
+
+    /* 日志设置 */
+    'LOG_RECORD'            =>  false,   // 默认不记录日志
+    'LOG_TYPE'              =>  'File', // 日志记录类型 默认为文件方式
+    'LOG_LEVEL'             =>  'EMERG,ALERT,CRIT,ERR',// 允许记录的日志级别
+    'LOG_FILE_SIZE'         =>  2097152,	// 日志文件大小限制
+    'LOG_EXCEPTION_RECORD'  =>  false,    // 是否记录异常信息日志
+
+    /* SESSION设置 */
+    'SESSION_AUTO_START'    =>  true,    // 是否自动开启Session
+    'SESSION_OPTIONS'       =>  array(), // session 配置数组 支持type name id path expire domain 等参数
+    'SESSION_TYPE'          =>  '', // session hander类型 默认无需设置 除非扩展了session hander驱动
+    'SESSION_PREFIX'        =>  '', // session 前缀
+    //'VAR_SESSION_ID'      =>  'session_id',     //sessionID的提交变量
+
+    /* 模板引擎设置 */
+    'TMPL_CONTENT_TYPE'     =>  'text/html', // 默认模板输出类型
+    'TMPL_ACTION_ERROR'     =>  THINK_PATH.'Tpl/dispatch_jump.tpl', // 默认错误跳转对应的模板文件
+    'TMPL_ACTION_SUCCESS'   =>  THINK_PATH.'Tpl/dispatch_jump.tpl', // 默认成功跳转对应的模板文件
+    'TMPL_EXCEPTION_FILE'   =>  THINK_PATH.'Tpl/think_exception.tpl',// 异常页面的模板文件
+    'TMPL_DETECT_THEME'     =>  false,       // 自动侦测模板主题
+    'TMPL_TEMPLATE_SUFFIX'  =>  '.html',     // 默认模板文件后缀
+    'TMPL_FILE_DEPR'        =>  '/', //模板文件CONTROLLER_NAME与ACTION_NAME之间的分割符
+    // 布局设置
+    'TMPL_ENGINE_TYPE'      =>  'Think',     // 默认模板引擎 以下设置仅对使用Think模板引擎有效
+    'TMPL_CACHFILE_SUFFIX'  =>  '.php',      // 默认模板缓存后缀
+    'TMPL_DENY_FUNC_LIST'   =>  'echo,exit',    // 模板引擎禁用函数
+    'TMPL_DENY_PHP'         =>  false, // 默认模板引擎是否禁用PHP原生代码
+    'TMPL_L_DELIM'          =>  '{',            // 模板引擎普通标签开始标记
+    'TMPL_R_DELIM'          =>  '}',            // 模板引擎普通标签结束标记
+    'TMPL_VAR_IDENTIFY'     =>  'array',     // 模板变量识别。留空自动判断,参数为'obj'则表示对象
+    'TMPL_STRIP_SPACE'      =>  true,       // 是否去除模板文件里面的html空格与换行
+    'TMPL_CACHE_ON'         =>  true,        // 是否开启模板编译缓存,设为false则每次都会重新编译
+    'TMPL_CACHE_PREFIX'     =>  '',         // 模板缓存前缀标识,可以动态改变
+    'TMPL_CACHE_TIME'       =>  0,         // 模板缓存有效期 0 为永久,(以数字为值,单位:秒)
+    'TMPL_LAYOUT_ITEM'      =>  '{__CONTENT__}', // 布局模板的内容替换标识
+    'LAYOUT_ON'             =>  false, // 是否启用布局
+    'LAYOUT_NAME'           =>  'layout', // 当前布局名称 默认为layout
+
+    // Think模板引擎标签库相关设定
+    'TAGLIB_BEGIN'          =>  '<',  // 标签库标签开始标记
+    'TAGLIB_END'            =>  '>',  // 标签库标签结束标记
+    'TAGLIB_LOAD'           =>  true, // 是否使用内置标签库之外的其它标签库,默认自动检测
+    'TAGLIB_BUILD_IN'       =>  'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序
+    'TAGLIB_PRE_LOAD'       =>  '',   // 需要额外加载的标签库(须指定标签库名称),多个以逗号分隔 
+    
+    /* URL设置 */
+    'URL_CASE_INSENSITIVE'  =>  true,   // 默认false 表示URL区分大小写 true则表示不区分大小写
+    'URL_MODEL'             =>  1,       // URL访问模式,可选参数0、1、2、3,代表以下四种模式:
+    // 0 (普通模式); 1 (PATHINFO 模式); 2 (REWRITE  模式); 3 (兼容模式)  默认为PATHINFO 模式
+    'URL_PATHINFO_DEPR'     =>  '/',	// PATHINFO模式下,各参数之间的分割符号
+    'URL_PATHINFO_FETCH'    =>  'ORIG_PATH_INFO,REDIRECT_PATH_INFO,REDIRECT_URL', // 用于兼容判断PATH_INFO 参数的SERVER替代变量列表
+    'URL_REQUEST_URI'       =>  'REQUEST_URI', // 获取当前页面地址的系统变量 默认为REQUEST_URI
+    'URL_HTML_SUFFIX'       =>  'html',  // URL伪静态后缀设置
+    'URL_DENY_SUFFIX'       =>  'ico|png|gif|jpg', // URL禁止访问的后缀设置
+    'URL_PARAMS_BIND'       =>  true, // URL变量绑定到Action方法参数
+    'URL_PARAMS_BIND_TYPE'  =>  0, // URL变量绑定的类型 0 按变量名绑定 1 按变量顺序绑定
+    'URL_PARAMS_FILTER'     =>  false, // URL变量绑定过滤
+    'URL_PARAMS_FILTER_TYPE'=>  '', // URL变量绑定过滤方法 如果为空 调用DEFAULT_FILTER
+    'URL_ROUTER_ON'         =>  false,   // 是否开启URL路由
+    'URL_ROUTE_RULES'       =>  array(), // 默认路由规则 针对模块
+    'URL_MAP_RULES'         =>  array(), // URL映射定义规则
+
+    /* 系统变量名称设置 */
+    'VAR_MODULE'            =>  'm',     // 默认模块获取变量
+    'VAR_ADDON'             =>  'addon',     // 默认的插件控制器命名空间变量
+    'VAR_CONTROLLER'        =>  'c',    // 默认控制器获取变量
+    'VAR_ACTION'            =>  'a',    // 默认操作获取变量
+    'VAR_AJAX_SUBMIT'       =>  'ajax',  // 默认的AJAX提交变量
+    'VAR_JSONP_HANDLER'     =>  'callback',
+    'VAR_PATHINFO'          =>  's',    // 兼容模式PATHINFO获取变量例如 ?s=/module/action/id/1 后面的参数取决于URL_PATHINFO_DEPR
+    'VAR_TEMPLATE'          =>  't',    // 默认模板切换变量
+    'VAR_AUTO_STRING'		=>	false,	// 输入变量是否自动强制转换为字符串 如果开启则数组变量需要手动传入变量修饰符获取变量
+
+    'HTTP_CACHE_CONTROL'    =>  'private',  // 网页缓存控制
+    'CHECK_APP_DIR'         =>  true,       // 是否检查应用目录是否创建
+    'FILE_UPLOAD_TYPE'      =>  'Local',    // 文件上传方式
+    'DATA_CRYPT_TYPE'       =>  'Think',    // 数据加密方式
+
+);

+ 27 - 0
ThinkPHP/Conf/debug.php

@@ -0,0 +1,27 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+/**
+ * ThinkPHP 默认的调试模式配置文件
+ */
+defined('THINK_PATH') or exit();
+// 调试模式下面默认设置 可以在应用配置目录下重新定义 debug.php 覆盖
+return  array(
+    'LOG_RECORD'            =>  true,  // 进行日志记录
+    'LOG_EXCEPTION_RECORD'  =>  true,    // 是否记录异常信息日志
+    'LOG_LEVEL'             =>  'EMERG,ALERT,CRIT,ERR,WARN,NOTIC,INFO,DEBUG,SQL',  // 允许记录的日志级别
+    'DB_FIELDS_CACHE'       =>  false, // 字段缓存信息
+    'DB_DEBUG'				=>  true, // 开启调试模式 记录SQL日志
+    'TMPL_CACHE_ON'         =>  false,        // 是否开启模板编译缓存,设为false则每次都会重新编译
+    'TMPL_STRIP_SPACE'      =>  false,       // 是否去除模板文件里面的html空格与换行
+    'SHOW_ERROR_MSG'        =>  true,    // 显示错误信息
+    'URL_CASE_INSENSITIVE'  =>  false,  // URL区分大小写
+);

+ 32 - 0
ThinkPHP/LICENSE.txt

@@ -0,0 +1,32 @@
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+版权所有Copyright © 2006-2014 by ThinkPHP (http://thinkphp.cn)
+All rights reserved。
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+Apache Licence是著名的非盈利开源组织Apache采用的协议。
+该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
+允许代码修改,再作为开源或商业软件发布。需要满足
+的条件: 
+1. 需要给代码的用户一份Apache Licence ;
+2. 如果你修改了代码,需要在被修改的文件中说明;
+3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
+带有原来代码中的协议,商标,专利声明和其他原来作者规
+定需要包含的说明;
+4. 如果再发布的产品中包含一个Notice文件,则在Notice文
+件中需要带有本协议内容。你可以在Notice中增加自己的
+许可,但不可以表现为对Apache Licence构成更改。 
+具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

+ 51 - 0
ThinkPHP/Lang/en-us.php

@@ -0,0 +1,51 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+/**
+ * ThinkPHP English language package
+ */
+return array(
+    /* core language package */ 
+    '_MODULE_NOT_EXIST_'     => "Module can't be loaded",
+    '_CONTROLLER_NOT_EXIST_' =>	"Controller can't be loaded",
+    '_ERROR_ACTION_'         => 'Illegal Action',
+    '_LANGUAGE_NOT_LOAD_'    => "Can't load language package",
+    '_TEMPLATE_NOT_EXIST_'   => "Template doesn't exist",
+    '_MODULE_'               => 'Module',
+    '_ACTION_'               => 'Action',
+    '_MODEL_NOT_EXIST_'      => "Model can't be loaded",
+    '_VALID_ACCESS_'         => 'No access',
+    '_XML_TAG_ERROR_'        => 'XML tag syntax errors',
+    '_DATA_TYPE_INVALID_'    => 'Illegal data objects!',
+    '_OPERATION_WRONG_'      => 'Operation error occurs',
+    '_NOT_LOAD_DB_'          => 'Unable to load the database',
+    '_NO_DB_DRIVER_'         => 'Unable to load database driver',
+    '_NOT_SUPPORT_DB_'       => 'The system is temporarily not support database',
+    '_NO_DB_CONFIG_'         => 'Not define the database configuration',
+    '_NOT_SUPPORT_'          => 'The system does not support',
+    '_CACHE_TYPE_INVALID_'   => 'Unable to load the cache type',
+    '_FILE_NOT_WRITABLE_'   => 'Directory (file) is not writable',
+    '_METHOD_NOT_EXIST_'     => 'The method you requested  does not exist!',
+    '_CLASS_NOT_EXIST_'      => 'Instantiating a class does not exist!',
+    '_CLASS_CONFLICT_'       => 'Class name conflicts',
+    '_TEMPLATE_ERROR_'       => 'Template Engine errors',
+    '_CACHE_WRITE_ERROR_'    => 'Cache file write failed!',
+    '_TAGLIB_NOT_EXIST_'     => 'Tag library is not defined',
+    '_OPERATION_FAIL_'       => 'Operation failed!',
+    '_OPERATION_SUCCESS_'    => 'Operation succeed!',
+    '_SELECT_NOT_EXIST_'     => 'Record does not exist!',
+    '_EXPRESS_ERROR_'        => 'Expression errors',
+    '_TOKEN_ERROR_'          => "Form's token errors",
+    '_RECORD_HAS_UPDATE_'    => 'Record has been updated',
+    '_NOT_ALLOW_PHP_'        => 'PHP codes are not allowed in the template',
+    '_PARAM_ERROR_'          => 'Parameter error or undefined',
+    '_ERROR_QUERY_EXPRESS_'  => 'Query express error',       
+);

+ 51 - 0
ThinkPHP/Lang/pt-br.php

@@ -0,0 +1,51 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: Daiane Azevedo <daianeaze16@gmail.com>
+// +----------------------------------------------------------------------
+
+/**
+ * ThinkPHP Portuguese language package
+ */
+return array(
+    /* core language package */ 
+    '_MODULE_NOT_EXIST_'     => "Módulo não pode ser carregado",
+    '_CONTROLLER_NOT_EXIST_' => "Controller não pode ser carregado",
+    '_ERROR_ACTION_'         => 'Ação ilegal',
+    '_LANGUAGE_NOT_LOAD_'    => "Não é possível carregar pacote da linguagem",
+    '_TEMPLATE_NOT_EXIST_'   => "Template não existe",
+    '_MODULE_'               => 'Módulo',
+    '_ACTION_'               => 'Ação',
+    '_MODEL_NOT_EXIST_'      => "Modelo não pode ser carregado",
+    '_VALID_ACCESS_'         => 'Sem acesso',
+    '_XML_TAG_ERROR_'        => 'Erro de sintaxe - XML tag',
+    '_DATA_TYPE_INVALID_'    => 'Tipos de dados ilegais!',
+    '_OPERATION_WRONG_'      => 'Erro na operação',
+    '_NOT_LOAD_DB_'          => 'Impossível carregar banco de dados',
+    '_NO_DB_DRIVER_'         => 'Impossível carregar driver do bando de dados',
+    '_NOT_SUPPORT_DB_'       => 'Temporariamente sem suporte ao banco',
+    '_NO_DB_CONFIG_'         => 'Não define a configuração do banco',
+    '_NOT_SUPPORT_'          => 'O sistema não suporta',
+    '_CACHE_TYPE_INVALID_'   => 'Impossível carregar o tipo de cache',
+    '_FILE_NOT_WRITABLE_'   => 'Diretório (arquivo) não pode ser escrito',
+    '_METHOD_NOT_EXIST_'     => 'O método solicitado não existe!',
+    '_CLASS_NOT_EXIST_'      => 'Não existe instância da classe',
+    '_CLASS_CONFLICT_'       => 'Conflitos com nome da classe',
+    '_TEMPLATE_ERROR_'       => 'Erros na contrução do template',
+    '_CACHE_WRITE_ERROR_'    => 'Escrita do arquivo de cache falhou!',
+    '_TAGLIB_NOT_EXIST_'     => 'Biblioteca da tag não foi definida',
+    '_OPERATION_FAIL_'       => 'Operação falhou!',
+    '_OPERATION_SUCCESS_'    => 'Operação bem sucessida!',
+    '_SELECT_NOT_EXIST_'     => 'Gravação não existe!',
+    '_EXPRESS_ERROR_'        => 'Erros de expressão',
+    '_TOKEN_ERROR_'          => 'Erro no token do formulário',
+    '_RECORD_HAS_UPDATE_'    => 'Gravação não foi atualizada',
+    '_NOT_ALLOW_PHP_'        => 'Código PHP não é permitido no template',
+    '_PARAM_ERROR_'          => 'Parâmetro errado ou indefinido',
+    '_ERROR_QUERY_EXPRESS_'  => 'Erros na expressão da query',       
+);

+ 51 - 0
ThinkPHP/Lang/zh-cn.php

@@ -0,0 +1,51 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+/**
+ * ThinkPHP 简体中文语言包
+ */
+return array(
+    /* 核心语言变量 */  
+    '_MODULE_NOT_EXIST_'     => '无法加载模块',
+    '_CONTROLLER_NOT_EXIST_' =>	'无法加载控制器',
+    '_ERROR_ACTION_'         => '非法操作',
+    '_LANGUAGE_NOT_LOAD_'    => '无法加载语言包',
+    '_TEMPLATE_NOT_EXIST_'   => '模板不存在',
+    '_MODULE_'               => '模块',
+    '_ACTION_'               => '操作',
+    '_MODEL_NOT_EXIST_'      => '模型不存在或者没有定义',
+    '_VALID_ACCESS_'         => '没有权限',
+    '_XML_TAG_ERROR_'        => 'XML标签语法错误',
+    '_DATA_TYPE_INVALID_'    => '非法数据对象!',
+    '_OPERATION_WRONG_'      => '操作出现错误',
+    '_NOT_LOAD_DB_'          => '无法加载数据库',
+    '_NO_DB_DRIVER_'         => '无法加载数据库驱动',
+    '_NOT_SUPPORT_DB_'       => '系统暂时不支持数据库',
+    '_NO_DB_CONFIG_'         => '没有定义数据库配置',
+    '_NOT_SUPPORT_'          => '系统不支持',
+    '_CACHE_TYPE_INVALID_'   => '无法加载缓存类型',
+    '_FILE_NOT_WRITABLE_'   => '目录(文件)不可写',
+    '_METHOD_NOT_EXIST_'     => '方法不存在!',
+    '_CLASS_NOT_EXIST_'      => '实例化一个不存在的类!',
+    '_CLASS_CONFLICT_'       => '类名冲突',
+    '_TEMPLATE_ERROR_'       => '模板引擎错误',
+    '_CACHE_WRITE_ERROR_'    => '缓存文件写入失败!',
+    '_TAGLIB_NOT_EXIST_'     => '标签库未定义',
+    '_OPERATION_FAIL_'       => '操作失败!',
+    '_OPERATION_SUCCESS_'    => '操作成功!',
+    '_SELECT_NOT_EXIST_'     => '记录不存在!',
+    '_EXPRESS_ERROR_'        => '表达式错误',
+    '_TOKEN_ERROR_'          => '表单令牌错误',
+    '_RECORD_HAS_UPDATE_'    => '记录已经更新',
+    '_NOT_ALLOW_PHP_'        => '模板禁用PHP代码',
+    '_PARAM_ERROR_'          => '参数错误或者未定义',
+    '_ERROR_QUERY_EXPRESS_'  => '错误的查询条件',
+);

+ 51 - 0
ThinkPHP/Lang/zh-tw.php

@@ -0,0 +1,51 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+/**
+ * ThinkPHP 繁体中文語言包
+ */
+return array(
+    /* 核心語言變數 */  
+    '_MODULE_NOT_EXIST_'     => '無法載入模組',
+    '_CONTROLLER_NOT_EXIST_' => '無法載入控制器',
+    '_ERROR_ACTION_'         => '非法操作',
+    '_LANGUAGE_NOT_LOAD_'    => '無法載入語言包',
+    '_TEMPLATE_NOT_EXIST_'   => '模板不存在',
+    '_MODULE_'               => '模組',
+    '_ACTION_'               => '操作',
+    '_MODEL_NOT_EXIST_'      => '模型不存在或者沒有定義',
+    '_VALID_ACCESS_'         => '沒有權限',
+    '_XML_TAG_ERROR_'        => 'XML標籤語法錯誤',
+    '_DATA_TYPE_INVALID_'    => '非法資料物件!',
+    '_OPERATION_WRONG_'      => '操作出現錯誤',
+    '_NOT_LOAD_DB_'          => '無法載入資料庫',
+    '_NO_DB_DRIVER_'         => '無法載入資料庫驅動',
+    '_NOT_SUPPORT_DB_'       => '系統暫時不支援資料庫',
+    '_NO_DB_CONFIG_'         => '沒有定義資料庫設定',
+    '_NOT_SUPPORT_'          => '系統不支援',
+    '_CACHE_TYPE_INVALID_'   => '無法載入快取類型',
+    '_FILE_NOT_WRITABLE_'   => '目錄(檔案)不可寫',
+    '_METHOD_NOT_EXIST_'     => '方法不存在!',
+    '_CLASS_NOT_EXIST_'      => '實例化一個不存在的類別!',
+    '_CLASS_CONFLICT_'       => '類別名稱衝突',
+    '_TEMPLATE_ERROR_'       => '模板引擎錯誤',
+    '_CACHE_WRITE_ERROR_'    => '快取檔案寫入失敗!',
+    '_TAGLIB_NOT_EXIST_'     => '標籤庫未定義',
+    '_OPERATION_FAIL_'       => '操作失敗!',
+    '_OPERATION_SUCCESS_'    => '操作成功!',
+    '_SELECT_NOT_EXIST_'     => '記錄不存在!',
+    '_EXPRESS_ERROR_'        => '運算式錯誤',
+    '_TOKEN_ERROR_'          => '表單權限錯誤',
+    '_RECORD_HAS_UPDATE_'    => '記錄已經更新',
+    '_NOT_ALLOW_PHP_'        => '模板禁用PHP代碼',
+    '_PARAM_ERROR_'          => '參數錯誤或者未定義',
+    '_ERROR_QUERY_EXPRESS_'  => '錯誤的查詢條件',    
+);

+ 24 - 0
ThinkPHP/Library/Behavior/AgentCheckBehavior.class.php

@@ -0,0 +1,24 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 行为扩展:代理检测
+ */
+class AgentCheckBehavior {
+    public function run(&$params) {
+        // 代理访问检测
+        $limitProxyVisit =  C('LIMIT_PROXY_VISIT',null,true);
+        if($limitProxyVisit && ($_SERVER['HTTP_X_FORWARDED_FOR'] || $_SERVER['HTTP_VIA'] || $_SERVER['HTTP_PROXY_CONNECTION'] || $_SERVER['HTTP_USER_AGENT_VIA'])) {
+            // 禁止代理访问
+            exit('Access Denied');
+        }
+    }
+}

+ 42 - 0
ThinkPHP/Library/Behavior/BorisBehavior.class.php

@@ -0,0 +1,42 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+use Think\Think;
+/**
+ * Boris行为扩展
+ */
+class BorisBehavior {
+    public function run(&$params) {
+        if(IS_CLI){
+            if(!function_exists('pcntl_signal'))
+                E("pcntl_signal not working.\nRepl mode based on Linux OS or PHP for OS X(http://php-osx.liip.ch/)\n");
+            Think::addMap(array(
+                'Boris\Boris'               => VENDOR_PATH . 'Boris/Boris.php',
+                'Boris\Config'              => VENDOR_PATH . 'Boris/Config.php',
+                'Boris\CLIOptionsHandler'   => VENDOR_PATH . 'Boris/CLIOptionsHandler.php',
+                'Boris\ColoredInspector'    => VENDOR_PATH . 'Boris/ColoredInspector.php',
+                'Boris\DumpInspector'       => VENDOR_PATH . 'Boris/DumpInspector.php',
+                'Boris\EvalWorker'          => VENDOR_PATH . 'Boris/EvalWorker.php',    
+                'Boris\ExportInspector'     => VENDOR_PATH . 'Boris/ExportInspector.php',
+                'Boris\Inspector'           => VENDOR_PATH . 'Boris/Inspector.php',
+                'Boris\ReadlineClient'      => VENDOR_PATH . 'Boris/ReadlineClient.php',
+                'Boris\ShallowParser'       => VENDOR_PATH . 'Boris/ShallowParser.php',
+            ));
+            $boris      =   new \Boris\Boris(">>> ");
+            $config     =   new \Boris\Config();
+            $config->apply($boris, true);
+            $options    =   new \Boris\CLIOptionsHandler();
+            $options->handle($boris);
+            $boris->onStart(sprintf("echo 'REPL MODE FOR THINKPHP \nTHINKPHP_VERSION: %s, PHP_VERSION: %s, BORIS_VERSION: %s\n';", THINK_VERSION, PHP_VERSION, $boris::VERSION));
+            $boris->start();
+        }
+    }
+}

+ 34 - 0
ThinkPHP/Library/Behavior/BrowserCheckBehavior.class.php

@@ -0,0 +1,34 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 浏览器防刷新检测
+ */
+class BrowserCheckBehavior {
+    public function run(&$params) {
+        if($_SERVER['REQUEST_METHOD'] == 'GET') {
+            //	启用页面防刷新机制
+            $guid	=	md5($_SERVER['PHP_SELF']);
+            // 浏览器防刷新的时间间隔(秒) 默认为10
+            $refleshTime    =   C('LIMIT_REFLESH_TIMES',null,10);
+            // 检查页面刷新间隔
+            if(cookie('_last_visit_time_'.$guid) && cookie('_last_visit_time_'.$guid)>time()-$refleshTime) {
+                // 页面刷新读取浏览器缓存
+                header('HTTP/1.1 304 Not Modified');
+                exit;
+            }else{
+                // 缓存当前地址访问时间
+                cookie('_last_visit_time_'.$guid, $_SERVER['REQUEST_TIME']);
+                //header('Last-Modified:'.(date('D,d M Y H:i:s',$_SERVER['REQUEST_TIME']-C('LIMIT_REFLESH_TIMES'))).' GMT');
+            }
+        }
+    }
+}

+ 87 - 0
ThinkPHP/Library/Behavior/BuildLiteBehavior.class.php

@@ -0,0 +1,87 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+// 创建Lite运行文件
+// 可以替换框架入口文件运行
+// 建议绑定位置app_init
+class BuildLiteBehavior {
+    public function run(&$params) {
+        if(!defined('BUILD_LITE_FILE')) return ;
+        $litefile   =   C('RUNTIME_LITE_FILE',null,RUNTIME_PATH.'lite.php');
+        if(is_file($litefile)) return;
+        
+        $defs       =   get_defined_constants(TRUE);
+        $content    =   'namespace {$GLOBALS[\'_beginTime\'] = microtime(TRUE);';
+        if(MEMORY_LIMIT_ON) {
+            $content .= '$GLOBALS[\'_startUseMems\'] = memory_get_usage();';
+        }
+
+        // 生成数组定义
+        unset($defs['user']['BUILD_LITE_FILE']);
+        $content   .=   $this->buildArrayDefine($defs['user']).'}';
+
+        // 读取编译列表文件
+        $filelist   =   is_file(CONF_PATH.'lite.php')?
+            include CONF_PATH.'lite.php':
+            array(
+                THINK_PATH.'Common/functions.php',
+                COMMON_PATH.'Common/function.php',
+                CORE_PATH . 'Think'.EXT,
+                CORE_PATH . 'Hook'.EXT,
+                CORE_PATH . 'App'.EXT,
+                CORE_PATH . 'Dispatcher'.EXT,
+                CORE_PATH . 'Log'.EXT,
+                CORE_PATH . 'Log/Driver/File'.EXT,
+                CORE_PATH . 'Route'.EXT,
+                CORE_PATH . 'Controller'.EXT,
+                CORE_PATH . 'View'.EXT,
+                CORE_PATH . 'Storage'.EXT,
+                CORE_PATH . 'Storage/Driver/File'.EXT,
+                CORE_PATH . 'Exception'.EXT,
+                BEHAVIOR_PATH . 'ParseTemplateBehavior'.EXT,
+                BEHAVIOR_PATH . 'ContentReplaceBehavior'.EXT,
+            );
+
+        // 编译文件
+        foreach ($filelist as $file){
+          if(is_file($file)) {
+            $content   .= compile($file);
+          }
+        }
+
+        // 处理Think类的start方法
+        $content  =  preg_replace('/\$runtimefile = RUNTIME_PATH(.+?)(if\(APP_STATUS)/','\2',$content,1);
+        $content  .=  "\nnamespace { Think\Think::addMap(".var_export(\Think\Think::getMap(),true).");";
+        $content  .=  "\nL(".var_export(L(),true).");\nC(".var_export(C(),true).');Think\Hook::import('.var_export(\Think\Hook::get(),true).');Think\Think::start();}';
+
+        // 生成运行Lite文件
+        file_put_contents($litefile,strip_whitespace('<?php '.$content));
+    }
+
+    // 根据数组生成常量定义
+    private function buildArrayDefine($array) {
+        $content = "\n";
+        foreach ($array as $key => $val) {
+            $key = strtoupper($key);
+            $content .= 'defined(\'' . $key . '\') or ';
+            if (is_int($val) || is_float($val)) {
+                $content .= "define('" . $key . "'," . $val . ');';
+            } elseif (is_bool($val)) {
+                $val = ($val) ? 'true' : 'false';
+                $content .= "define('" . $key . "'," . $val . ');';
+            } elseif (is_string($val)) {
+                $content .= "define('" . $key . "','" . addslashes($val) . "');";
+            }
+            $content    .= "\n";
+        }
+        return $content;
+    }
+}

+ 194 - 0
ThinkPHP/Library/Behavior/CheckActionRouteBehavior.class.php

@@ -0,0 +1,194 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 系统行为扩展:操作路由检测
+ */
+class CheckActionRouteBehavior {
+
+    // 行为扩展的执行入口必须是run
+    public function run(&$config){
+        // 优先检测是否存在PATH_INFO
+        $regx   =   trim($_SERVER['PATH_INFO'],'/');
+        if(empty($regx)) return ;
+        // 路由定义文件优先于config中的配置定义
+        // 路由处理
+        $routes =   $config['routes'];
+        if(!empty($routes)) {
+            $depr = C('URL_PATHINFO_DEPR');
+            // 分隔符替换 确保路由定义使用统一的分隔符
+            $regx = str_replace($depr,'/',$regx);
+            $regx = substr_replace($regx,'',0,strlen(__URL__));
+            foreach ($routes as $rule=>$route){
+                if(0===strpos($rule,'/') && preg_match($rule,$regx,$matches)) { // 正则路由
+                    return C('ACTION_NAME',$this->parseRegex($matches,$route,$regx));
+                }else{ // 规则路由
+                    $len1   =   substr_count($regx,'/');
+                    $len2   =   substr_count($rule,'/');
+                    if($len1>=$len2) {
+                        if('$' == substr($rule,-1,1)) {// 完整匹配
+                            if($len1 != $len2) {
+                                continue;
+                            }else{
+                                $rule =  substr($rule,0,-1);
+                            }
+                        }
+                        $match  =  $this->checkUrlMatch($regx,$rule);
+                        if($match)  return C('ACTION_NAME',$this->parseRule($rule,$route,$regx));
+                    }
+                }
+            }
+        }
+    }
+
+    // 检测URL和规则路由是否匹配
+    private function checkUrlMatch($regx,$rule) {
+        $m1     =   explode('/',$regx);
+        $m2     =   explode('/',$rule);
+        $match  =   true; // 是否匹配
+        foreach ($m2 as $key=>$val){
+            if(':' == substr($val,0,1)) {// 动态变量
+                if(strpos($val,'\\')) {
+                    $type = substr($val,-1);
+                    if('d'==$type && !is_numeric($m1[$key])) {
+                        $match = false;
+                        break;
+                    }
+                }elseif(strpos($val,'^')){
+                    $array   =  explode('|',substr(strstr($val,'^'),1));
+                    if(in_array($m1[$key],$array)) {
+                        $match = false;
+                        break;
+                    }
+                }
+            }elseif(0 !== strcasecmp($val,$m1[$key])){
+                $match = false;
+                break;
+            }
+        }
+        return $match;
+    }
+
+    // 解析规范的路由地址
+    // 地址格式 操作?参数1=值1&参数2=值2...
+    private function parseUrl($url) {
+        $var  =  array();
+        if(false !== strpos($url,'?')) { // 操作?参数1=值1&参数2=值2...
+            $info   =   parse_url($url);
+            $path   =   $info['path'];
+            parse_str($info['query'],$var);
+        }else{ // 操作
+            $path   =   $url;
+        }
+        $var[C('VAR_ACTION')] = $path;
+        return $var;
+    }
+
+    // 解析规则路由
+    // '路由规则'=>'操作?额外参数1=值1&额外参数2=值2...'
+    // '路由规则'=>array('操作','额外参数1=值1&额外参数2=值2...')
+    // '路由规则'=>'外部地址'
+    // '路由规则'=>array('外部地址','重定向代码')
+    // 路由规则中 :开头 表示动态变量
+    // 外部地址中可以用动态变量 采用 :1 :2 的方式
+    // 'news/:month/:day/:id'=>array('News/read?cate=1','status=1'),
+    // 'new/:id'=>array('/new.php?id=:1',301), 重定向
+    private function parseRule($rule,$route,$regx) {
+        // 获取路由地址规则
+        $url        =   is_array($route)?$route[0]:$route;
+        // 获取URL地址中的参数
+        $paths      =   explode('/',$regx);
+        // 解析路由规则
+        $matches    =   array();
+        $rule       =   explode('/',$rule);
+        foreach ($rule as $item){
+            if(0===strpos($item,':')) { // 动态变量获取
+                if($pos = strpos($item,'^') ) {
+                    $var  =  substr($item,1,$pos-1);
+                }elseif(strpos($item,'\\')){
+                    $var  =  substr($item,1,-2);
+                }else{
+                    $var  =  substr($item,1);
+                }
+                $matches[$var] = array_shift($paths);
+            }else{ // 过滤URL中的静态变量
+                array_shift($paths);
+            }
+        }
+        if(0=== strpos($url,'/') || 0===strpos($url,'http')) { // 路由重定向跳转
+            if(strpos($url,':')) { // 传递动态参数
+                $values =   array_values($matches);
+                $url    =   preg_replace('/:(\d+)/e','$values[\\1-1]',$url);
+            }
+            header("Location: $url", true,(is_array($route) && isset($route[1]))?$route[1]:301);
+            exit;
+        }else{
+            // 解析路由地址
+            $var        =   $this->parseUrl($url);
+            // 解析路由地址里面的动态参数
+            $values     =   array_values($matches);
+            foreach ($var as $key=>$val){
+                if(0===strpos($val,':')) {
+                    $var[$key] =  $values[substr($val,1)-1];
+                }
+            }
+            $var        =   array_merge($matches,$var);
+            // 解析剩余的URL参数
+            if($paths) {
+                preg_replace('@(\w+)\/([^\/]+)@e', '$var[strtolower(\'\\1\')]=strip_tags(\'\\2\');', implode('/',$paths));
+            }
+            // 解析路由自动传入参数
+            if(is_array($route) && isset($route[1])) {
+                parse_str($route[1],$params);
+                $var   =   array_merge($var,$params);
+            }
+            $action =   $var[C('VAR_ACTION')];
+            unset($var[C('VAR_ACTION')]);
+            $_GET   =   array_merge($var,$_GET);
+            return $action;
+        }
+    }
+
+    // 解析正则路由
+    // '路由正则'=>'[分组/模块/操作]?参数1=值1&参数2=值2...'
+    // '路由正则'=>array('[分组/模块/操作]?参数1=值1&参数2=值2...','额外参数1=值1&额外参数2=值2...')
+    // '路由正则'=>'外部地址'
+    // '路由正则'=>array('外部地址','重定向代码')
+    // 参数值和外部地址中可以用动态变量 采用 :1 :2 的方式
+    // '/new\/(\d+)\/(\d+)/'=>array('News/read?id=:1&page=:2&cate=1','status=1'),
+    // '/new\/(\d+)/'=>array('/new.php?id=:1&page=:2&status=1','301'), 重定向
+    private function parseRegex($matches,$route,$regx) {
+        // 获取路由地址规则
+        $url   =  is_array($route)?$route[0]:$route;
+        $url   =  preg_replace('/:(\d+)/e','$matches[\\1]',$url);
+        if(0=== strpos($url,'/') || 0===strpos($url,'http')) { // 路由重定向跳转
+            header("Location: $url", true,(is_array($route) && isset($route[1]))?$route[1]:301);
+            exit;
+        }else{
+            // 解析路由地址
+            $var    =   $this->parseUrl($url);
+            // 解析剩余的URL参数
+            $regx   =   substr_replace($regx,'',0,strlen($matches[0]));
+            if($regx) {
+                preg_replace('@(\w+)\/([^,\/]+)@e', '$var[strtolower(\'\\1\')]=strip_tags(\'\\2\');', $regx);
+            }
+            // 解析路由自动传入参数
+            if(is_array($route) && isset($route[1])) {
+                parse_str($route[1],$params);
+                $var   =   array_merge($var,$params);
+            }
+            $action =   $var[C('VAR_ACTION')];
+            unset($var[C('VAR_ACTION')]);
+            $_GET   =   array_merge($var,$_GET);
+        }
+        return $action;
+    }
+}

+ 77 - 0
ThinkPHP/Library/Behavior/CheckLangBehavior.class.php

@@ -0,0 +1,77 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 语言检测 并自动加载语言包
+ */
+class CheckLangBehavior {
+
+    // 行为扩展的执行入口必须是run
+    public function run(&$params){
+        // 检测语言
+        $this->checkLanguage();
+    }
+
+    /**
+     * 语言检查
+     * 检查浏览器支持语言,并自动加载语言包
+     * @access private
+     * @return void
+     */
+    private function checkLanguage() {
+        // 不开启语言包功能,仅仅加载框架语言文件直接返回
+        if (!C('LANG_SWITCH_ON',null,false)){
+            return;
+        }
+        $langSet = C('DEFAULT_LANG');
+        $varLang =  C('VAR_LANGUAGE',null,'l');
+        $langList = C('LANG_LIST',null,'zh-cn');
+        // 启用了语言包功能
+        // 根据是否启用自动侦测设置获取语言选择
+        if (C('LANG_AUTO_DETECT',null,true)){
+            if(isset($_GET[$varLang])){
+                $langSet = $_GET[$varLang];// url中设置了语言变量
+                cookie('think_language',$langSet,3600);
+            }elseif(cookie('think_language')){// 获取上次用户的选择
+                $langSet = cookie('think_language');
+            }elseif(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){// 自动侦测浏览器语言
+                preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);
+                $langSet = $matches[1];
+                cookie('think_language',$langSet,3600);
+            }
+            if(false === stripos($langList,$langSet)) { // 非法语言参数
+                $langSet = C('DEFAULT_LANG');
+            }
+        }
+        // 定义当前语言
+        define('LANG_SET',strtolower($langSet));
+
+        // 读取框架语言包
+        $file   =   THINK_PATH.'Lang/'.LANG_SET.'.php';
+        if(LANG_SET != C('DEFAULT_LANG') && is_file($file))
+            L(include $file);
+
+        // 读取应用公共语言包
+        $file   =  LANG_PATH.LANG_SET.'.php';
+        if(is_file($file))
+            L(include $file);
+        
+        // 读取模块语言包
+        $file   =   MODULE_PATH.'Lang/'.LANG_SET.'.php';
+        if(is_file($file))
+            L(include $file);
+
+        // 读取当前控制器语言包
+        $file   =   MODULE_PATH.'Lang/'.LANG_SET.'/'.strtolower(CONTROLLER_NAME).'.php';
+        if (is_file($file))
+            L(include $file);
+    }
+}

+ 610 - 0
ThinkPHP/Library/Behavior/ChromeShowPageTraceBehavior.class.php

@@ -0,0 +1,610 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: luofei614 <weibo.com/luofei614>
+// +----------------------------------------------------------------------
+// $Id$
+
+/**
+ * 将Trace信息输出到chrome浏览器的控制器,从而不影响ajax效果和页面的布局。
+ * 使用前,你需要先安装 chrome log 这个插件: http://craig.is/writing/chrome-logger。
+ * 定义应用的tags.php文件 Application/Common/Conf/tags.php, 
+ * <code>
+ * <?php return array(
+ *   'app_end'=>array(
+ *       'Behavior\ChromeShowPageTrace'
+ *   )
+ * );
+ * </code>
+ * 如果trace信息没有正常输出,请查看您的日志。
+ * 这是通过http headers和chrome通信,所以要保证在输出trace信息之前不能有
+ * headers输出,你可以在入口文件第一行加入代码 ob_start(); 或者配置output_buffering
+ *
+ */
+namespace Behavior;
+use Think\Log;
+
+/**
+ * 系统行为扩展 页面Trace显示输出
+ */
+class ChromeShowPageTraceBehavior {
+
+    protected $tracePageTabs =  array('BASE'=>'基本','FILE'=>'文件','INFO'=>'流程','ERR|NOTIC'=>'错误','SQL'=>'SQL','DEBUG'=>'调试');
+
+    // 行为扩展的执行入口必须是run
+    public function run(&$params){
+        if(C('SHOW_PAGE_TRACE')) $this->showTrace();
+    }
+
+   
+    /**
+     * 显示页面Trace信息
+     * @access private
+     */
+    private function showTrace() {
+         // 系统默认显示信息
+        $files  =  get_included_files();
+        $info   =   array();
+        foreach ($files as $key=>$file){
+            $info[] = $file.' ( '.number_format(filesize($file)/1024,2).' KB )';
+        }
+        $trace  =   array();
+        $base   =   array(
+            '请求信息'  =>  date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).' '.$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['REQUEST_METHOD'].' : '.__SELF__,
+            '运行时间'  =>  $this->showTime(),
+			'吞吐率'	=>	number_format(1/G('beginTime','viewEndTime'),2).'req/s',
+            '内存开销'  =>  MEMORY_LIMIT_ON?number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024,2).' kb':'不支持',
+            '查询信息'  =>  N('db_query').' queries '.N('db_write').' writes ',
+            '文件加载'  =>  count(get_included_files()),
+            '缓存信息'  =>  N('cache_read').' gets '.N('cache_write').' writes ',
+            '配置加载'  =>  count(c()),
+            '会话信息'  =>  'SESSION_ID='.session_id(),
+            );
+        // 读取应用定义的Trace文件
+        $traceFile  =   COMMON_PATH.'Conf/trace.php';
+        if(is_file($traceFile)) {
+            $base   =   array_merge($base,include $traceFile);
+        }
+
+        $debug  =   trace();
+        $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePageTabs);
+        foreach ($tabs as $name=>$title){
+            switch(strtoupper($name)) {
+                case 'BASE':// 基本信息
+                    $trace[$title]  =   $base;
+                    break;
+                case 'FILE': // 文件信息
+                    $trace[$title]  =   $info;
+                    break;
+                default:// 调试信息
+                    $name       =   strtoupper($name);
+                    if(strpos($name,'|')) {// 多组信息
+                        $array  =   explode('|',$name);
+                        $result =   array();
+                        foreach($array as $name){
+                            $result   +=   isset($debug[$name])?$debug[$name]:array();
+                        }
+                        $trace[$title]  =   $result;
+                    }else{
+                        $trace[$title]  =   isset($debug[$name])?$debug[$name]:'';
+                    }
+            }
+        }
+      chrome_debug('TRACE信息:'.__SELF__,'group');
+        //输出日志
+        foreach($trace as $title=>$log){
+            '错误'==$title?chrome_debug($title,'group'):chrome_debug($title,'groupCollapsed');
+            foreach($log as $i=>$logstr){
+                chrome_debug($i.'.'.$logstr,'log');
+            }
+            chrome_debug('','groupEnd');
+        }
+       chrome_debug('','groupEnd');
+        if($save = C('PAGE_TRACE_SAVE')) { // 保存页面Trace日志
+            if(is_array($save)) {// 选择选项卡保存
+                $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePageTabs);
+                $array  =   array();
+                foreach ($save as $tab){
+                    $array[] =   $tabs[$tab];
+                }
+            }
+            $content    =   date('[ c ]').' '.get_client_ip().' '.$_SERVER['REQUEST_URI']."\r\n";
+            foreach ($trace as $key=>$val){
+                if(!isset($array) || in_array($key,$array)) {
+                    $content    .=  '[ '.$key." ]\r\n";
+                    if(is_array($val)) {
+                        foreach ($val as $k=>$v){
+                            $content .= (!is_numeric($k)?$k.':':'').print_r($v,true)."\r\n";
+                        }
+                    }else{
+                        $content .= print_r($val,true)."\r\n";
+                    }
+                    $content .= "\r\n";
+                }
+            }
+            error_log(str_replace('<br/>',"\r\n",$content), 3,LOG_PATH.date('y_m_d').'_trace.log');
+        }
+        unset($files,$info,$base);
+    }
+
+    /**
+     * 获取运行时间
+     */
+    private function showTime() {
+        // 显示运行时间
+        G('beginTime',$GLOBALS['_beginTime']);
+        G('viewEndTime');
+        // 显示详细运行时间
+        return G('beginTime','viewEndTime').'s ( Load:'.G('beginTime','loadTime').'s Init:'.G('loadTime','initTime').'s Exec:'.G('initTime','viewStartTime').'s Template:'.G('viewStartTime','viewEndTime').'s )';
+    }
+}
+if(!function_exists('chrome_debug')){
+//ChromePhp 输出trace的函数
+function chrome_debug($msg,$type='trace',$trace_level=1){
+    if('trace'==$type){
+        ChromePhp::groupCollapsed($msg);
+        $traces=debug_backtrace(false);
+        $traces=array_reverse($traces);
+        $max=count($traces)-$trace_level;
+        for($i=0;$i<$max;$i++){
+            $trace=$traces[$i];
+            $fun=isset($trace['class'])?$trace['class'].'::'.$trace['function']:$trace['function'];
+            $file=isset($trace['file'])?$trace['file']:'unknown file';
+            $line=isset($trace['line'])?$trace['line']:'unknown line';
+            $trace_msg='#'.$i.'  '.$fun.' called at ['.$file.':'.$line.']';
+            if(!empty($trace['args'])){
+                ChromePhp::groupCollapsed($trace_msg);
+                ChromePhp::log($trace['args']);
+                ChromePhp::groupEnd();
+            }else{
+                ChromePhp::log($trace_msg);
+            }
+        }
+        ChromePhp::groupEnd();
+    }else{
+        if(method_exists('Behavior\ChromePhp',$type)){
+            //支持type trace,warn,log,error,group, groupCollapsed, groupEnd等
+            call_user_func(array('Behavior\ChromePhp',$type),$msg);
+        }else{
+            //如果type不为trace,warn,log等,则为log的标签
+            call_user_func_array(array('Behavior\ChromePhp','log'),func_get_args());
+        }
+    }
+}
+
+
+ 
+/**
+ * Server Side Chrome PHP debugger class
+ *
+ * @package ChromePhp
+ * @author Craig Campbell <iamcraigcampbell@gmail.com>
+ */
+class ChromePhp{
+    /**
+     * @var string
+     */
+    const VERSION = '4.1.0';
+
+    /**
+     * @var string
+     */
+    const HEADER_NAME = 'X-ChromeLogger-Data';
+
+    /**
+     * @var string
+     */
+    const BACKTRACE_LEVEL = 'backtrace_level';
+
+    /**
+     * @var string
+     */
+    const LOG = 'log';
+
+    /**
+     * @var string
+     */
+    const WARN = 'warn';
+
+    /**
+     * @var string
+     */
+    const ERROR = 'error';
+
+    /**
+     * @var string
+     */
+    const GROUP = 'group';
+
+    /**
+     * @var string
+     */
+    const INFO = 'info';
+
+    /**
+     * @var string
+     */
+    const GROUP_END = 'groupEnd';
+
+    /**
+     * @var string
+     */
+    const GROUP_COLLAPSED = 'groupCollapsed';
+
+    /**
+     * @var string
+     */
+    const TABLE = 'table';
+
+    /**
+     * @var string
+     */
+    protected $_php_version;
+
+    /**
+     * @var int
+     */
+    protected $_timestamp;
+
+    /**
+     * @var array
+     */
+    protected $_json = array(
+        'version' => self::VERSION,
+        'columns' => array('log', 'backtrace', 'type'),
+        'rows' => array()
+    );
+
+    /**
+     * @var array
+     */
+    protected $_backtraces = array();
+
+    /**
+     * @var bool
+     */
+    protected $_error_triggered = false;
+
+    /**
+     * @var array
+     */
+    protected $_settings = array(
+        self::BACKTRACE_LEVEL => 1
+    );
+
+    /**
+     * @var ChromePhp
+     */
+    protected static $_instance;
+
+    /**
+     * Prevent recursion when working with objects referring to each other
+     *
+     * @var array
+     */
+    protected $_processed = array();
+
+    /**
+     * constructor
+     */
+    private function __construct()
+    {
+        $this->_php_version = phpversion();
+        $this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time();
+        $this->_json['request_uri'] = $_SERVER['REQUEST_URI'];
+    }
+
+    /**
+     * gets instance of this class
+     *
+     * @return ChromePhp
+     */
+    public static function getInstance()
+    {
+        if (self::$_instance === null) {
+            self::$_instance = new self();
+        }
+        return self::$_instance;
+    }
+
+    /**
+     * logs a variable to the console
+     *
+     * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
+     * @return void
+     */
+    public static function log()
+    {
+        $args = func_get_args();
+        return self::_log('', $args);
+    }
+
+    /**
+     * logs a warning to the console
+     *
+     * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
+     * @return void
+     */
+    public static function warn()
+    {
+        $args = func_get_args();
+        return self::_log(self::WARN, $args);
+    }
+
+    /**
+     * logs an error to the console
+     *
+     * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
+     * @return void
+     */
+    public static function error()
+    {
+        $args = func_get_args();
+        return self::_log(self::ERROR, $args);
+    }
+
+    /**
+     * sends a group log
+     *
+     * @param string value
+     */
+    public static function group()
+    {
+        $args = func_get_args();
+        return self::_log(self::GROUP, $args);
+    }
+
+    /**
+     * sends an info log
+     *
+     * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
+     * @return void
+     */
+    public static function info()
+    {
+        $args = func_get_args();
+        return self::_log(self::INFO, $args);
+    }
+
+    /**
+     * sends a collapsed group log
+     *
+     * @param string value
+     */
+    public static function groupCollapsed()
+    {
+        $args = func_get_args();
+        return self::_log(self::GROUP_COLLAPSED, $args);
+    }
+
+    /**
+     * ends a group log
+     *
+     * @param string value
+     */
+    public static function groupEnd()
+    {
+        $args = func_get_args();
+        return self::_log(self::GROUP_END, $args);
+    }
+
+    /**
+     * sends a table log
+     *
+     * @param string value
+     */
+    public static function table()
+    {
+        $args = func_get_args();
+        return self::_log(self::TABLE, $args);
+    }
+
+    /**
+     * internal logging call
+     *
+     * @param string $type
+     * @return void
+     */
+    protected static function _log($type, array $args)
+    {
+        // nothing passed in, don't do anything
+        if (count($args) == 0 && $type != self::GROUP_END) {
+            return;
+        }
+
+        $logger = self::getInstance();
+
+        $logger->_processed = array();
+
+        $logs = array();
+        foreach ($args as $arg) {
+            $logs[] = $logger->_convert($arg);
+        }
+
+        $backtrace = debug_backtrace(false);
+        $level = $logger->getSetting(self::BACKTRACE_LEVEL);
+
+        $backtrace_message = 'unknown';
+        if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) {
+            $backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line'];
+        }
+
+        $logger->_addRow($logs, $backtrace_message, $type);
+    }
+
+    /**
+     * converts an object to a better format for logging
+     *
+     * @param Object
+     * @return array
+     */
+    protected function _convert($object)
+    {
+        // if this isn't an object then just return it
+        if (!is_object($object)) {
+            return $object;
+        }
+
+        //Mark this object as processed so we don't convert it twice and it
+        //Also avoid recursion when objects refer to each other
+        $this->_processed[] = $object;
+
+        $object_as_array = array();
+
+        // first add the class name
+        $object_as_array['___class_name'] = get_class($object);
+
+        // loop through object vars
+        $object_vars = get_object_vars($object);
+        foreach ($object_vars as $key => $value) {
+
+            // same instance as parent object
+            if ($value === $object || in_array($value, $this->_processed, true)) {
+                $value = 'recursion - parent object [' . get_class($value) . ']';
+            }
+            $object_as_array[$key] = $this->_convert($value);
+        }
+
+        $reflection = new ReflectionClass($object);
+
+        // loop through the properties and add those
+        foreach ($reflection->getProperties() as $property) {
+
+            // if one of these properties was already added above then ignore it
+            if (array_key_exists($property->getName(), $object_vars)) {
+                continue;
+            }
+            $type = $this->_getPropertyKey($property);
+
+            if ($this->_php_version >= 5.3) {
+                $property->setAccessible(true);
+            }
+
+            try {
+                $value = $property->getValue($object);
+            } catch (ReflectionException $e) {
+                $value = 'only PHP 5.3 can access private/protected properties';
+            }
+
+            // same instance as parent object
+            if ($value === $object || in_array($value, $this->_processed, true)) {
+                $value = 'recursion - parent object [' . get_class($value) . ']';
+            }
+
+            $object_as_array[$type] = $this->_convert($value);
+        }
+        return $object_as_array;
+    }
+
+    /**
+     * takes a reflection property and returns a nicely formatted key of the property name
+     *
+     * @param ReflectionProperty
+     * @return string
+     */
+    protected function _getPropertyKey(ReflectionProperty $property)
+    {
+        $static = $property->isStatic() ? ' static' : '';
+        if ($property->isPublic()) {
+            return 'public' . $static . ' ' . $property->getName();
+        }
+
+        if ($property->isProtected()) {
+            return 'protected' . $static . ' ' . $property->getName();
+        }
+
+        if ($property->isPrivate()) {
+            return 'private' . $static . ' ' . $property->getName();
+        }
+    }
+
+    /**
+     * adds a value to the data array
+     *
+     * @var mixed
+     * @return void
+     */
+    protected function _addRow(array $logs, $backtrace, $type)
+    {
+        // if this is logged on the same line for example in a loop, set it to null to save space
+        if (in_array($backtrace, $this->_backtraces)) {
+            $backtrace = null;
+        }
+
+        // for group, groupEnd, and groupCollapsed
+        // take out the backtrace since it is not useful
+        if ($type == self::GROUP || $type == self::GROUP_END || $type == self::GROUP_COLLAPSED) {
+            $backtrace = null;
+        }
+
+        if ($backtrace !== null) {
+            $this->_backtraces[] = $backtrace;
+        }
+
+        $row = array($logs, $backtrace, $type);
+
+        $this->_json['rows'][] = $row;
+        $this->_writeHeader($this->_json);
+    }
+
+    protected function _writeHeader($data)
+    {
+        header(self::HEADER_NAME . ': ' . $this->_encode($data));
+    }
+
+    /**
+     * encodes the data to be sent along with the request
+     *
+     * @param array $data
+     * @return string
+     */
+    protected function _encode($data)
+    {
+        return base64_encode(utf8_encode(json_encode($data)));
+    }
+
+    /**
+     * adds a setting
+     *
+     * @param string key
+     * @param mixed value
+     * @return void
+     */
+    public function addSetting($key, $value)
+    {
+        $this->_settings[$key] = $value;
+    }
+
+    /**
+     * add ability to set multiple settings in one call
+     *
+     * @param array $settings
+     * @return void
+     */
+    public function addSettings(array $settings)
+    {
+        foreach ($settings as $key => $value) {
+            $this->addSetting($key, $value);
+        }
+    }
+
+    /**
+     * gets a setting
+     *
+     * @param string key
+     * @return mixed
+     */
+    public function getSetting($key)
+    {
+        if (!isset($this->_settings[$key])) {
+            return null;
+        }
+        return $this->_settings[$key];
+    }
+}
+}

+ 47 - 0
ThinkPHP/Library/Behavior/ContentReplaceBehavior.class.php

@@ -0,0 +1,47 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 系统行为扩展:模板内容输出替换
+ */
+class ContentReplaceBehavior {
+
+    // 行为扩展的执行入口必须是run
+    public function run(&$content){
+        $content = $this->templateContentReplace($content);
+    }
+
+    /**
+     * 模板内容替换
+     * @access protected
+     * @param string $content 模板内容
+     * @return string
+     */
+    protected function templateContentReplace($content) {
+        // 系统默认的特殊变量替换
+        $replace =  array(
+            '__ROOT__'      =>  __ROOT__,       // 当前网站地址
+            '__APP__'       =>  __APP__,        // 当前应用地址
+            '__MODULE__'    =>  __MODULE__,
+            '__ACTION__'    =>  __ACTION__,     // 当前操作地址
+            '__SELF__'      =>  htmlentities(__SELF__),       // 当前页面地址
+            '__CONTROLLER__'=>  __CONTROLLER__,
+            '__URL__'       =>  __CONTROLLER__,
+            '__PUBLIC__'    =>  __ROOT__.'/Public',// 站点公共目录
+        );
+        // 允许用户自定义模板的字符串替换
+        if(is_array(C('TMPL_PARSE_STRING')) )
+            $replace =  array_merge($replace,C('TMPL_PARSE_STRING'));
+        $content = str_replace(array_keys($replace),array_values($replace),$content);
+        return $content;
+    }
+
+}

+ 66 - 0
ThinkPHP/Library/Behavior/CronRunBehavior.class.php

@@ -0,0 +1,66 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 自动执行任务
+ */
+class CronRunBehavior {
+
+    public function run(&$params) {
+        // 锁定自动执行
+        $lockfile	 =	 RUNTIME_PATH.'cron.lock';
+        if(is_writable($lockfile) && filemtime($lockfile) > $_SERVER['REQUEST_TIME'] - C('CRON_MAX_TIME',null,60)) {
+            return ;
+        } else {
+            touch($lockfile);
+        }
+        set_time_limit(1000);
+        ignore_user_abort(true);
+
+        // 载入cron配置文件
+        // 格式 return array(
+        // 'cronname'=>array('filename',intervals,nextruntime),...
+        // );
+        if(is_file(RUNTIME_PATH.'~crons.php')) {
+            $crons	=	include RUNTIME_PATH.'~crons.php';
+        }elseif(is_file(COMMON_PATH.'Conf/crons.php')){
+            $crons	=	include COMMON_PATH.'Conf/crons.php';
+        }
+        if(isset($crons) && is_array($crons)) {
+            $update	 =	 false;
+            $log	=	array();
+            foreach ($crons as $key=>$cron){
+                if(empty($cron[2]) || $_SERVER['REQUEST_TIME']>=$cron[2]) {
+                    // 到达时间 执行cron文件
+                    G('cronStart');
+                    include COMMON_PATH.'Cron/'.$cron[0].'.php';
+                    G('cronEnd');
+                    $_useTime	 =	 G('cronStart','cronEnd', 6);
+                    // 更新cron记录
+                    $cron[2]	=	$_SERVER['REQUEST_TIME']+$cron[1];
+                    $crons[$key]	=	$cron;
+                    $log[] = "Cron:$key Runat ".date('Y-m-d H:i:s')." Use $_useTime s\n";
+                    $update	 =	 true;
+                }
+            }
+            if($update) {
+                // 记录Cron执行日志
+                \Think\Log::write(implode('',$log));
+                // 更新cron文件
+                $content  = "<?php\nreturn ".var_export($crons,true).";\n?>";
+                file_put_contents(RUNTIME_PATH.'~crons.php',$content);
+            }
+        }
+        // 解除锁定
+        unlink($lockfile);
+        return ;
+    }
+}

+ 2079 - 0
ThinkPHP/Library/Behavior/FireShowPageTraceBehavior.class.php

@@ -0,0 +1,2079 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: luofei614 <weibo.com/luofei614>
+// +----------------------------------------------------------------------
+// $Id$
+
+/**
+ * 将Trace信息输出到火狐的firebug,从而不影响ajax效果和页面的布局。
+ * 使用前,你需要先在火狐浏览器上安装firebug和firePHP两个插件。
+ * 定义应用的tags.php文件, 
+ * <code>
+ * <?php return array(
+ *   'app_end'=>array(
+ *       'FireShowPageTrace'
+ *   )
+ * );
+ * </code>
+ * 再将此文件放到应用的Behavior文件夹中即可
+ * 如果trace信息没有正常输出,请查看您的日志。
+ * firePHP,是通过http headers和firebug通讯的,所以要保证在输出trace信息之前不能有
+ * headers输出,你可以在入口文件第一行加入代码 ob_start(); 或者配置output_buffering
+ *
+ */
+namespace Behavior;
+/**
+ * 系统行为扩展 页面Trace显示输出
+ */
+class FireShowPageTraceBehavior {
+    protected $tracePagTabs =   array('BASE'=>'基本','FILE'=>'文件','INFO'=>'流程','ERR|NOTIC'=>'错误','SQL'=>'SQL','DEBUG'=>'调试');
+
+    // 行为扩展的执行入口必须是run
+    public function run(&$params){
+        if(C('FIRE_SHOW_PAGE_TRACE',null,true)) $this->showTrace();
+    }
+
+    /**
+     * 显示页面Trace信息
+     * @access private
+     */
+    private function showTrace() {
+         // 系统默认显示信息
+        $files =  get_included_files();
+        $info   =   array();
+        foreach ($files as $key=>$file){
+            $info[] = $file.' ( '.number_format(filesize($file)/1024,2).' KB )';
+        }
+        $trace  =   array();
+        $base   =   array(
+            '请求信息'=>  date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).' '.$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['REQUEST_METHOD'].' : '.__SELF__,
+            '运行时间'=> $this->showTime(),
+            '内存开销'=> MEMORY_LIMIT_ON?number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024,2).' kb':'不支持',
+            '查询信息'=> N('db_query').' queries '.N('db_write').' writes ',
+            '文件加载'=> count(get_included_files()),
+            '缓存信息'=> N('cache_read').' gets '.N('cache_write').' writes ',
+            '配置加载'=> count(c()),
+            '会话信息'=> 'SESSION_ID='.session_id(),
+            );
+        // 读取应用定义的Trace文件
+        $traceFile  =   CONF_PATH.'trace.php';
+        if(is_file($traceFile)) {
+            $base    =   array_merge($base,include $traceFile);
+        }
+        $debug  =   trace();
+        $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePagTabs);
+        foreach ($tabs as $name=>$title){
+            switch(strtoupper($name)) {
+                case 'BASE':// 基本信息
+                    $trace[$title]  =   $base;
+                    break;
+                case 'FILE': // 文件信息
+                    $trace[$title]  =   $info;
+                    break;
+                default:// 调试信息
+                    if(strpos($name,'|')) {// 多组信息
+                        $array  =   explode('|',$name);
+                        $result =   array();
+                        foreach($array as $name){
+                            $result   +=   isset($debug[$name])?$debug[$name]:array();
+                        }
+                        $trace[$title]  =   $result;
+                    }else{
+                        $trace[$title]  =   isset($debug[$name])?$debug[$name]:'';
+                    }
+            }
+        }
+    foreach ($trace as $key=>$val){
+            if(!is_array($val) && empty($val))
+                $val=array();
+            if(is_array($val)){
+            $fire=array(
+            array('','')
+            );
+            foreach($val as $k=>$v){
+                $fire[]=array($k,$v);
+            }
+            fb(array($key,$fire),FirePHP::TABLE);
+        }else{
+            fb($val,$key);
+        }
+     }
+    unset($files,$info,$log,$base);
+    }
+
+    /**
+     * 获取运行时间
+     */
+    private function showTime() {
+        // 显示运行时间
+        G('beginTime',$GLOBALS['_beginTime']);
+        G('viewEndTime');
+        // 显示详细运行时间
+        return G('beginTime','viewEndTime').'s ( Load:'.G('beginTime','loadTime').'s Init:'.G('loadTime','initTime').'s Exec:'.G('initTime','viewStartTime').'s Template:'.G('viewStartTime','viewEndTime').'s )';
+    }
+
+}
+
+
+function fb()
+{
+    $instance = FirePHP::getInstance(true);
+  
+    $args = func_get_args();
+    return call_user_func_array(array($instance,'fb'),$args);
+}
+
+
+class FB
+{
+    /**
+     * Enable and disable logging to Firebug
+     * 
+     * @see FirePHP->setEnabled()
+     * @param boolean $Enabled TRUE to enable, FALSE to disable
+     * @return void
+     */
+    public static function setEnabled($Enabled)
+    {
+        $instance = FirePHP::getInstance(true);
+        $instance->setEnabled($Enabled);
+    }
+  
+    /**
+     * Check if logging is enabled
+     * 
+     * @see FirePHP->getEnabled()
+     * @return boolean TRUE if enabled
+     */
+    public static function getEnabled()
+    {
+        $instance = FirePHP::getInstance(true);
+        return $instance->getEnabled();
+    }  
+  
+    /**
+     * Specify a filter to be used when encoding an object
+     * 
+     * Filters are used to exclude object members.
+     * 
+     * @see FirePHP->setObjectFilter()
+     * @param string $Class The class name of the object
+     * @param array $Filter An array or members to exclude
+     * @return void
+     */
+    public static function setObjectFilter($Class, $Filter)
+    {
+      $instance = FirePHP::getInstance(true);
+      $instance->setObjectFilter($Class, $Filter);
+    }
+  
+    /**
+     * Set some options for the library
+     * 
+     * @see FirePHP->setOptions()
+     * @param array $Options The options to be set
+     * @return void
+     */
+    public static function setOptions($Options)
+    {
+        $instance = FirePHP::getInstance(true);
+        $instance->setOptions($Options);
+    }
+
+    /**
+     * Get options for the library
+     * 
+     * @see FirePHP->getOptions()
+     * @return array The options
+     */
+    public static function getOptions()
+    {
+        $instance = FirePHP::getInstance(true);
+        return $instance->getOptions();
+    }
+
+    /**
+     * Log object to firebug
+     * 
+     * @see http://www.firephp.org/Wiki/Reference/Fb
+     * @param mixed $Object
+     * @return true
+     * @throws Exception
+     */
+    public static function send()
+    {
+        $instance = FirePHP::getInstance(true);
+        $args = func_get_args();
+        return call_user_func_array(array($instance,'fb'),$args);
+    }
+
+    /**
+     * Start a group for following messages
+     * 
+     * Options:
+     *   Collapsed: [true|false]
+     *   Color:     [#RRGGBB|ColorName]
+     *
+     * @param string $Name
+     * @param array $Options OPTIONAL Instructions on how to log the group
+     * @return true
+     */
+    public static function group($Name, $Options=null)
+    {
+        $instance = FirePHP::getInstance(true);
+        return $instance->group($Name, $Options);
+    }
+
+    /**
+     * Ends a group you have started before
+     *
+     * @return true
+     * @throws Exception
+     */
+    public static function groupEnd()
+    {
+        return self::send(null, null, FirePHP::GROUP_END);
+    }
+
+    /**
+     * Log object with label to firebug console
+     *
+     * @see FirePHP::LOG
+     * @param mixes $Object
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public static function log($Object, $Label=null)
+    {
+        return self::send($Object, $Label, FirePHP::LOG);
+    } 
+
+    /**
+     * Log object with label to firebug console
+     *
+     * @see FirePHP::INFO
+     * @param mixes $Object
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public static function info($Object, $Label=null)
+    {
+        return self::send($Object, $Label, FirePHP::INFO);
+    } 
+
+    /**
+     * Log object with label to firebug console
+     *
+     * @see FirePHP::WARN
+     * @param mixes $Object
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public static function warn($Object, $Label=null)
+    {
+        return self::send($Object, $Label, FirePHP::WARN);
+    } 
+
+    /**
+     * Log object with label to firebug console
+     *
+     * @see FirePHP::ERROR
+     * @param mixes $Object
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public static function error($Object, $Label=null)
+    {
+        return self::send($Object, $Label, FirePHP::ERROR);
+    } 
+
+    /**
+     * Dumps key and variable to firebug server panel
+     *
+     * @see FirePHP::DUMP
+     * @param string $Key
+     * @param mixed $Variable
+     * @return true
+     * @throws Exception
+     */
+    public static function dump($Key, $Variable)
+    {
+        return self::send($Variable, $Key, FirePHP::DUMP);
+    } 
+
+    /**
+     * Log a trace in the firebug console
+     *
+     * @see FirePHP::TRACE
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public static function trace($Label)
+    {
+        return self::send($Label, FirePHP::TRACE);
+    } 
+
+    /**
+     * Log a table in the firebug console
+     *
+     * @see FirePHP::TABLE
+     * @param string $Label
+     * @param string $Table
+     * @return true
+     * @throws Exception
+     */
+    public static function table($Label, $Table)
+    {
+        return self::send($Table, $Label, FirePHP::TABLE);
+    } 
+
+}
+
+if (!defined('E_STRICT')) {
+    define('E_STRICT', 2048);
+}
+if (!defined('E_RECOVERABLE_ERROR')) {
+    define('E_RECOVERABLE_ERROR', 4096);
+}
+if (!defined('E_DEPRECATED')) {
+    define('E_DEPRECATED', 8192);
+}
+if (!defined('E_USER_DEPRECATED')) {
+    define('E_USER_DEPRECATED', 16384);
+} 
+ 
+/**
+ * Sends the given data to the FirePHP Firefox Extension.
+ * The data can be displayed in the Firebug Console or in the
+ * "Server" request tab.
+ * 
+ * For more information see: http://www.firephp.org/
+ * 
+ * @copyright       Copyright (C) 2007-2009 Christoph Dorn
+ * @author          Christoph Dorn <christoph@christophdorn.com>
+ * @license         http://www.opensource.org/licenses/bsd-license.php
+ * @package         FirePHPCore
+ */
+class FirePHP {
+
+    /**
+     * FirePHP version
+     *
+     * @var string
+     */
+    const VERSION = '0.3';    // @pinf replace '0.3' with '%%package.version%%'
+
+    /**
+     * Firebug LOG level
+     *
+     * Logs a message to firebug console.
+     * 
+     * @var string
+     */
+    const LOG = 'LOG';
+  
+    /**
+     * Firebug INFO level
+     *
+     * Logs a message to firebug console and displays an info icon before the message.
+     * 
+     * @var string
+     */
+    const INFO = 'INFO';
+    
+    /**
+     * Firebug WARN level
+     *
+     * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise.
+     * 
+     * @var string
+     */
+    const WARN = 'WARN';
+    
+    /**
+     * Firebug ERROR level
+     *
+     * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.
+     * 
+     * @var string
+     */
+    const ERROR = 'ERROR';
+    
+    /**
+     * Dumps a variable to firebug's server panel
+     *
+     * @var string
+     */
+    const DUMP = 'DUMP';
+    
+    /**
+     * Displays a stack trace in firebug console
+     *
+     * @var string
+     */
+    const TRACE = 'TRACE';
+    
+    /**
+     * Displays an exception in firebug console
+     * 
+     * Increments the firebug error count.
+     *
+     * @var string
+     */
+    const EXCEPTION = 'EXCEPTION';
+    
+    /**
+     * Displays an table in firebug console
+     *
+     * @var string
+     */
+    const TABLE = 'TABLE';
+    
+    /**
+     * Starts a group in firebug console
+     * 
+     * @var string
+     */
+    const GROUP_START = 'GROUP_START';
+    
+    /**
+     * Ends a group in firebug console
+     * 
+     * @var string
+     */
+    const GROUP_END = 'GROUP_END';
+    
+    /**
+     * Singleton instance of FirePHP
+     *
+     * @var FirePHP
+     */
+    protected static $instance = null;
+    
+    /**
+     * Flag whether we are logging from within the exception handler
+     * 
+     * @var boolean
+     */
+    protected $inExceptionHandler = false;
+    
+    /**
+     * Flag whether to throw PHP errors that have been converted to ErrorExceptions
+     * 
+     * @var boolean
+     */
+    protected $throwErrorExceptions = true;
+    
+    /**
+     * Flag whether to convert PHP assertion errors to Exceptions
+     * 
+     * @var boolean
+     */
+    protected $convertAssertionErrorsToExceptions = true;
+    
+    /**
+     * Flag whether to throw PHP assertion errors that have been converted to Exceptions
+     * 
+     * @var boolean
+     */
+    protected $throwAssertionExceptions = false;
+
+    /**
+     * Wildfire protocol message index
+     *
+     * @var int
+     */
+    protected $messageIndex = 1;
+    
+    /**
+     * Options for the library
+     * 
+     * @var array
+     */
+    protected $options = array('maxDepth' => 10,
+                               'maxObjectDepth' => 5,
+                               'maxArrayDepth' => 5,
+                               'useNativeJsonEncode' => true,
+                               'includeLineNumbers' => true);
+
+    /**
+     * Filters used to exclude object members when encoding
+     * 
+     * @var array
+     */
+    protected $objectFilters = array(
+        'firephp' => array('objectStack', 'instance', 'json_objectStack'),
+        'firephp_test_class' => array('objectStack', 'instance', 'json_objectStack')
+    );
+
+    /**
+     * A stack of objects used to detect recursion during object encoding
+     * 
+     * @var object
+     */
+    protected $objectStack = array();
+
+    /**
+     * Flag to enable/disable logging
+     * 
+     * @var boolean
+     */
+    protected $enabled = true;
+
+    /**
+     * The insight console to log to if applicable
+     * 
+     * @var object
+     */
+    protected $logToInsightConsole = null;
+
+    /**
+     * When the object gets serialized only include specific object members.
+     * 
+     * @return array
+     */  
+    public function __sleep()
+    {
+        return array('options','objectFilters','enabled');
+    }
+    
+    /**
+     * Gets singleton instance of FirePHP
+     *
+     * @param boolean $AutoCreate
+     * @return FirePHP
+     */
+    public static function getInstance($AutoCreate = false)
+    {
+        if ($AutoCreate===true && !self::$instance) {
+            self::init();
+        }
+        return self::$instance;
+    }
+    
+    /**
+     * Creates FirePHP object and stores it for singleton access
+     *
+     * @return FirePHP
+     */
+    public static function init()
+    {
+        return self::setInstance(new self());
+    }
+
+    /**
+     * Set the instance of the FirePHP singleton
+     * 
+     * @param FirePHP $instance The FirePHP object instance
+     * @return FirePHP
+     */
+    public static function setInstance($instance)
+    {
+        return self::$instance = $instance;
+    }
+
+    /**
+     * Set an Insight console to direct all logging calls to
+     * 
+     * @param object $console The console object to log to
+     * @return void
+     */
+    public function setLogToInsightConsole($console)
+    {
+        if(is_string($console)) {
+            if(get_class($this)!='FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) {
+                throw new Exception('FirePHP instance not an instance or subclass of FirePHP_Insight!');
+            }
+            $this->logToInsightConsole = $this->to('request')->console($console);
+        } else {
+            $this->logToInsightConsole = $console;
+        }
+    }
+
+    /**
+     * Enable and disable logging to Firebug
+     * 
+     * @param boolean $Enabled TRUE to enable, FALSE to disable
+     * @return void
+     */
+    public function setEnabled($Enabled)
+    {
+       $this->enabled = $Enabled;
+    }
+    
+    /**
+     * Check if logging is enabled
+     * 
+     * @return boolean TRUE if enabled
+     */
+    public function getEnabled()
+    {
+        return $this->enabled;
+    }
+    
+    /**
+     * Specify a filter to be used when encoding an object
+     * 
+     * Filters are used to exclude object members.
+     * 
+     * @param string $Class The class name of the object
+     * @param array $Filter An array of members to exclude
+     * @return void
+     */
+    public function setObjectFilter($Class, $Filter)
+    {
+        $this->objectFilters[strtolower($Class)] = $Filter;
+    }
+  
+    /**
+     * Set some options for the library
+     * 
+     * Options:
+     *  - maxDepth: The maximum depth to traverse (default: 10)
+     *  - maxObjectDepth: The maximum depth to traverse objects (default: 5)
+     *  - maxArrayDepth: The maximum depth to traverse arrays (default: 5)
+     *  - useNativeJsonEncode: If true will use json_encode() (default: true)
+     *  - includeLineNumbers: If true will include line numbers and filenames (default: true)
+     * 
+     * @param array $Options The options to be set
+     * @return void
+     */
+    public function setOptions($Options)
+    {
+        $this->options = array_merge($this->options,$Options);
+    }
+
+    /**
+     * Get options from the library
+     *
+     * @return array The currently set options
+     */
+    public function getOptions()
+    {
+        return $this->options;
+    }
+
+    /**
+     * Set an option for the library
+     * 
+     * @param string $Name
+     * @param mixed $Value
+     * @throws Exception
+     * @return void
+     */  
+    public function setOption($Name, $Value)
+    {
+        if (!isset($this->options[$Name])) {
+            throw $this->newException('Unknown option: ' . $Name);
+        }
+        $this->options[$Name] = $Value;
+    }
+
+    /**
+     * Get an option from the library
+     *
+     * @param string $Name
+     * @throws Exception
+     * @return mixed
+     */
+    public function getOption($Name)
+    {
+        if (!isset($this->options[$Name])) {
+            throw $this->newException('Unknown option: ' . $Name);
+        }
+        return $this->options[$Name];
+    }
+
+    /**
+     * Register FirePHP as your error handler
+     * 
+     * Will throw exceptions for each php error.
+     * 
+     * @return mixed Returns a string containing the previously defined error handler (if any)
+     */
+    public function registerErrorHandler($throwErrorExceptions = false)
+    {
+        //NOTE: The following errors will not be caught by this error handler:
+        //      E_ERROR, E_PARSE, E_CORE_ERROR,
+        //      E_CORE_WARNING, E_COMPILE_ERROR,
+        //      E_COMPILE_WARNING, E_STRICT
+    
+        $this->throwErrorExceptions = $throwErrorExceptions;
+    
+        return set_error_handler(array($this,'errorHandler'));     
+    }
+
+    /**
+     * FirePHP's error handler
+     * 
+     * Throws exception for each php error that will occur.
+     *
+     * @param int $errno
+     * @param string $errstr
+     * @param string $errfile
+     * @param int $errline
+     * @param array $errcontext
+     */
+    public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
+    {
+        // Don't throw exception if error reporting is switched off
+        if (error_reporting() == 0) {
+            return;
+        }
+        // Only throw exceptions for errors we are asking for
+        if (error_reporting() & $errno) {
+
+            $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline);
+            if ($this->throwErrorExceptions) {
+                throw $exception;
+            } else {
+                $this->fb($exception);
+            }
+        }
+    }
+  
+    /**
+     * Register FirePHP as your exception handler
+     * 
+     * @return mixed Returns the name of the previously defined exception handler,
+     *               or NULL on error.
+     *               If no previous handler was defined, NULL is also returned.
+     */
+    public function registerExceptionHandler()
+    {
+        return set_exception_handler(array($this,'exceptionHandler'));     
+    }
+  
+    /**
+     * FirePHP's exception handler
+     * 
+     * Logs all exceptions to your firebug console and then stops the script.
+     *
+     * @param Exception $Exception
+     * @throws Exception
+     */
+    function exceptionHandler($Exception)
+    {
+    
+        $this->inExceptionHandler = true;
+    
+        header('HTTP/1.1 500 Internal Server Error');
+    
+        try {
+            $this->fb($Exception);
+        } catch (Exception $e) {
+            echo 'We had an exception: ' . $e;
+        }
+        $this->inExceptionHandler = false;
+    }
+  
+    /**
+     * Register FirePHP driver as your assert callback
+     * 
+     * @param boolean $convertAssertionErrorsToExceptions
+     * @param boolean $throwAssertionExceptions
+     * @return mixed Returns the original setting or FALSE on errors
+     */
+    public function registerAssertionHandler($convertAssertionErrorsToExceptions = true, $throwAssertionExceptions = false)
+    {
+        $this->convertAssertionErrorsToExceptions = $convertAssertionErrorsToExceptions;
+        $this->throwAssertionExceptions = $throwAssertionExceptions;
+        
+        if ($throwAssertionExceptions && !$convertAssertionErrorsToExceptions) {
+            throw $this->newException('Cannot throw assertion exceptions as assertion errors are not being converted to exceptions!');
+        }
+        
+        return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler'));
+    }
+  
+    /**
+     * FirePHP's assertion handler
+     *
+     * Logs all assertions to your firebug console and then stops the script.
+     *
+     * @param string $file File source of assertion
+     * @param int    $line Line source of assertion
+     * @param mixed  $code Assertion code
+     */
+    public function assertionHandler($file, $line, $code)
+    {
+        if ($this->convertAssertionErrorsToExceptions) {
+          
+          $exception = new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line);
+    
+          if ($this->throwAssertionExceptions) {
+              throw $exception;
+          } else {
+              $this->fb($exception);
+          }
+        
+        } else {
+            $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line));
+        }
+    }
+  
+    /**
+     * Start a group for following messages.
+     * 
+     * Options:
+     *   Collapsed: [true|false]
+     *   Color:     [#RRGGBB|ColorName]
+     *
+     * @param string $Name
+     * @param array $Options OPTIONAL Instructions on how to log the group
+     * @return true
+     * @throws Exception
+     */
+    public function group($Name, $Options = null)
+    {
+    
+        if (!$Name) {
+            throw $this->newException('You must specify a label for the group!');
+        }
+        
+        if ($Options) {
+            if (!is_array($Options)) {
+                throw $this->newException('Options must be defined as an array!');
+            }
+            if (array_key_exists('Collapsed', $Options)) {
+                $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false';
+            }
+        }
+        
+        return $this->fb(null, $Name, FirePHP::GROUP_START, $Options);
+    }
+  
+    /**
+     * Ends a group you have started before
+     *
+     * @return true
+     * @throws Exception
+     */
+    public function groupEnd()
+    {
+        return $this->fb(null, null, FirePHP::GROUP_END);
+    }
+
+    /**
+     * Log object with label to firebug console
+     *
+     * @see FirePHP::LOG
+     * @param mixes $Object
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public function log($Object, $Label = null, $Options = array())
+    {
+        return $this->fb($Object, $Label, FirePHP::LOG, $Options);
+    } 
+
+    /**
+     * Log object with label to firebug console
+     *
+     * @see FirePHP::INFO
+     * @param mixes $Object
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public function info($Object, $Label = null, $Options = array())
+    {
+        return $this->fb($Object, $Label, FirePHP::INFO, $Options);
+    } 
+
+    /**
+     * Log object with label to firebug console
+     *
+     * @see FirePHP::WARN
+     * @param mixes $Object
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public function warn($Object, $Label = null, $Options = array())
+    {
+        return $this->fb($Object, $Label, FirePHP::WARN, $Options);
+    } 
+
+    /**
+     * Log object with label to firebug console
+     *
+     * @see FirePHP::ERROR
+     * @param mixes $Object
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public function error($Object, $Label = null, $Options = array())
+    {
+        return $this->fb($Object, $Label, FirePHP::ERROR, $Options);
+    } 
+
+    /**
+     * Dumps key and variable to firebug server panel
+     *
+     * @see FirePHP::DUMP
+     * @param string $Key
+     * @param mixed $Variable
+     * @return true
+     * @throws Exception
+     */
+    public function dump($Key, $Variable, $Options = array())
+    {
+        if (!is_string($Key)) {
+            throw $this->newException('Key passed to dump() is not a string');
+        }
+        if (strlen($Key)>100) {
+            throw $this->newException('Key passed to dump() is longer than 100 characters');
+        }
+        if (!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $Key, $m)) {
+            throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]');
+        }
+        return $this->fb($Variable, $Key, FirePHP::DUMP, $Options);
+    }
+  
+    /**
+     * Log a trace in the firebug console
+     *
+     * @see FirePHP::TRACE
+     * @param string $Label
+     * @return true
+     * @throws Exception
+     */
+    public function trace($Label)
+    {
+        return $this->fb($Label, FirePHP::TRACE);
+    } 
+
+    /**
+     * Log a table in the firebug console
+     *
+     * @see FirePHP::TABLE
+     * @param string $Label
+     * @param string $Table
+     * @return true
+     * @throws Exception
+     */
+    public function table($Label, $Table, $Options = array())
+    {
+        return $this->fb($Table, $Label, FirePHP::TABLE, $Options);
+    }
+
+    /**
+     * Insight API wrapper
+     * 
+     * @see Insight_Helper::to()
+     */
+    public static function to()
+    {
+        $instance = self::getInstance();
+        if (!method_exists($instance, "_to")) {
+            throw new Exception("FirePHP::to() implementation not loaded");
+        }
+        $args = func_get_args();
+        return call_user_func_array(array($instance, '_to'), $args);
+    }
+
+    /**
+     * Insight API wrapper
+     * 
+     * @see Insight_Helper::plugin()
+     */
+    public static function plugin()
+    {
+        $instance = self::getInstance();
+        if (!method_exists($instance, "_plugin")) {
+            throw new Exception("FirePHP::plugin() implementation not loaded");
+        }
+        $args = func_get_args();
+        return call_user_func_array(array($instance, '_plugin'), $args);
+    }
+
+    /**
+     * Check if FirePHP is installed on client
+     *
+     * @return boolean
+     */
+    public function detectClientExtension()
+    {
+        // Check if FirePHP is installed on client via User-Agent header
+        if (@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) &&
+           version_compare($m[1][0],'0.0.6','>=')) {
+            return true;
+        } else
+        // Check if FirePHP is installed on client via X-FirePHP-Version header
+        if (@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) &&
+           version_compare($m[1][0],'0.0.6','>=')) {
+            return true;
+        }
+        return false;
+    }
+ 
+    /**
+     * Log varible to Firebug
+     * 
+     * @see http://www.firephp.org/Wiki/Reference/Fb
+     * @param mixed $Object The variable to be logged
+     * @return true Return TRUE if message was added to headers, FALSE otherwise
+     * @throws Exception
+     */
+    public function fb($Object)
+    {
+        if($this instanceof FirePHP_Insight && method_exists($this, '_logUpgradeClientMessage')) {
+            if(!FirePHP_Insight::$upgradeClientMessageLogged) {    // avoid infinite recursion as _logUpgradeClientMessage() logs a message
+                $this->_logUpgradeClientMessage();
+            }
+        }
+
+        static $insightGroupStack = array();
+
+        if (!$this->getEnabled()) {
+            return false;
+        }
+
+        if ($this->headersSent($filename, $linenum)) {
+            // If we are logging from within the exception handler we cannot throw another exception
+            if ($this->inExceptionHandler) {
+                // Simply echo the error out to the page
+                echo '<div style="border: 2px solid red; font-family: Arial; font-size: 12px; background-color: lightgray; padding: 5px;"><span style="color: red; font-weight: bold;">FirePHP ERROR:</span> Headers already sent in <b>'.$filename.'</b> on line <b>'.$linenum.'</b>. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.</div>';
+            } else {
+                throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.');
+            }
+        }
+      
+        $Type = null;
+        $Label = null;
+        $Options = array();
+      
+        if (func_num_args()==1) {
+        } else
+        if (func_num_args()==2) {
+            switch(func_get_arg(1)) {
+                case self::LOG:
+                case self::INFO:
+                case self::WARN:
+                case self::ERROR:
+                case self::DUMP:
+                case self::TRACE:
+                case self::EXCEPTION:
+                case self::TABLE:
+                case self::GROUP_START:
+                case self::GROUP_END:
+                    $Type = func_get_arg(1);
+                    break;
+                default:
+                    $Label = func_get_arg(1);
+                    break;
+            }
+        } else
+        if (func_num_args()==3) {
+            $Type = func_get_arg(2);
+            $Label = func_get_arg(1);
+        } else
+        if (func_num_args()==4) {
+            $Type = func_get_arg(2);
+            $Label = func_get_arg(1);
+            $Options = func_get_arg(3);
+        } else {
+            throw $this->newException('Wrong number of arguments to fb() function!');
+        }
+
+        if($this->logToInsightConsole!==null && (get_class($this)=='FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) {
+            $msg = $this->logToInsightConsole;
+            if ($Object instanceof Exception) {
+                $Type = self::EXCEPTION;
+            }
+            if($Label && $Type!=self::TABLE && $Type!=self::GROUP_START) {
+                $msg = $msg->label($Label);
+            }
+            switch($Type) {
+                case self::DUMP:
+                case self::LOG:
+                    return $msg->log($Object);
+                case self::INFO:
+                    return $msg->info($Object);
+                case self::WARN:
+                    return $msg->warn($Object);
+                case self::ERROR:
+                    return $msg->error($Object);
+                case self::TRACE:
+                    return $msg->trace($Object);
+                case self::EXCEPTION:
+                    return $this->plugin('engine')->handleException($Object, $msg);
+                case self::TABLE:
+                    if (isset($Object[0]) && !is_string($Object[0]) && $Label) {
+                        $Object = array($Label, $Object);
+                    }
+                    return $msg->table($Object[0], array_slice($Object[1],1), $Object[1][0]);
+                case self::GROUP_START:
+                    $insightGroupStack[] = $msg->group(md5($Label))->open();
+                    return $msg->log($Label);
+                case self::GROUP_END:
+                    if(count($insightGroupStack)==0) {
+                        throw new Error('Too many groupEnd() as opposed to group() calls!');
+                    }
+                    $group = array_pop($insightGroupStack);
+                    return $group->close();
+                default:
+                    return $msg->log($Object);
+            }
+        }
+
+        if (!$this->detectClientExtension()) {
+            return false;
+        }
+      
+        $meta = array();
+        $skipFinalObjectEncode = false;
+      
+        if ($Object instanceof Exception) {
+    
+            $meta['file'] = $this->_escapeTraceFile($Object->getFile());
+            $meta['line'] = $Object->getLine();
+          
+            $trace = $Object->getTrace();
+            if ($Object instanceof ErrorException
+               && isset($trace[0]['function'])
+               && $trace[0]['function']=='errorHandler'
+               && isset($trace[0]['class'])
+               && $trace[0]['class']=='FirePHP') {
+               
+                $severity = false;
+                switch($Object->getSeverity()) {
+                    case E_WARNING: $severity = 'E_WARNING'; break;
+                    case E_NOTICE: $severity = 'E_NOTICE'; break;
+                    case E_USER_ERROR: $severity = 'E_USER_ERROR'; break;
+                    case E_USER_WARNING: $severity = 'E_USER_WARNING'; break;
+                    case E_USER_NOTICE: $severity = 'E_USER_NOTICE'; break;
+                    case E_STRICT: $severity = 'E_STRICT'; break;
+                    case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break;
+                    case E_DEPRECATED: $severity = 'E_DEPRECATED'; break;
+                    case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break;
+                }
+                   
+                $Object = array('Class'=>get_class($Object),
+                                'Message'=>$severity.': '.$Object->getMessage(),
+                                'File'=>$this->_escapeTraceFile($Object->getFile()),
+                                'Line'=>$Object->getLine(),
+                                'Type'=>'trigger',
+                                'Trace'=>$this->_escapeTrace(array_splice($trace,2)));
+                $skipFinalObjectEncode = true;
+            } else {
+                $Object = array('Class'=>get_class($Object),
+                                'Message'=>$Object->getMessage(),
+                                'File'=>$this->_escapeTraceFile($Object->getFile()),
+                                'Line'=>$Object->getLine(),
+                                'Type'=>'throw',
+                                'Trace'=>$this->_escapeTrace($trace));
+                $skipFinalObjectEncode = true;
+            }
+            $Type = self::EXCEPTION;
+          
+        } else
+        if ($Type==self::TRACE) {
+          
+            $trace = debug_backtrace();
+            if (!$trace) return false;
+            for( $i=0 ; $i<sizeof($trace) ; $i++ ) {
+    
+                if (isset($trace[$i]['class'])
+                   && isset($trace[$i]['file'])
+                   && ($trace[$i]['class']=='FirePHP'
+                       || $trace[$i]['class']=='FB')
+                   && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
+                       || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
+                    /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
+                } else
+                if (isset($trace[$i]['class'])
+                   && isset($trace[$i+1]['file'])
+                   && $trace[$i]['class']=='FirePHP'
+                   && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
+                    /* Skip fb() */
+                } else
+                if ($trace[$i]['function']=='fb'
+                   || $trace[$i]['function']=='trace'
+                   || $trace[$i]['function']=='send') {
+
+                    $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'',
+                                    'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'',
+                                    'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'',
+                                    'Message'=>$trace[$i]['args'][0],
+                                    'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'',
+                                    'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'',
+                                    'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'',
+                                    'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1)));
+        
+                    $skipFinalObjectEncode = true;
+                    $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
+                    $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
+                    break;
+                }
+            }
+    
+        } else
+        if ($Type==self::TABLE) {
+          
+            if (isset($Object[0]) && is_string($Object[0])) {
+                $Object[1] = $this->encodeTable($Object[1]);
+            } else {
+                $Object = $this->encodeTable($Object);
+            }
+    
+            $skipFinalObjectEncode = true;
+          
+        } else
+        if ($Type==self::GROUP_START) {
+          
+            if (!$Label) {
+                throw $this->newException('You must specify a label for the group!');
+            }
+          
+        } else {
+            if ($Type===null) {
+                $Type = self::LOG;
+            }
+        }
+        
+        if ($this->options['includeLineNumbers']) {
+            if (!isset($meta['file']) || !isset($meta['line'])) {
+    
+                $trace = debug_backtrace();
+                for( $i=0 ; $trace && $i<sizeof($trace) ; $i++ ) {
+          
+                    if (isset($trace[$i]['class'])
+                       && isset($trace[$i]['file'])
+                       && ($trace[$i]['class']=='FirePHP'
+                           || $trace[$i]['class']=='FB')
+                       && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
+                           || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
+                        /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
+                    } else
+                    if (isset($trace[$i]['class'])
+                       && isset($trace[$i+1]['file'])
+                       && $trace[$i]['class']=='FirePHP'
+                       && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
+                        /* Skip fb() */
+                    } else
+                    if (isset($trace[$i]['file'])
+                       && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') {
+                        /* Skip FB::fb() */
+                    } else {
+                        $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
+                        $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
+                        break;
+                    }
+                }      
+            }
+        } else {
+            unset($meta['file']);
+            unset($meta['line']);
+        }
+
+        $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
+        $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION);
+     
+        $structure_index = 1;
+        if ($Type==self::DUMP) {
+            $structure_index = 2;
+            $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');
+        } else {
+            $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
+        }
+      
+        if ($Type==self::DUMP) {
+            $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}';
+        } else {
+            $msg_meta = $Options;
+            $msg_meta['Type'] = $Type;
+            if ($Label!==null) {
+                $msg_meta['Label'] = $Label;
+            }
+            if (isset($meta['file']) && !isset($msg_meta['File'])) {
+                $msg_meta['File'] = $meta['file'];
+            }
+            if (isset($meta['line']) && !isset($msg_meta['Line'])) {
+                $msg_meta['Line'] = $meta['line'];
+            }
+            $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']';
+        }
+        
+        $parts = explode("\n",chunk_split($msg, 5000, "\n"));
+    
+        for( $i=0 ; $i<count($parts) ; $i++) {
+            
+            $part = $parts[$i];
+            if ($part) {
+                
+                if (count($parts)>2) {
+                    // Message needs to be split into multiple parts
+                    $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
+                                     (($i==0)?strlen($msg):'')
+                                     . '|' . $part . '|'
+                                     . (($i<count($parts)-2)?'\\':''));
+                } else {
+                    $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
+                                     strlen($part) . '|' . $part . '|');
+                }
+                
+                $this->messageIndex++;
+                
+                if ($this->messageIndex > 99999) {
+                    throw $this->newException('Maximum number (99,999) of messages reached!');             
+                }
+            }
+        }
+    
+        $this->setHeader('X-Wf-1-Index',$this->messageIndex-1);
+    
+        return true;
+    }
+  
+    /**
+     * Standardizes path for windows systems.
+     *
+     * @param string $Path
+     * @return string
+     */
+    protected function _standardizePath($Path)
+    {
+        return preg_replace('/\\\\+/','/',$Path);    
+    }
+  
+    /**
+     * Escape trace path for windows systems
+     *
+     * @param array $Trace
+     * @return array
+     */
+    protected function _escapeTrace($Trace)
+    {
+        if (!$Trace) return $Trace;
+        for( $i=0 ; $i<sizeof($Trace) ; $i++ ) {
+            if (isset($Trace[$i]['file'])) {
+                $Trace[$i]['file'] = $this->_escapeTraceFile($Trace[$i]['file']);
+            }
+            if (isset($Trace[$i]['args'])) {
+                $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']);
+            }
+        }
+        return $Trace;    
+    }
+  
+    /**
+     * Escape file information of trace for windows systems
+     *
+     * @param string $File
+     * @return string
+     */
+    protected function _escapeTraceFile($File)
+    {
+        /* Check if we have a windows filepath */
+        if (strpos($File,'\\')) {
+            /* First strip down to single \ */
+          
+            $file = preg_replace('/\\\\+/','\\',$File);
+          
+            return $file;
+        }
+        return $File;
+    }
+
+    /**
+     * Check if headers have already been sent
+     *
+     * @param string $Filename
+     * @param integer $Linenum
+     */
+    protected function headersSent(&$Filename, &$Linenum)
+    {
+        return headers_sent($Filename, $Linenum);
+    }
+
+    /**
+     * Send header
+     *
+     * @param string $Name
+     * @param string $Value
+     */
+    protected function setHeader($Name, $Value)
+    {
+        return header($Name.': '.$Value);
+    }
+
+    /**
+     * Get user agent
+     *
+     * @return string|false
+     */
+    protected function getUserAgent()
+    {
+        if (!isset($_SERVER['HTTP_USER_AGENT'])) return false;
+        return $_SERVER['HTTP_USER_AGENT'];
+    }
+
+    /**
+     * Get all request headers
+     * 
+     * @return array
+     */
+    public static function getAllRequestHeaders() {
+        static $_cached_headers = false;
+        if($_cached_headers!==false) {
+            return $_cached_headers;
+        }
+        $headers = array();
+        if(function_exists('getallheaders')) {
+            foreach( getallheaders() as $name => $value ) {
+                $headers[strtolower($name)] = $value;
+            }
+        } else {
+            foreach($_SERVER as $name => $value) {
+                if(substr($name, 0, 5) == 'HTTP_') {
+                    $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value;
+                }
+            }
+        }
+        return $_cached_headers = $headers;
+    }
+
+    /**
+     * Get a request header
+     *
+     * @return string|false
+     */
+    protected function getRequestHeader($Name)
+    {
+        $headers = self::getAllRequestHeaders();
+        if (isset($headers[strtolower($Name)])) {
+            return $headers[strtolower($Name)];
+        }
+        return false;
+    }
+
+    /**
+     * Returns a new exception
+     *
+     * @param string $Message
+     * @return Exception
+     */
+    protected function newException($Message)
+    {
+        return new Exception($Message);
+    }
+  
+    /**
+     * Encode an object into a JSON string
+     * 
+     * Uses PHP's jeson_encode() if available
+     * 
+     * @param object $Object The object to be encoded
+     * @return string The JSON string
+     */
+    public function jsonEncode($Object, $skipObjectEncode = false)
+    {
+        if (!$skipObjectEncode) {
+            $Object = $this->encodeObject($Object);
+        }
+        
+        if (function_exists('json_encode')
+           && $this->options['useNativeJsonEncode']!=false) {
+    
+            return json_encode($Object);
+        } else {
+            return $this->json_encode($Object);
+        }
+    }
+
+    /**
+     * Encodes a table by encoding each row and column with encodeObject()
+     * 
+     * @param array $Table The table to be encoded
+     * @return array
+     */  
+    protected function encodeTable($Table)
+    {
+    
+        if (!$Table) return $Table;
+        
+        $new_table = array();
+        foreach($Table as $row) {
+      
+            if (is_array($row)) {
+                $new_row = array();
+            
+                foreach($row as $item) {
+                    $new_row[] = $this->encodeObject($item);
+                }
+            
+                $new_table[] = $new_row;
+            }
+        }
+        
+        return $new_table;
+    }
+
+    /**
+     * Encodes an object including members with
+     * protected and private visibility
+     * 
+     * @param Object $Object The object to be encoded
+     * @param int $Depth The current traversal depth
+     * @return array All members of the object
+     */
+    protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $MaxDepth = 1)
+    {
+        if ($MaxDepth > $this->options['maxDepth']) {
+            return '** Max Depth ('.$this->options['maxDepth'].') **';
+        }
+
+        $return = array();
+    
+        if (is_resource($Object)) {
+    
+            return '** '.(string)$Object.' **';
+    
+        } else    
+        if (is_object($Object)) {
+    
+            if ($ObjectDepth > $this->options['maxObjectDepth']) {
+                return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **';
+            }
+            
+            foreach ($this->objectStack as $refVal) {
+                if ($refVal === $Object) {
+                    return '** Recursion ('.get_class($Object).') **';
+                }
+            }
+            array_push($this->objectStack, $Object);
+                    
+            $return['__className'] = $class = get_class($Object);
+            $class_lower = strtolower($class);
+    
+            $reflectionClass = new ReflectionClass($class);  
+            $properties = array();
+            foreach( $reflectionClass->getProperties() as $property) {
+                $properties[$property->getName()] = $property;
+            }
+                
+            $members = (array)$Object;
+    
+            foreach( $properties as $plain_name => $property ) {
+    
+                $name = $raw_name = $plain_name;
+                if ($property->isStatic()) {
+                    $name = 'static:'.$name;
+                }
+                if ($property->isPublic()) {
+                    $name = 'public:'.$name;
+                } else
+                if ($property->isPrivate()) {
+                    $name = 'private:'.$name;
+                    $raw_name = "\0".$class."\0".$raw_name;
+                } else
+                if ($property->isProtected()) {
+                    $name = 'protected:'.$name;
+                    $raw_name = "\0".'*'."\0".$raw_name;
+                }
+    
+                if (!(isset($this->objectFilters[$class_lower])
+                     && is_array($this->objectFilters[$class_lower])
+                     && in_array($plain_name,$this->objectFilters[$class_lower]))) {
+    
+                    if (array_key_exists($raw_name,$members)
+                       && !$property->isStatic()) {
+                  
+                        $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1, $MaxDepth + 1);      
+                
+                    } else {
+                        if (method_exists($property,'setAccessible')) {
+                            $property->setAccessible(true);
+                            $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1);
+                        } else
+                        if ($property->isPublic()) {
+                            $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1);
+                        } else {
+                            $return[$name] = '** Need PHP 5.3 to get value **';
+                        }
+                    }
+                } else {
+                    $return[$name] = '** Excluded by Filter **';
+                }
+            }
+            
+            // Include all members that are not defined in the class
+            // but exist in the object
+            foreach( $members as $raw_name => $value ) {
+    
+                $name = $raw_name;
+              
+                if ($name{0} == "\0") {
+                    $parts = explode("\0", $name);
+                    $name = $parts[2];
+                }
+              
+                $plain_name = $name;
+    
+                if (!isset($properties[$name])) {
+                    $name = 'undeclared:'.$name;
+    
+                    if (!(isset($this->objectFilters[$class_lower])
+                         && is_array($this->objectFilters[$class_lower])
+                         && in_array($plain_name,$this->objectFilters[$class_lower]))) {
+    
+                        $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1, $MaxDepth + 1);
+                    } else {
+                        $return[$name] = '** Excluded by Filter **';
+                    }
+                }
+            }
+            
+            array_pop($this->objectStack);
+            
+        } elseif (is_array($Object)) {
+    
+            if ($ArrayDepth > $this->options['maxArrayDepth']) {
+                return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **';
+            }
+          
+            foreach ($Object as $key => $val) {
+              
+                // Encoding the $GLOBALS PHP array causes an infinite loop
+                // if the recursion is not reset here as it contains
+                // a reference to itself. This is the only way I have come up
+                // with to stop infinite recursion in this case.
+                if ($key=='GLOBALS'
+                   && is_array($val)
+                   && array_key_exists('GLOBALS',$val)) {
+                    $val['GLOBALS'] = '** Recursion (GLOBALS) **';
+                }
+              
+                $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1, $MaxDepth + 1);
+            }
+        } else {
+            if (self::is_utf8($Object)) {
+                return $Object;
+            } else {
+                return utf8_encode($Object);
+            }
+        }
+        return $return;
+    }
+
+    /**
+     * Returns true if $string is valid UTF-8 and false otherwise.
+     *
+     * @param mixed $str String to be tested
+     * @return boolean
+     */
+    protected static function is_utf8($str)
+    {
+        if(function_exists('mb_detect_encoding')) {
+            return (mb_detect_encoding($str) == 'UTF-8');
+        }
+        $c=0; $b=0;
+        $bits=0;
+        $len=strlen($str);
+        for($i=0; $i<$len; $i++){
+            $c=ord($str[$i]);
+            if ($c > 128){
+                if (($c >= 254)) return false;
+                elseif ($c >= 252) $bits=6;
+                elseif ($c >= 248) $bits=5;
+                elseif ($c >= 240) $bits=4;
+                elseif ($c >= 224) $bits=3;
+                elseif ($c >= 192) $bits=2;
+                else return false;
+                if (($i+$bits) > $len) return false;
+                while($bits > 1){
+                    $i++;
+                    $b=ord($str[$i]);
+                    if ($b < 128 || $b > 191) return false;
+                    $bits--;
+                }
+            }
+        }
+        return true;
+    } 
+
+    /**
+     * Converts to and from JSON format.
+     *
+     * JSON (JavaScript Object Notation) is a lightweight data-interchange
+     * format. It is easy for humans to read and write. It is easy for machines
+     * to parse and generate. It is based on a subset of the JavaScript
+     * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
+     * This feature can also be found in  Python. JSON is a text format that is
+     * completely language independent but uses conventions that are familiar
+     * to programmers of the C-family of languages, including C, C++, C#, Java,
+     * JavaScript, Perl, TCL, and many others. These properties make JSON an
+     * ideal data-interchange language.
+     *
+     * This package provides a simple encoder and decoder for JSON notation. It
+     * is intended for use with client-side Javascript applications that make
+     * use of HTTPRequest to perform server communication functions - data can
+     * be encoded into JSON notation for use in a client-side javascript, or
+     * decoded from incoming Javascript requests. JSON format is native to
+     * Javascript, and can be directly eval()'ed with no further parsing
+     * overhead
+     *
+     * All strings should be in ASCII or UTF-8 format!
+     *
+     * LICENSE: Redistribution and use in source and binary forms, with or
+     * without modification, are permitted provided that the following
+     * conditions are met: Redistributions of source code must retain the
+     * above copyright notice, this list of conditions and the following
+     * disclaimer. Redistributions in binary form must reproduce the above
+     * copyright notice, this list of conditions and the following disclaimer
+     * in the documentation and/or other materials provided with the
+     * distribution.
+     *
+     * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+     * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+     * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+     * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+     * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+     * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+     * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+     * DAMAGE.
+     *
+     * @category
+     * @package     Services_JSON
+     * @author      Michal Migurski <mike-json@teczno.com>
+     * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
+     * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
+     * @author      Christoph Dorn <christoph@christophdorn.com>
+     * @copyright   2005 Michal Migurski
+     * @version     CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
+     * @license     http://www.opensource.org/licenses/bsd-license.php
+     * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198
+     */
+   
+     
+    /**
+     * Keep a list of objects as we descend into the array so we can detect recursion.
+     */
+    private $json_objectStack = array();
+
+
+   /**
+    * convert a string from one UTF-8 char to one UTF-16 char
+    *
+    * Normally should be handled by mb_convert_encoding, but
+    * provides a slower PHP-only method for installations
+    * that lack the multibye string extension.
+    *
+    * @param    string  $utf8   UTF-8 character
+    * @return   string  UTF-16 character
+    * @access   private
+    */
+    private function json_utf82utf16($utf8)
+    {
+        // oh please oh please oh please oh please oh please
+        if (function_exists('mb_convert_encoding')) {
+            return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+        }
+
+        switch(strlen($utf8)) {
+            case 1:
+                // this case should never be reached, because we are in ASCII range
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return $utf8;
+
+            case 2:
+                // return a UTF-16 character from a 2-byte UTF-8 char
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0x07 & (ord($utf8{0}) >> 2))
+                       . chr((0xC0 & (ord($utf8{0}) << 6))
+                       | (0x3F & ord($utf8{1})));
+
+            case 3:
+                // return a UTF-16 character from a 3-byte UTF-8 char
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr((0xF0 & (ord($utf8{0}) << 4))
+                       | (0x0F & (ord($utf8{1}) >> 2)))
+                       . chr((0xC0 & (ord($utf8{1}) << 6))
+                       | (0x7F & ord($utf8{2})));
+        }
+
+        // ignoring UTF-32 for now, sorry
+        return '';
+    }
+
+   /**
+    * encodes an arbitrary variable into JSON format
+    *
+    * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
+    *                           see argument 1 to Services_JSON() above for array-parsing behavior.
+    *                           if var is a strng, note that encode() always expects it
+    *                           to be in ASCII or UTF-8 format!
+    *
+    * @return   mixed   JSON string representation of input var or an error if a problem occurs
+    * @access   public
+    */
+    private function json_encode($var)
+    {
+    
+        if (is_object($var)) {
+            if (in_array($var,$this->json_objectStack)) {
+                return '"** Recursion **"';
+            }
+        }
+          
+        switch (gettype($var)) {
+            case 'boolean':
+                return $var ? 'true' : 'false';
+
+            case 'NULL':
+                return 'null';
+
+            case 'integer':
+                return (int) $var;
+
+            case 'double':
+            case 'float':
+                return (float) $var;
+
+            case 'string':
+                // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
+                $ascii = '';
+                $strlen_var = strlen($var);
+
+               /*
+                * Iterate over every character in the string,
+                * escaping with a slash or encoding to UTF-8 where necessary
+                */
+                for ($c = 0; $c < $strlen_var; ++$c) {
+
+                    $ord_var_c = ord($var{$c});
+
+                    switch (true) {
+                        case $ord_var_c == 0x08:
+                            $ascii .= '\b';
+                            break;
+                        case $ord_var_c == 0x09:
+                            $ascii .= '\t';
+                            break;
+                        case $ord_var_c == 0x0A:
+                            $ascii .= '\n';
+                            break;
+                        case $ord_var_c == 0x0C:
+                            $ascii .= '\f';
+                            break;
+                        case $ord_var_c == 0x0D:
+                            $ascii .= '\r';
+                            break;
+
+                        case $ord_var_c == 0x22:
+                        case $ord_var_c == 0x2F:
+                        case $ord_var_c == 0x5C:
+                            // double quote, slash, slosh
+                            $ascii .= '\\'.$var{$c};
+                            break;
+
+                        case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
+                            // characters U-00000000 - U-0000007F (same as ASCII)
+                            $ascii .= $var{$c};
+                            break;
+
+                        case (($ord_var_c & 0xE0) == 0xC0):
+                            // characters U-00000080 - U-000007FF, mask 110XXXXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
+                            $c += 1;
+                            $utf16 = $this->json_utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xF0) == 0xE0):
+                            // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}));
+                            $c += 2;
+                            $utf16 = $this->json_utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xF8) == 0xF0):
+                            // characters U-00010000 - U-001FFFFF, mask 11110XXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}));
+                            $c += 3;
+                            $utf16 = $this->json_utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xFC) == 0xF8):
+                            // characters U-00200000 - U-03FFFFFF, mask 111110XX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}),
+                                         ord($var{$c + 4}));
+                            $c += 4;
+                            $utf16 = $this->json_utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xFE) == 0xFC):
+                            // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}),
+                                         ord($var{$c + 4}),
+                                         ord($var{$c + 5}));
+                            $c += 5;
+                            $utf16 = $this->json_utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+                    }
+                }
+
+                return '"'.$ascii.'"';
+
+            case 'array':
+                /*
+                 * As per JSON spec if any array key is not an integer
+                 * we must treat the the whole array as an object. We
+                 * also try to catch a sparsely populated associative
+                 * array with numeric keys here because some JS engines
+                 * will create an array with empty indexes up to
+                 * max_index which can cause memory issues and because
+                 * the keys, which may be relevant, will be remapped
+                 * otherwise.
+                 *
+                 * As per the ECMA and JSON specification an object may
+                 * have any string as a property. Unfortunately due to
+                 * a hole in the ECMA specification if the key is a
+                 * ECMA reserved word or starts with a digit the
+                 * parameter is only accessible using ECMAScript's
+                 * bracket notation.
+                 */
+
+                // treat as a JSON object
+                if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
+                  
+                    $this->json_objectStack[] = $var;
+
+                    $properties = array_map(array($this, 'json_name_value'),
+                                            array_keys($var),
+                                            array_values($var));
+
+                    array_pop($this->json_objectStack);
+
+                    foreach($properties as $property) {
+                        if ($property instanceof Exception) {
+                            return $property;
+                        }
+                    }
+
+                    return '{' . join(',', $properties) . '}';
+                }
+
+                $this->json_objectStack[] = $var;
+
+                // treat it like a regular array
+                $elements = array_map(array($this, 'json_encode'), $var);
+
+                array_pop($this->json_objectStack);
+
+                foreach($elements as $element) {
+                    if ($element instanceof Exception) {
+                        return $element;
+                    }
+                }
+
+                return '[' . join(',', $elements) . ']';
+
+            case 'object':
+                $vars = self::encodeObject($var);
+
+                $this->json_objectStack[] = $var;
+
+                $properties = array_map(array($this, 'json_name_value'),
+                                        array_keys($vars),
+                                        array_values($vars));
+
+                array_pop($this->json_objectStack);
+              
+                foreach($properties as $property) {
+                    if ($property instanceof Exception) {
+                        return $property;
+                    }
+                }
+                     
+                return '{' . join(',', $properties) . '}';
+
+            default:
+                return null;
+        }
+    }
+
+   /**
+    * array-walking function for use in generating JSON-formatted name-value pairs
+    *
+    * @param    string  $name   name of key to use
+    * @param    mixed   $value  reference to an array element to be encoded
+    *
+    * @return   string  JSON-formatted name-value pair, like '"name":value'
+    * @access   private
+    */
+    private function json_name_value($name, $value)
+    {
+        // Encoding the $GLOBALS PHP array causes an infinite loop
+        // if the recursion is not reset here as it contains
+        // a reference to itself. This is the only way I have come up
+        // with to stop infinite recursion in this case.
+        if ($name=='GLOBALS'
+           && is_array($value)
+           && array_key_exists('GLOBALS',$value)) {
+            $value['GLOBALS'] = '** Recursion **';
+        }
+    
+        $encoded_value = $this->json_encode($value);
+
+        if ($encoded_value instanceof Exception) {
+            return $encoded_value;
+        }
+
+        return $this->json_encode(strval($name)) . ':' . $encoded_value;
+    }
+
+    /**
+     * @deprecated
+     */    
+    public function setProcessorUrl($URL)
+    {
+        trigger_error("The FirePHP::setProcessorUrl() method is no longer supported", E_USER_DEPRECATED);
+    }
+
+    /**
+     * @deprecated
+     */
+    public function setRendererUrl($URL)
+    {
+        trigger_error("The FirePHP::setRendererUrl() method is no longer supported", E_USER_DEPRECATED);
+    }  
+}

+ 95 - 0
ThinkPHP/Library/Behavior/ParseTemplateBehavior.class.php

@@ -0,0 +1,95 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+use Think\Storage;
+use Think\Think;
+/**
+ * 系统行为扩展:模板解析
+ */
+class ParseTemplateBehavior {
+
+    // 行为扩展的执行入口必须是run
+    public function run(&$_data){
+        $engine             =   strtolower(C('TMPL_ENGINE_TYPE'));
+        $_content           =   empty($_data['content'])?$_data['file']:$_data['content'];
+        $_data['prefix']    =   !empty($_data['prefix'])?$_data['prefix']:C('TMPL_CACHE_PREFIX');
+        if('think'==$engine){ // 采用Think模板引擎
+            if((!empty($_data['content']) && $this->checkContentCache($_data['content'],$_data['prefix'])) 
+                ||  $this->checkCache($_data['file'],$_data['prefix'])) { // 缓存有效
+                //载入模版缓存文件
+                Storage::load(C('CACHE_PATH').$_data['prefix'].md5($_content).C('TMPL_CACHFILE_SUFFIX'),$_data['var']);
+            }else{
+                $tpl = Think::instance('Think\\Template');
+                // 编译并加载模板文件
+                $tpl->fetch($_content,$_data['var'],$_data['prefix']);
+            }
+        }else{
+            // 调用第三方模板引擎解析和输出
+            if(strpos($engine,'\\')){
+                $class  =   $engine;
+            }else{
+                $class   =  'Think\\Template\\Driver\\'.ucwords($engine);                
+            }            
+            if(class_exists($class)) {
+                $tpl   =  new $class;
+                $tpl->fetch($_content,$_data['var']);
+            }else {  // 类没有定义
+                E(L('_NOT_SUPPORT_').': ' . $class);
+            }
+        }
+    }
+
+    /**
+     * 检查缓存文件是否有效
+     * 如果无效则需要重新编译
+     * @access public
+     * @param string $tmplTemplateFile  模板文件名
+     * @return boolean
+     */
+    protected function checkCache($tmplTemplateFile,$prefix='') {
+        if (!C('TMPL_CACHE_ON')) // 优先对配置设定检测
+            return false;
+        $tmplCacheFile = C('CACHE_PATH').$prefix.md5($tmplTemplateFile).C('TMPL_CACHFILE_SUFFIX');
+        if(!Storage::has($tmplCacheFile)){
+            return false;
+        }elseif (filemtime($tmplTemplateFile) > Storage::get($tmplCacheFile,'mtime')) {
+            // 模板文件如果有更新则缓存需要更新
+            return false;
+        }elseif (C('TMPL_CACHE_TIME') != 0 && time() > Storage::get($tmplCacheFile,'mtime')+C('TMPL_CACHE_TIME')) {
+            // 缓存是否在有效期
+            return false;
+        }
+        // 开启布局模板
+        if(C('LAYOUT_ON')) {
+            $layoutFile  =  THEME_PATH.C('LAYOUT_NAME').C('TMPL_TEMPLATE_SUFFIX');
+            if(filemtime($layoutFile) > Storage::get($tmplCacheFile,'mtime')) {
+                return false;
+            }
+        }
+        // 缓存有效
+        return true;
+    }
+
+    /**
+     * 检查缓存内容是否有效
+     * 如果无效则需要重新编译
+     * @access public
+     * @param string $tmplContent  模板内容
+     * @return boolean
+     */
+    protected function checkContentCache($tmplContent,$prefix='') {
+        if(Storage::has(C('CACHE_PATH').$prefix.md5($tmplContent).C('TMPL_CACHFILE_SUFFIX'))){
+            return true;
+        }else{
+            return false;
+        }
+    }    
+}

+ 117 - 0
ThinkPHP/Library/Behavior/ReadHtmlCacheBehavior.class.php

@@ -0,0 +1,117 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+use Think\Storage;
+/**
+ * 系统行为扩展:静态缓存读取
+ */
+class ReadHtmlCacheBehavior {
+    // 行为扩展的执行入口必须是run
+    public function run(&$params){
+        // 开启静态缓存
+        if(IS_GET && C('HTML_CACHE_ON'))  {
+            $cacheTime = $this->requireHtmlCache();
+            if( false !== $cacheTime && $this->checkHTMLCache(HTML_FILE_NAME,$cacheTime)) { //静态页面有效
+                // 读取静态页面输出
+                echo Storage::read(HTML_FILE_NAME,'html');
+                exit();
+            }
+        }
+    }
+
+    // 判断是否需要静态缓存
+    static private function requireHtmlCache() {
+        // 分析当前的静态规则
+         $htmls = C('HTML_CACHE_RULES'); // 读取静态规则
+         if(!empty($htmls)) {
+            $htmls = array_change_key_case($htmls);
+            // 静态规则文件定义格式 actionName=>array('静态规则','缓存时间','附加规则')
+            // 'read'=>array('{id},{name}',60,'md5') 必须保证静态规则的唯一性 和 可判断性
+            // 检测静态规则
+            $controllerName = strtolower(CONTROLLER_NAME);
+            $actionName     = strtolower(ACTION_NAME);
+            if(isset($htmls[$controllerName.':'.$actionName])) {
+                $html   =   $htmls[$controllerName.':'.$actionName];   // 某个控制器的操作的静态规则
+            }elseif(isset($htmls[$controllerName.':'])){// 某个控制器的静态规则
+                $html   =   $htmls[$controllerName.':'];
+            }elseif(isset($htmls[$actionName])){
+                $html   =   $htmls[$actionName]; // 所有操作的静态规则
+            }elseif(isset($htmls['*'])){
+                $html   =   $htmls['*']; // 全局静态规则
+            }
+            if(!empty($html)) {
+                // 解读静态规则
+                $rule   = is_array($html)?$html[0]:$html;
+                // 以$_开头的系统变量
+                $callback = function($match){ 
+                    switch($match[1]){
+                        case '_GET':        $var = $_GET[$match[2]]; break;
+                        case '_POST':       $var = $_POST[$match[2]]; break;
+                        case '_REQUEST':    $var = $_REQUEST[$match[2]]; break;
+                        case '_SERVER':     $var = $_SERVER[$match[2]]; break;
+                        case '_SESSION':    $var = $_SESSION[$match[2]]; break;
+                        case '_COOKIE':     $var = $_COOKIE[$match[2]]; break;
+                    }
+                    return (count($match) == 4) ? $match[3]($var) : $var;
+                };
+                $rule     = preg_replace_callback('/{\$(_\w+)\.(\w+)(?:\|(\w+))?}/', $callback, $rule);
+                // {ID|FUN} GET变量的简写
+                $rule     = preg_replace_callback('/{(\w+)\|(\w+)}/', function($match){return $match[2]($_GET[$match[1]]);}, $rule);
+                $rule     = preg_replace_callback('/{(\w+)}/', function($match){return $_GET[$match[1]];}, $rule);
+                // 特殊系统变量
+                $rule   = str_ireplace(
+                    array('{:controller}','{:action}','{:module}'),
+                    array(CONTROLLER_NAME,ACTION_NAME,MODULE_NAME),
+                    $rule);
+                // {|FUN} 单独使用函数
+                $rule  = preg_replace_callback('/{|(\w+)}/', function($match){return $match[1]();},$rule);
+                $cacheTime  =   C('HTML_CACHE_TIME',null,60);
+                if(is_array($html)){
+                    if(!empty($html[2])) $rule    =   $html[2]($rule); // 应用附加函数
+                    $cacheTime  =   isset($html[1])?$html[1]:$cacheTime; // 缓存有效期
+                }else{
+                    $cacheTime  =   $cacheTime;
+                }
+                
+                // 当前缓存文件
+                define('HTML_FILE_NAME',HTML_PATH . $rule.C('HTML_FILE_SUFFIX',null,'.html'));
+                return $cacheTime;
+            }
+        }
+        // 无需缓存
+        return false;
+    }
+
+    /**
+     * 检查静态HTML文件是否有效
+     * 如果无效需要重新更新
+     * @access public
+     * @param string $cacheFile  静态文件名
+     * @param integer $cacheTime  缓存有效期
+     * @return boolean
+     */
+    static public function checkHTMLCache($cacheFile='',$cacheTime='') {
+        if(!is_file($cacheFile) && 'sae' != APP_MODE ){
+            return false;
+        }elseif (filemtime(\Think\Think::instance('Think\View')->parseTemplate()) > Storage::get($cacheFile,'mtime','html')) {
+            // 模板文件如果更新静态文件需要更新
+            return false;
+        }elseif(!is_numeric($cacheTime) && function_exists($cacheTime)){
+            return $cacheTime($cacheFile);
+        }elseif ($cacheTime != 0 && NOW_TIME > Storage::get($cacheFile,'mtime','html')+$cacheTime) {
+            // 文件是否在有效期
+            return false;
+        }
+        //静态文件有效
+        return true;
+    }
+
+}

+ 41 - 0
ThinkPHP/Library/Behavior/RobotCheckBehavior.class.php

@@ -0,0 +1,41 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 机器人检测
+ * @author   liu21st <liu21st@gmail.com>
+ */
+class RobotCheckBehavior {
+    
+    public function run(&$params) {
+        // 机器人访问检测
+        if(C('LIMIT_ROBOT_VISIT',null,true) && self::isRobot()) {
+            // 禁止机器人访问
+            exit('Access Denied');
+        }
+    }
+
+    static private function isRobot() {
+        static $_robot = null;
+        if(is_null($_robot)) {
+            $spiders = 'Bot|Crawl|Spider|slurp|sohu-search|lycos|robozilla';
+            $browsers = 'MSIE|Netscape|Opera|Konqueror|Mozilla';
+            if(preg_match("/($browsers)/", $_SERVER['HTTP_USER_AGENT'])) {
+                $_robot	 =	  false ;
+            } elseif(preg_match("/($spiders)/", $_SERVER['HTTP_USER_AGENT'])) {
+                $_robot	 =	  true;
+            } else {
+                $_robot	 =	  false;
+            }
+        }
+        return $_robot;
+    }
+}

+ 119 - 0
ThinkPHP/Library/Behavior/ShowPageTraceBehavior.class.php

@@ -0,0 +1,119 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+use Think\Log;
+/**
+ * 系统行为扩展:页面Trace显示输出
+ */
+class ShowPageTraceBehavior {
+    protected $tracePageTabs =  array('BASE'=>'基本','FILE'=>'文件','INFO'=>'流程','ERR|NOTIC'=>'错误','SQL'=>'SQL','DEBUG'=>'调试');
+
+    // 行为扩展的执行入口必须是run
+    public function run(&$params){
+        if(!IS_AJAX && !IS_CLI && C('SHOW_PAGE_TRACE')) {
+            echo $this->showTrace();
+        }
+    }
+
+    /**
+     * 显示页面Trace信息
+     * @access private
+     */
+    private function showTrace() {
+         // 系统默认显示信息
+        $files  =  get_included_files();
+        $info   =   array();
+        foreach ($files as $key=>$file){
+            $info[] = $file.' ( '.number_format(filesize($file)/1024,2).' KB )';
+        }
+        $trace  =   array();
+        $base   =   array(
+            '请求信息'  =>  date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).' '.$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['REQUEST_METHOD'].' : '.__SELF__,
+            '运行时间'  =>  $this->showTime(),
+            '吞吐率'    =>  number_format(1/G('beginTime','viewEndTime'),2).'req/s',
+            '内存开销'  =>  MEMORY_LIMIT_ON?number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024,2).' kb':'不支持',
+            '查询信息'  =>  N('db_query').' queries '.N('db_write').' writes ',
+            '文件加载'  =>  count(get_included_files()),
+            '缓存信息'  =>  N('cache_read').' gets '.N('cache_write').' writes ',
+            '配置加载'  =>  count(C()),
+            '会话信息'  =>  'SESSION_ID='.session_id(),
+            );
+        // 读取应用定义的Trace文件
+        $traceFile  =   COMMON_PATH.'Conf/trace.php';
+        if(is_file($traceFile)) {
+            $base   =   array_merge($base,include $traceFile);
+        }
+        $debug  =   trace();
+        $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePageTabs);
+        foreach ($tabs as $name=>$title){
+            switch(strtoupper($name)) {
+                case 'BASE':// 基本信息
+                    $trace[$title]  =   $base;
+                    break;
+                case 'FILE': // 文件信息
+                    $trace[$title]  =   $info;
+                    break;
+                default:// 调试信息
+                    $name       =   strtoupper($name);
+                    if(strpos($name,'|')) {// 多组信息
+                        $names  =   explode('|',$name);
+                        $result =   array();
+                        foreach($names as $name){
+                            $result   +=   isset($debug[$name])?$debug[$name]:array();
+                        }
+                        $trace[$title]  =   $result;
+                    }else{
+                        $trace[$title]  =   isset($debug[$name])?$debug[$name]:'';
+                    }
+            }
+        }
+        if($save = C('PAGE_TRACE_SAVE')) { // 保存页面Trace日志
+            if(is_array($save)) {// 选择选项卡保存
+                $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePageTabs);
+                $array  =   array();
+                foreach ($save as $tab){
+                    $array[] =   $tabs[$tab];
+                }
+            }
+            $content    =   date('[ c ]').' '.get_client_ip().' '.$_SERVER['REQUEST_URI']."\r\n";
+            foreach ($trace as $key=>$val){
+                if(!isset($array) || in_array_case($key,$array)) {
+                    $content    .=  '[ '.$key." ]\r\n";
+                    if(is_array($val)) {
+                        foreach ($val as $k=>$v){
+                            $content .= (!is_numeric($k)?$k.':':'').print_r($v,true)."\r\n";
+                        }
+                    }else{
+                        $content .= print_r($val,true)."\r\n";
+                    }
+                    $content .= "\r\n";
+                }
+            }
+            error_log(str_replace('<br/>',"\r\n",$content), 3,C('LOG_PATH').date('y_m_d').'_trace.log');
+        }
+        unset($files,$info,$base);
+        // 调用Trace页面模板
+        ob_start();
+        include C('TMPL_TRACE_FILE')?C('TMPL_TRACE_FILE'):THINK_PATH.'Tpl/page_trace.tpl';
+        return ob_get_clean();
+    }
+
+    /**
+     * 获取运行时间
+     */
+    private function showTime() {
+        // 显示运行时间
+        G('beginTime',$GLOBALS['_beginTime']);
+        G('viewEndTime');
+        // 显示详细运行时间
+        return G('beginTime','viewEndTime').'s ( Load:'.G('beginTime','loadTime').'s Init:'.G('loadTime','initTime').'s Exec:'.G('initTime','viewStartTime').'s Template:'.G('viewStartTime','viewEndTime').'s )';
+    }
+}

+ 69 - 0
ThinkPHP/Library/Behavior/ShowRuntimeBehavior.class.php

@@ -0,0 +1,69 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 系统行为扩展:运行时间信息显示
+ */
+class ShowRuntimeBehavior {
+
+    // 行为扩展的执行入口必须是run
+    public function run(&$content){
+        if(C('SHOW_RUN_TIME')){
+            if(false !== strpos($content,'{__NORUNTIME__}')) {
+                $content   =  str_replace('{__NORUNTIME__}','',$content);
+            }else{
+                $runtime = $this->showTime();
+                 if(strpos($content,'{__RUNTIME__}'))
+                     $content   =  str_replace('{__RUNTIME__}',$runtime,$content);
+                 else
+                     $content   .=  $runtime;
+            }
+        }else{
+            $content   =  str_replace(array('{__NORUNTIME__}','{__RUNTIME__}'),'',$content);
+        }
+    }
+
+    /**
+     * 显示运行时间、数据库操作、缓存次数、内存使用信息
+     * @access private
+     * @return string
+     */
+    private function showTime() {
+        // 显示运行时间
+        G('beginTime',$GLOBALS['_beginTime']);
+        G('viewEndTime');
+        $showTime   =   'Process: '.G('beginTime','viewEndTime').'s ';
+        if(C('SHOW_ADV_TIME')) {
+            // 显示详细运行时间
+            $showTime .= '( Load:'.G('beginTime','loadTime').'s Init:'.G('loadTime','initTime').'s Exec:'.G('initTime','viewStartTime').'s Template:'.G('viewStartTime','viewEndTime').'s )';
+        }
+        if(C('SHOW_DB_TIMES') ) {
+            // 显示数据库操作次数
+            $showTime .= ' | DB :'.N('db_query').' queries '.N('db_write').' writes ';
+        }
+        if(C('SHOW_CACHE_TIMES') ) {
+            // 显示缓存读写次数
+            $showTime .= ' | Cache :'.N('cache_read').' gets '.N('cache_write').' writes ';
+        }
+        if(MEMORY_LIMIT_ON && C('SHOW_USE_MEM')) {
+            // 显示内存开销
+            $showTime .= ' | UseMem:'. number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024).' kb';
+        }
+        if(C('SHOW_LOAD_FILE')) {
+            $showTime .= ' | LoadFile:'.count(get_included_files());
+        }
+        if(C('SHOW_FUN_TIMES')) {
+            $fun  =  get_defined_functions();
+            $showTime .= ' | CallFun:'.count($fun['user']).','.count($fun['internal']);
+        }
+        return $showTime;
+    }
+}

+ 54 - 0
ThinkPHP/Library/Behavior/TokenBuildBehavior.class.php

@@ -0,0 +1,54 @@
+<?php
+// +----------------------------------------------------------------------
+// | TOPThink [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2010 http://topthink.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 系统行为扩展:表单令牌生成
+ */
+class TokenBuildBehavior {
+
+    public function run(&$content){
+        if(C('TOKEN_ON')) {
+            list($tokenName,$tokenKey,$tokenValue)=$this->getToken();
+            $input_token = '<input type="hidden" name="'.$tokenName.'" value="'.$tokenKey.'_'.$tokenValue.'" />';
+            $meta_token = '<meta name="'.$tokenName.'" content="'.$tokenKey.'_'.$tokenValue.'" />';
+            if(strpos($content,'{__TOKEN__}')) {
+                // 指定表单令牌隐藏域位置
+                $content = str_replace('{__TOKEN__}',$input_token,$content);
+            }elseif(preg_match('/<\/form(\s*)>/is',$content,$match)) {
+                // 智能生成表单令牌隐藏域
+                $content = str_replace($match[0],$input_token.$match[0],$content);
+            }
+            $content = str_ireplace('</head>',$meta_token.'</head>',$content);
+        }else{
+            $content = str_replace('{__TOKEN__}','',$content);
+        }
+    }
+
+    //获得token
+    private function getToken(){
+        $tokenName  = C('TOKEN_NAME',null,'__hash__');
+        $tokenType  = C('TOKEN_TYPE',null,'md5');
+        if(!isset($_SESSION[$tokenName])) {
+            $_SESSION[$tokenName]  = array();
+        }
+        // 标识当前页面唯一性
+        $tokenKey   =  md5($_SERVER['REQUEST_URI']);
+        if(isset($_SESSION[$tokenName][$tokenKey])) {// 相同页面不重复生成session
+            $tokenValue = $_SESSION[$tokenName][$tokenKey];
+        }else{
+            $tokenValue = is_callable($tokenType) ? $tokenType(microtime(true)) : md5(microtime(true));            
+            $_SESSION[$tokenName][$tokenKey]   =  $tokenValue;
+            if(IS_AJAX && C('TOKEN_RESET',null,true))
+                header($tokenName.': '.$tokenKey.'_'.$tokenValue); //ajax需要获得这个header并替换页面中meta中的token值
+        }
+        return array($tokenName,$tokenKey,$tokenValue); 
+    }
+}

+ 117 - 0
ThinkPHP/Library/Behavior/UpgradeNoticeBehavior.class.php

@@ -0,0 +1,117 @@
+<?php
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: luofei614<www.3g4k.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+/**
+ * 升级短信通知, 如果有ThinkPHP新版升级,或者重要的更新,会发送短信通知你。
+ * 需要使用SAE的短信服务。请先找一个SAE的应用开通短信服务。
+ * 使用步骤如下:
+ * 1,在项目的Conf目录下建立tags.php配置文件,内容如下:
+ * <code>
+ * <?php
+ * return array(
+ *   'app_init' =>  array('UpgradeNotice')
+ * );
+ * </code>
+ *
+ * 2,将此文件放在应用的Lib/Behavior文件夹下。
+ *注:在SAE上面使用时,以上两步可以省略 
+ * 3,在config.php中配置:
+ *  'UPGRADE_NOTICE_ON'=>true,//开启短信升级提醒功能 
+ * 'UPGRADE_NOTICE_AKEY'=>'your akey',//SAE应用的AKEY,如果在SAE上使用可以不填
+ * 'UPGRADE_NOTICE_SKEY'=>'your skey',//SAE应用的SKEY,如果在SAE上使用可以不填
+ *'UPGRADE_NOTICE_MOBILE'=>'136456789',//接受短信的手机号
+ *'UPGRADE_NOTICE_CHECK_INTERVAL' => 604800,//检测频率,单位秒,默认是一周
+ *'UPGRADE_CURRENT_VERSION'=>'0',//升级后的版本号,会在短信中告诉你填写什么
+ *UPGRADE_NOTICE_DEBUG=>true, //调试默认,如果为true,UPGRADE_NOTICE_CHECK_INTERVAL配置不起作用,每次都会进行版本检查,此时用于调试,调试完毕后请设置次配置为false
+ *
+ */
+
+class UpgradeNoticeBehavior {
+
+    protected $header_ = '';
+    protected $httpCode_;
+    protected $httpDesc_;
+    protected $accesskey_;
+    protected $secretkey_;
+    public function run(&$params) {
+        if (C('UPGRADE_NOTICE_ON') && (!S('think_upgrade_interval') || C('UPGRADE_NOTICE_DEBUG'))) {
+            if(IS_SAE && C('UPGRADE_NOTICE_QUEUE') && !isset($_POST['think_upgrade_queque'])){
+                $queue=new SaeTaskQueue(C('UPGRADE_NOTICE_QUEUE'));
+                $queue->addTask('http://'.$_SERVER['HTTP_HOST'].__APP__,'think_upgrade_queque=1');
+                if(!$queue->push()){
+                    trace('升级提醒队列执行失败,错误原因:'.$queue->errmsg(), '升级通知出错', 'NOTIC', true);
+                }
+                return ;
+            }
+            $akey = C('UPGRADE_NOTICE_AKEY',null,'');
+            $skey = C('UPGRADE_NOTICE_SKEY',null,'');
+            $this->accesskey_ = $akey ? $akey : (defined('SAE_ACCESSKEY') ? SAE_ACCESSKEY : '');
+            $this->secretkey_ = $skey ? $skey : (defined('SAE_SECRETKEY') ? SAE_SECRETKEY : '');
+            $current_version = C('UPGRADE_CURRENT_VERSION',null,0);
+            //读取接口
+            $info = $this->send('http://sinaclouds.sinaapp.com/thinkapi/upgrade.php?v=' . $current_version);
+             if ($info['version'] != $current_version) {
+                    if($this->send_sms($info['msg']))  trace($info['msg'], '升级通知成功', 'NOTIC', true); //发送升级短信
+            }
+            S('think_upgrade_interval', true, C('UPGRADE_NOTICE_CHECK_INTERVAL',null,604800));
+        }
+    }
+    private function send_sms($msg) {
+        $timestamp=time();
+        $url = 'http://inno.smsinter.sina.com.cn/sae_sms_service/sendsms.php'; //发送短信的接口地址
+        $content = "FetchUrl" . $url . "TimeStamp" . $timestamp . "AccessKey" . $this->accesskey_;
+        $signature = (base64_encode(hash_hmac('sha256', $content, $this->secretkey_, true)));
+        $headers = array(
+            "FetchUrl: $url",
+            "AccessKey: ".$this->accesskey_,
+            "TimeStamp: " . $timestamp,
+            "Signature: $signature"
+        );
+        $data = array(
+            'mobile' => C('UPGRADE_NOTICE_MOBILE',null,'') ,
+            'msg' => $msg,
+            'encoding' => 'UTF-8'
+        );
+        if(!$ret = $this->send('http://g.apibus.io', $data, $headers)){
+            return false;
+        }
+        if (isset($ret['ApiBusError'])) {
+            trace('errno:' . $ret['ApiBusError']['errcode'] . ',errmsg:' . $ret['ApiBusError']['errdesc'], '升级通知出错', 'NOTIC', true);
+            
+            return false;
+        }
+        
+        return true;
+    }
+    private function send($url, $params = array() , $headers = array()) {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        if (!empty($params)) {
+            curl_setopt($ch, CURLOPT_POST, true);
+            curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
+        }
+        if (!empty($headers)) curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        $txt = curl_exec($ch);
+        if (curl_errno($ch)) {
+            trace(curl_error($ch) , '升级通知出错', 'NOTIC', true);
+            
+            return false;
+        }
+        curl_close($ch);
+        $ret = json_decode($txt, true);
+        if (!$ret) {
+            trace('接口[' . $url . ']返回格式不正确', '升级通知出错', 'NOTIC', true);
+            
+            return false;
+        }
+        
+        return $ret;
+    }
+}

+ 29 - 0
ThinkPHP/Library/Behavior/WriteHtmlCacheBehavior.class.php

@@ -0,0 +1,29 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Behavior;
+use Think\Storage;
+/**
+ * 系统行为扩展:静态缓存写入
+ */
+class WriteHtmlCacheBehavior {
+
+    // 行为扩展的执行入口必须是run
+    public function run(&$content) {
+        //2014-11-28 修改 如果有HTTP 4xx 3xx 5xx 头部,禁止存储
+        //2014-12-1 修改 对注入的网址 防止生成,例如 /game/lst/SortType/hot/-e8-90-8c-e5-85-94-e7-88-b1-e6-b6-88-e9-99-a4/-e8-bf-9b-e5-87-bb-e7-9a-84-e9-83-a8-e8-90-bd/-e9-a3-8e-e4-ba-91-e5-a4-a9-e4-b8-8b/index.shtml
+        if (C('HTML_CACHE_ON') && defined('HTML_FILE_NAME')
+            && !preg_match('/Status.*[345]{1}\d{2}/i', implode(' ', headers_list()))
+            && !preg_match('/(-[a-z0-9]{2}){3,}/i',HTML_FILE_NAME)) {
+            //静态文件写入
+            Storage::put(HTML_FILE_NAME, $content, 'html');
+        }
+    }
+}

+ 271 - 0
ThinkPHP/Library/Org/Net/Http.class.php

@@ -0,0 +1,271 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+namespace Org\Net;
+/**
+ * Http 工具类
+ * 提供一系列的Http方法
+ * @author    liu21st <liu21st@gmail.com>
+ */
+class Http {
+
+    /**
+     * 采集远程文件
+     * @access public
+     * @param string $remote 远程文件名
+     * @param string $local 本地保存文件名
+     * @return mixed
+     */
+    static public function curlDownload($remote,$local) {
+        $cp = curl_init($remote);
+        $fp = fopen($local,"w");
+        curl_setopt($cp, CURLOPT_FILE, $fp);
+        curl_setopt($cp, CURLOPT_HEADER, 0);
+        curl_exec($cp);
+        curl_close($cp);
+        fclose($fp);
+    }
+
+   /**
+    * 使用 fsockopen 通过 HTTP 协议直接访问(采集)远程文件
+    * 如果主机或服务器没有开启 CURL 扩展可考虑使用
+    * fsockopen 比 CURL 稍慢,但性能稳定
+    * @static
+    * @access public
+    * @param string $url 远程URL
+    * @param array $conf 其他配置信息
+    *        int   limit 分段读取字符个数
+    *        string post  post的内容,字符串或数组,key=value&形式
+    *        string cookie 携带cookie访问,该参数是cookie内容
+    *        string ip    如果该参数传入,$url将不被使用,ip访问优先
+    *        int    timeout 采集超时时间
+    *        bool   block 是否阻塞访问,默认为true
+    * @return mixed
+    */
+    static public function fsockopenDownload($url, $conf = array()) {
+        $return = '';
+        if(!is_array($conf)) return $return;
+
+        $matches = parse_url($url);
+        !isset($matches['host']) 	&& $matches['host'] 	= '';
+        !isset($matches['path']) 	&& $matches['path'] 	= '';
+        !isset($matches['query']) 	&& $matches['query'] 	= '';
+        !isset($matches['port']) 	&& $matches['port'] 	= '';
+        $host = $matches['host'];
+        $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
+        $port = !empty($matches['port']) ? $matches['port'] : 80;
+
+        $conf_arr = array(
+            'limit'		=>	0,
+            'post'		=>	'',
+            'cookie'	=>	'',
+            'ip'		=>	'',
+            'timeout'	=>	15,
+            'block'		=>	TRUE,
+            );
+
+        foreach (array_merge($conf_arr, $conf) as $k=>$v) ${$k} = $v;
+
+        if($post) {
+            if(is_array($post))
+            {
+                $post = http_build_query($post);
+            }
+            $out  = "POST $path HTTP/1.0\r\n";
+            $out .= "Accept: */*\r\n";
+            //$out .= "Referer: $boardurl\r\n";
+            $out .= "Accept-Language: zh-cn\r\n";
+            $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
+            $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
+            $out .= "Host: $host\r\n";
+            $out .= 'Content-Length: '.strlen($post)."\r\n";
+            $out .= "Connection: Close\r\n";
+            $out .= "Cache-Control: no-cache\r\n";
+            $out .= "Cookie: $cookie\r\n\r\n";
+            $out .= $post;
+        } else {
+            $out  = "GET $path HTTP/1.0\r\n";
+            $out .= "Accept: */*\r\n";
+            //$out .= "Referer: $boardurl\r\n";
+            $out .= "Accept-Language: zh-cn\r\n";
+            $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
+            $out .= "Host: $host\r\n";
+            $out .= "Connection: Close\r\n";
+            $out .= "Cookie: $cookie\r\n\r\n";
+        }
+        $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
+        if(!$fp) {
+            return '';
+        } else {
+            stream_set_blocking($fp, $block);
+            stream_set_timeout($fp, $timeout);
+            @fwrite($fp, $out);
+            $status = stream_get_meta_data($fp);
+            if(!$status['timed_out']) {
+                while (!feof($fp)) {
+                    if(($header = @fgets($fp)) && ($header == "\r\n" ||  $header == "\n")) {
+                        break;
+                    }
+                }
+
+                $stop = false;
+                while(!feof($fp) && !$stop) {
+                    $data = fread($fp, ($limit == 0 || $limit > 8192 ? 8192 : $limit));
+                    $return .= $data;
+                    if($limit) {
+                        $limit -= strlen($data);
+                        $stop = $limit <= 0;
+                    }
+                }
+            }
+            @fclose($fp);
+            return $return;
+        }
+    }
+
+    /**
+     * 下载文件
+     * 可以指定下载显示的文件名,并自动发送相应的Header信息
+     * 如果指定了content参数,则下载该参数的内容
+     * @static
+     * @access public
+     * @param string $filename 下载文件名
+     * @param string $showname 下载显示的文件名
+     * @param string $content  下载的内容
+     * @param integer $expire  下载内容浏览器缓存时间
+     * @return void
+     */
+    static public function download ($filename, $showname='',$content='',$expire=180) {
+        if(is_file($filename)) {
+            $length = filesize($filename);
+        }elseif(is_file(UPLOAD_PATH.$filename)) {
+            $filename = UPLOAD_PATH.$filename;
+            $length = filesize($filename);
+        }elseif($content != '') {
+            $length = strlen($content);
+        }else {
+            E($filename.L('下载文件不存在!'));
+        }
+        if(empty($showname)) {
+            $showname = $filename;
+        }
+        $showname = basename($showname);
+		if(!empty($filename)) {
+			$finfo 	= 	new \finfo(FILEINFO_MIME);
+			$type 	= 	$finfo->file($filename);			
+		}else{
+			$type	=	"application/octet-stream";
+		}
+        //发送Http Header信息 开始下载
+        header("Pragma: public");
+        header("Cache-control: max-age=".$expire);
+        //header('Cache-Control: no-store, no-cache, must-revalidate');
+        header("Expires: " . gmdate("D, d M Y H:i:s",time()+$expire) . "GMT");
+        header("Last-Modified: " . gmdate("D, d M Y H:i:s",time()) . "GMT");
+        header("Content-Disposition: attachment; filename=".$showname);
+        header("Content-Length: ".$length);
+        header("Content-type: ".$type);
+        header('Content-Encoding: none');
+        header("Content-Transfer-Encoding: binary" );
+        if($content == '' ) {
+            readfile($filename);
+        }else {
+        	echo($content);
+        }
+        exit();
+    }
+
+    /**
+     * 显示HTTP Header 信息
+     * @return string
+     */
+    static function getHeaderInfo($header='',$echo=true) {
+        ob_start();
+        $headers   	= getallheaders();
+        if(!empty($header)) {
+            $info 	= $headers[$header];
+            echo($header.':'.$info."\n"); ;
+        }else {
+            foreach($headers as $key=>$val) {
+                echo("$key:$val\n");
+            }
+        }
+        $output 	= ob_get_clean();
+        if ($echo) {
+            echo (nl2br($output));
+        }else {
+            return $output;
+        }
+
+    }
+
+    /**
+     * HTTP Protocol defined status codes
+     * @param int $num
+     */
+	static function sendHttpStatus($code) {
+		static $_status = array(
+			// Informational 1xx
+			100 => 'Continue',
+			101 => 'Switching Protocols',
+
+			// Success 2xx
+			200 => 'OK',
+			201 => 'Created',
+			202 => 'Accepted',
+			203 => 'Non-Authoritative Information',
+			204 => 'No Content',
+			205 => 'Reset Content',
+			206 => 'Partial Content',
+
+			// Redirection 3xx
+			300 => 'Multiple Choices',
+			301 => 'Moved Permanently',
+			302 => 'Found',  // 1.1
+			303 => 'See Other',
+			304 => 'Not Modified',
+			305 => 'Use Proxy',
+			// 306 is deprecated but reserved
+			307 => 'Temporary Redirect',
+
+			// Client Error 4xx
+			400 => 'Bad Request',
+			401 => 'Unauthorized',
+			402 => 'Payment Required',
+			403 => 'Forbidden',
+			404 => 'Not Found',
+			405 => 'Method Not Allowed',
+			406 => 'Not Acceptable',
+			407 => 'Proxy Authentication Required',
+			408 => 'Request Timeout',
+			409 => 'Conflict',
+			410 => 'Gone',
+			411 => 'Length Required',
+			412 => 'Precondition Failed',
+			413 => 'Request Entity Too Large',
+			414 => 'Request-URI Too Long',
+			415 => 'Unsupported Media Type',
+			416 => 'Requested Range Not Satisfiable',
+			417 => 'Expectation Failed',
+
+			// Server Error 5xx
+			500 => 'Internal Server Error',
+			501 => 'Not Implemented',
+			502 => 'Bad Gateway',
+			503 => 'Service Unavailable',
+			504 => 'Gateway Timeout',
+			505 => 'HTTP Version Not Supported',
+			509 => 'Bandwidth Limit Exceeded'
+		);
+		if(isset($_status[$code])) {
+			header('HTTP/1.1 '.$code.' '.$_status[$code]);
+		}
+	}
+}//类定义结束

Some files were not shown because too many files changed in this diff