├── node-mail ├── tpl.html ├── package.json ├── README.md └── index.js ├── .gitignore ├── mongoose ├── package.json └── index.js ├── cnblogs-auto-login ├── package.json ├── encrypt-data │ ├── php │ │ └── post.php │ ├── index.html │ └── js │ │ └── jquery-1.8.3.min.js ├── readme.md ├── jsencrypt-demo │ ├── index.html │ └── php │ │ └── post.php ├── node │ └── cnblogs.js └── key-generator │ └── index.html ├── cnblogs-backup ├── package.json ├── README.md └── index.js ├── excel-reader ├── example.xlsx ├── package.json ├── README.md ├── excel-creator.js └── excel-reader.js ├── auto-AC-machine ├── package.json ├── README.md ├── one.js └── all.js ├── single-page-analyze ├── package.json ├── README.md └── index.js ├── poi ├── package.json ├── model.js ├── README.md └── index.js ├── chat ├── README.md ├── package.json ├── server.js ├── client.js └── index.html ├── multiple-pages-analyze-use-async ├── package.json ├── README.md └── index.js ├── multiple-pages-analyze-use-eventproxy ├── package.json ├── README.md └── index.js ├── proxy ├── package.json ├── README.md ├── superagent-proxy.js └── request-proxy.js ├── cnblogs-homepage-analyze ├── package.json ├── README.md ├── node │ ├── package.json │ └── index.js └── front │ ├── total.html │ ├── average.html │ └── js │ └── Chart.min.js ├── node-mysql ├── package.json └── index.js └── README.md /node-mail/tpl.html: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | discover-leaver-and-comer 2 | node_modules 3 | \naptha -------------------------------------------------------------------------------- /mongoose/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "mongoose": "^5.0.14" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /cnblogs-auto-login/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "superagent": "^3.8.2" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /cnblogs-backup/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "cheerio": "^1.0.0-rc.2" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /excel-reader/example.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lessfish/funny-node/HEAD/excel-reader/example.xlsx -------------------------------------------------------------------------------- /auto-AC-machine/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "cheerio": "^1.0.0-rc.2", 4 | "superagent": "^3.8.3" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /single-page-analyze/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "cheerio": "^1.0.0-rc.2", 4 | "superagent": "^3.8.2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /node-mail/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "nodemailer": "^4.0.1", 4 | "nodemailer-smtp-transport": "^2.7.4" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /poi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "async": "^2.6.0", 4 | "mysql": "^2.15.0", 5 | "superagent": "^3.8.2" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /chat/README.md: -------------------------------------------------------------------------------- 1 | # chat demo using socket.io 2 | 3 | ## Usage 4 | 5 | 1. `npm install` 6 | 2. `node server.js` 7 | 3. goto `http://localhost:8080` 8 | -------------------------------------------------------------------------------- /multiple-pages-analyze-use-async/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "async": "^2.6.0", 4 | "cheerio": "^1.0.0-rc.2", 5 | "superagent": "^3.8.2" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /multiple-pages-analyze-use-eventproxy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "cheerio": "^1.0.0-rc.2", 4 | "eventproxy": "^1.0.0", 5 | "superagent": "^3.8.2" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /proxy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "iconv-lite": "^0.4.18", 4 | "request": "^2.81.0", 5 | "superagent": "^3.5.2", 6 | "superagent-proxy": "^1.0.2" 7 | } 8 | } -------------------------------------------------------------------------------- /single-page-analyze/README.md: -------------------------------------------------------------------------------- 1 | 抓取博客园首页 20 篇文章标题 2 | 3 | ```bash 4 | npm install 5 | node index.js 6 | ``` 7 | 8 | 更多请参考 -------------------------------------------------------------------------------- /chat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "nodemon": "^2.0.22", 4 | "socket.io": "^1.7.4" 5 | }, 6 | "dependencies": { 7 | "express": "^4.15.2" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cnblogs-auto-login/encrypt-data/php/post.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cnblogs-homepage-analyze/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "cheerio": "^1.0.0-rc.2", 4 | "eventproxy": "^1.0.0", 5 | "express": "^4.16.3", 6 | "superagent": "^3.8.2" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /multiple-pages-analyze-use-eventproxy/README.md: -------------------------------------------------------------------------------- 1 | 并发抓取 [hdoj](http://acm.hdu.edu.cn/) 1000-1009 十道题目最优解的提交时间 2 | 3 | ```bash 4 | npm install 5 | node index.js 6 | ``` 7 | 8 | 更多请参考 -------------------------------------------------------------------------------- /multiple-pages-analyze-use-async/README.md: -------------------------------------------------------------------------------- 1 | 抓取 [hdoj](http://acm.hdu.edu.cn/) 1000-1099 100 道题目最优解的提交时间,async 控制并发量 2 | 3 | ```bash 4 | npm install 5 | node index.js 6 | ``` 7 | 8 | 更多请参考 -------------------------------------------------------------------------------- /auto-AC-machine/README.md: -------------------------------------------------------------------------------- 1 | hdoj 自动 AC 机器人。 2 | 3 | login -> baidu search -> post 4 | 5 | 一道题的模拟提交: 6 | 7 | ```bash 8 | node one.js 9 | ``` 10 | 11 | AC 灌水机器人: 12 | 13 | ```bash 14 | node all.js 15 | ``` 16 | 17 | 查看提交情况 18 | 19 | 实现详情参考 -------------------------------------------------------------------------------- /node-mysql/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-mysql", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "mysql": "^2.11.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /excel-reader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "excel-reader", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "excel-reader.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "xlsx": "^0.10.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /cnblogs-homepage-analyze/README.md: -------------------------------------------------------------------------------- 1 | 对博客园首页不同时间段发表的文章的阅读量进行分析。(将 front 文件夹放入 Apache 的 www 文件夹下) 2 | 3 | 不同时间段发文总数: 4 | 5 | 1. `node index.js` 启动服务 6 | 2. 客户端输入 `http://localhost/front/total.html` 7 | 8 | 不同时间段发文平均阅读量: 9 | 10 | 1. `node index.js` 启动服务 11 | 2. 客户端输入 `http://localhost/front/average.html` 12 | 13 | 实现过程参考 -------------------------------------------------------------------------------- /node-mail/README.md: -------------------------------------------------------------------------------- 1 | # nodemailer-demo 2 | 3 | ## usage 4 | 5 | - 代码中修改参数 6 | - `node index.js` 7 | 8 | ## notice 9 | 10 | - 需要在邮箱服务中开启 POP3/SMTP 服务 11 | - `pass` 参数并不一定是你的邮箱密码(大多数情况下不是),当使用邮箱密码报错时,可以根据报错信息进行查看,可能会引导你生成新的可供第三方服务调用的邮箱密码,比如我就根据错误提示进入了 [这个页面](http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256)(获取客户端授权码)其实仔细一想,这是有好处的,至少代码中不会暴露邮箱密码,显得更为安全 12 | - 附件/图片/抄送等高级功能可以参考 [官网](https://nodemailer.com/) 13 | 14 | -------------------------------------------------------------------------------- /poi/model.js: -------------------------------------------------------------------------------- 1 | const mysql = require('mysql'); 2 | const connection = mysql.createConnection({ 3 | host : 'localhost', 4 | user : 'root', 5 | password : '12345', 6 | database : 'fish' 7 | }); 8 | 9 | exports.connection = connection 10 | 11 | exports.insertData = function(name, address, lat, lng) { 12 | connection.query('INSERT INTO poi(name, address, lat, lng) VALUES (?, ?, ?, ?)', 13 | [name, address, lat, lng]); 14 | } -------------------------------------------------------------------------------- /cnblogs-homepage-analyze/node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cnblogs-homepage-analyze", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "dependencies": { 12 | "cheerio": "^0.22.0", 13 | "eventproxy": "^0.3.5", 14 | "express": "^4.14.0", 15 | "superagent": "^3.3.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /excel-reader/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Read more 3 | 4 | - [在 Node.js 中利用 js-xlsx 处理 Excel 文件](https://scarletsky.github.io/2016/01/30/nodejs-process-excel/) 5 | - [nodejs 操作 excel](http://www.mystorp.com/2015/11/07/nodejs-process-excel/) 6 | - [Node读写Excel文件探究实践](https://aotu.io/notes/2016/04/07/node-excel/) 7 | - [js-xlsx-demo](https://github.com/tokuhirom/js-xlsx-demo) 8 | 9 | 10 | **2016.11.05 add:** 11 | 12 | [xlsx](https://github.com/SheetJS/js-xlsx) 也能用在客户端,[使用纯前端JavaScript 实现Excel IO](http://www.cnblogs.com/likeFlyingFish/p/5794467.html) 这篇文章说 xlsx 在客户端的解析还有局限性,最后用了葡萄城控件的付费服务 [Wijmo](http://wijmo.gcpowertools.com.cn/),有需要的时候可以看看 xlsx 的文档。 -------------------------------------------------------------------------------- /excel-reader/excel-creator.js: -------------------------------------------------------------------------------- 1 | let XLSX = require('xlsx'); 2 | 3 | function array2excel(data, ws_name = 'new sheet name') { 4 | // worksheet 5 | var ws = XLSX.utils.aoa_to_sheet(data); 6 | 7 | // workbook 8 | var wb = { 9 | SheetNames: [], 10 | Sheets: {} 11 | }; 12 | 13 | // Add the sheet name to the list 14 | wb.SheetNames.push(ws_name); 15 | 16 | wb.Sheets[ws_name] = ws; 17 | 18 | // export workbook 19 | XLSX.writeFile(wb, 'out.xlsx'); 20 | } 21 | 22 | // data 23 | var data = [ 24 | [1, 2, 3, 4, 5], 25 | [6, 7, 8, 9, 10], 26 | 'hello'.split(''), 27 | 'world'.split('') 28 | ]; 29 | 30 | array2excel(data); 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # funny-node 2 | 3 | ## 爬虫基础 4 | 5 | - [单页面抓取分析](/single-page-analyze)(superagent 抓取网页,cheerio 分析) 6 | - [多页面抓取分析 (eventproxy 并发完回调)](/multiple-pages-analyze-use-eventproxy)(eventproxy 控制并发完的回调) 7 | - [多页面抓取分析 (async 控制并发数)](/multiple-pages-analyze-use-async)(async 控制同一时间并发量) 8 | - [设置代理](/proxy) 9 | 10 | 11 | ## 爬虫综合实战 12 | 13 | - [博客园首页数据分析](/cnblogs-homepage-analyze) 14 | - [博客园模拟登录](/cnblogs-auto-login) 15 | - [自动AC机器人](/auto-AC-machine) 16 | - [爬取百度地图 POI 数据](/poi) 17 | 18 | 19 | ## 其他 20 | 21 | - [Excel 数据读写](/excel-reader) 22 | - [Node 操作 MySQL](/node-mysql) 23 | - [Chat demo using socket.io](/chat) 24 | - [node-mail](/node-mail) 25 | - [博客园博文备份](/cnblogs-backup) 26 | -------------------------------------------------------------------------------- /cnblogs-auto-login/readme.md: -------------------------------------------------------------------------------- 1 | 将 `cnblogs-auto-login` 文件夹放入 Apache 的 www 目录下。 2 | 3 | ## 基于 [jsencrypt](http://travistidwell.com/jsencrypt/) 的加密解密 demo 4 | 5 | 6 | 7 | 页面展示加密内容,以及加密后的结果,控制台输出解密结果 8 | 9 | 10 | ## RSA Key Generator 11 | 12 | 13 | 14 | Generate RSA Private Key & Public Key 15 | 16 | ## 博客园自动登录步骤 17 | 18 | 19 | 1. 修改 cnblogs-auto-login/encrypt-data/index.html 文件中的 username(line 9) 和 password(line 10) 变量值为真实的博客园登录用户名和密码 20 | 21 | 2. 客户端运行 后生成加密后的用户名和密码保存到 a.txt 文件中(文件路径 cnblogs-auto-login/encrypt-data/a.txt) 22 | 23 | 3. 运行 `node cnblogs.js` 命令即完成模拟登录(后续可自动发帖、回帖等) -------------------------------------------------------------------------------- /single-page-analyze/index.js: -------------------------------------------------------------------------------- 1 | const cheerio = require('cheerio') 2 | const superagent = require('superagent') 3 | 4 | let url = 'http://www.cnblogs.com/' 5 | superagent 6 | .get(url) 7 | .end(function(err, sres) { // callback 8 | // 常规的错误处理 9 | if (err) { 10 | return next(err) 11 | } 12 | 13 | // sres.text 里面存储着网页的 html 内容,将它传给 cheerio.load 之后 14 | // 就可以得到一个实现了 jQuery 接口的变量,我们习惯性地将它命名为 `$` 15 | // 剩下就都是 jQuery 的内容了 16 | let $ = cheerio.load(sres.text) 17 | let ans = [] 18 | 19 | $('.titlelnk').each(function(index, item) { 20 | let $item = $(item) 21 | 22 | // 如果用 $item.html() 会得到 HTML 实体编码 23 | ans.push($item.text()) 24 | }) 25 | 26 | console.log(ans) 27 | }) -------------------------------------------------------------------------------- /proxy/README.md: -------------------------------------------------------------------------------- 1 | 分别尝试用 [superagent](/proxy/superagent-proxy.js) 以及 [request](/proxy/request-proxy.js) 来做 ip 代理的 HTTP 请求库。 2 | 3 | 使用方法非常简单,首先通过不同渠道获取一些免费 ip,然后通过相应 api 去模拟请求。 4 | 5 | 一些免费 ip 库: 6 | 7 | - http://www.xicidaili.com/nn 8 | - http://www.66ip.cn/ 9 | - http://cn-proxy.com/ 10 | - http://www.kuaidaili.com/free/ 11 | - http://ip.chinaz.com/getip.aspx(验证代理是否可用)[这个](https://httpbin.org/get) 备用 12 | 13 | [这里](https://segmentfault.com/q/1010000008196143/a-1020000008200295) 有一个很好的帖子给了我思路,首先获取免费 ip,然后去请求 http://ip.chinaz.com/getip.aspx ,因为这个网站本身就是通过 ip 来验证归属地的,通过请求的结果就能判断 ip 是否可用,适当设置 timeout 参数。 14 | 15 | --- 16 | 17 | todo: 18 | 19 | proxies 在你访问 http 时用 http 的设置,访问 https 时用 https 的设置。原代码中只考虑了 http 的情况,可参考 20 | -------------------------------------------------------------------------------- /cnblogs-backup/README.md: -------------------------------------------------------------------------------- 1 | # 博客园博文备份 2 | 3 | 1. 进入 下载博客园提供的备份文件(xml 格式) 4 | 2. 修改 `index.js` 文件中的 `baseFileSrc` 变量值为备份根目录地址(该地址必须真实存在),`xmlSrc` 值为步骤一所得文件的地址 5 | 3. `node index.js` 6 | 7 | 8 | 备份结束目录结构如下: 9 | 10 | cnblogs| 11 | --|2014 12 | --|9 13 | --|greasemonkey常见问题 14 | --|greasemonkey常见问题.html 15 | --|用php自动发邮件的简单实现 16 | --|用php自动发邮件的简单实现.html 17 | --|img 18 | --|10 19 | --|chrome扩展制作之hello world篇 20 | --|chrome扩展制作之hello world篇.html 21 | --|img 22 | 23 | ... 24 | 25 | --|2015 26 | 27 | ... 28 | 29 | --|2016 30 | 31 | ... 32 | -------------------------------------------------------------------------------- /excel-reader/excel-reader.js: -------------------------------------------------------------------------------- 1 | // 引入 xlsx 模块 2 | // https://github.com/SheetJS/js-xlsx 3 | var xlsx = require("xlsx"); 4 | var fs = require("fs"); 5 | 6 | // workbook 对象表示整份 Excel 文档 7 | // 一个 workbook 对象包含了 N 个 sheets(看 Excel 文档的左下角) 8 | var workbook = xlsx.readFileSync('example.xlsx'); 9 | 10 | 11 | // 打印出每个 sheet 的 name 12 | for (var i in workbook.SheetNames) 13 | console.log(workbook.SheetNames[i]); 14 | 15 | // 获取第一个 sheet 的名字 16 | var firstSheetName = workbook.SheetNames[0]; 17 | 18 | // 获取第一个 sheet 对象 19 | // 通过表名获取表格 20 | var sheet = workbook.Sheets[firstSheetName]; 21 | 22 | // 返回表的有效范围 23 | // A1:E180 24 | // console.log(sheet['!ref']); 25 | 26 | // 返回合并过的单元格 27 | // console.log(sheet['!merges']); 28 | 29 | // cell 对象,指的是 sheet 中的单元格,一个单元格就是一个 cell 对象 30 | // 一行 A 列(最左上角的 cell) 31 | // 对于多个单元格合并的大 cell,取左上角的单元格表示,别的单元格显示 undefined 32 | var cell = sheet["A1"]; 33 | console.log(cell); 34 | 35 | // the value of a cell 36 | console.log(cell.v); 37 | 38 | // fs.writeFileSync("a.txt", cell.v); -------------------------------------------------------------------------------- /poi/README.md: -------------------------------------------------------------------------------- 1 | 自行修改数据库登录信息、ak、以及 POI 关键字等 2 | 3 | ```bash 4 | npm install 5 | node index.js 6 | ``` 7 | 8 | 根据百度地图 Place API 获取 POI 数据 9 | 10 | POI,即 "Point of Interest",中文翻译为 "兴趣点"。打开百度地图,比如搜索「酒店」,搜索结果就是 POI 11 | 12 | 本次爬虫需要获取杭州主城八区的关键词为 "信息$电信$数据$电子商务$互联网$网络" 的公司企业数据 13 | 14 | 共有两个 API 可参考,一个为根据指定区域(比如杭州)返回数据,另一个是根据(矩形)坐标返回数据。由于 Place API 有返回数据 400 条的限制,所以第一个方案 pass,只能根据坐标层层分割进行递归 15 | 16 | 首先需要获取 ak,点击 [http://lbsyun.baidu.com/apiconsole/key?application=key](这里) 进行申请,每个 api 请求都要带上 ak 参数 17 | 18 | 然后需要获取所爬取区域在百度地图坐标系上的坐标,可在 [这里](http://api.map.baidu.com/lbsapi/getpoint/index.html) 进行大概获取。然后根据 [Place API](http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-placeapi) 获取这个区域内的数据,如果数据为 400 条,即说明这个区域内的数据肯定大于 400 条,将此区域一分为四,进行递归查询,一旦所查询区域内的数据总量小于 400,则将数据入库 19 | 20 | 另外 API 请求每天有次数限制,具体可以看 [这里](http://lbsyun.baidu.com/apiconsole/quota),2000次/天,我申请了开发者权限,可以达到 3w/天 的请求量 21 | 22 | 并发量的话,申请开发者权限后,是 3000次/分钟,因为我的爬取区域并不大,爬完都不需 3000 次请求,问题不大 23 | 24 | 并发量用 async 进行控制,我控制在 5,可自行修改。之前没申请开发者权限,也没用 async 进行控制,刚开始爬就被喊停,发短信警告了 -------------------------------------------------------------------------------- /cnblogs-auto-login/encrypt-data/index.html: -------------------------------------------------------------------------------- 1 | 2 | JavaScript RSA Encryption 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /cnblogs-auto-login/jsencrypt-demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | JSEncrypt 加密和解密 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /multiple-pages-analyze-use-async/index.js: -------------------------------------------------------------------------------- 1 | var cheerio = require('cheerio') 2 | , superagent = require('superagent') 3 | , async = require('async'); 4 | 5 | // 需要爬的网址 6 | function getUrls() { 7 | var urls = [] 8 | , baseUrl = 'http://acm.hdu.edu.cn/statistic.php?pid='; 9 | 10 | for (var i = 1000; i < 1100; i++) { 11 | var tmp = baseUrl + i; 12 | urls.push(tmp); 13 | } 14 | 15 | return urls; 16 | } 17 | 18 | // 页面解析,返回需要的内容 19 | function analyze(page) { 20 | var $ = cheerio.load(page); 21 | var postTime = $('.table_text td').eq(6).html(); 22 | 23 | return postTime; 24 | } 25 | 26 | // 抓取网页内容 27 | function fetchUrl(url, callback) { 28 | superagent.get(url) 29 | .end(function (err, res) { 30 | var page = res.text; 31 | 32 | // 页面分析,返回需要的数据 33 | var postTime = analyze(page); 34 | 35 | // postTime 加入到了 result 数组中 36 | callback(null, postTime); 37 | }); 38 | } 39 | 40 | 41 | var urls = getUrls(); 42 | 43 | // 并发量控制为 5 44 | // 对每个元素执行第三个回调 45 | // 全部执行完后执行第四个回调 46 | async.mapLimit(urls, 5, function(url, callback) { 47 | fetchUrl(url, callback); 48 | }, function (err, result) { 49 | console.log(result) 50 | }); -------------------------------------------------------------------------------- /node-mysql/index.js: -------------------------------------------------------------------------------- 1 | var mysql = require('mysql'); 2 | var connection = mysql.createConnection({ 3 | host : 'localhost', 4 | user : 'root', 5 | password : '12345', // my mac 6 | database : 'mydb' 7 | }); 8 | 9 | // 连接数据库 10 | connection.connect(); 11 | 12 | // var options = ''; // sql string 13 | // var queryOptions = ''; 14 | // var deleteOptions = ''; 15 | 16 | 17 | // 查 18 | var query = connection.query('SELECT * from news where url = ?', ['http://www.test.com'], function(err, rows, fields) { 19 | if (err) 20 | throw err; 21 | 22 | // 查到的符合的条数 23 | console.log(rows.length); 24 | 25 | for (var i in rows) { 26 | // rows[i] 为查到的每条数据 27 | // ... 28 | } 29 | }); 30 | 31 | // ? 为占位符 32 | 33 | // 增 34 | connection.query('INSERT INTO news(url, title, content) VALUES (?, ?, ?)', 35 | ['http://www.test.com', 'test_title', 'test_content']); 36 | 37 | 38 | // 删 39 | connection.query('DELETE FROM news WHERE url = (?)', ['http://www.test.com']); 40 | 41 | 42 | // 改 43 | connection.query('UPDATE news SET title = (?) where url = (?)', 44 | ['change_title', 'http://www.test.com']); 45 | 46 | 47 | // 关闭连接 48 | connection.end(); -------------------------------------------------------------------------------- /multiple-pages-analyze-use-eventproxy/index.js: -------------------------------------------------------------------------------- 1 | const cheerio = require('cheerio') 2 | , superagent = require('superagent') 3 | , eventproxy = require('eventproxy') 4 | 5 | // 需要爬的网址 6 | function getUrls() { 7 | var urls = [] 8 | , baseUrl = 'http://acm.hdu.edu.cn/statistic.php?pid='; 9 | 10 | for (var i = 1000; i <= 1009; i++) { 11 | var tmp = baseUrl + i; 12 | urls.push(tmp); 13 | } 14 | 15 | return urls; 16 | } 17 | 18 | // 页面解析,返回需要的内容 19 | function analyze(html) { 20 | var $ = cheerio.load(html); 21 | var userId = $('.table_text td').eq(6).html(); 22 | 23 | return userId; 24 | } 25 | 26 | // 抓取网页内容 27 | function fetchUrl(url) { 28 | superagent.get(url) 29 | .end(function (err, res) { 30 | // 抛出 `curl` 事件 31 | ep.emit('curl', res.text); 32 | }); 33 | } 34 | 35 | 36 | // start 37 | var urls = getUrls(); 38 | 39 | // 得到一个 eventproxy 的实例 40 | var ep = new eventproxy(); 41 | 42 | // ep 重复监听 `curl` 事件 urls.length 次(在这里也就是 10 次)后 43 | // 执行回调函数 44 | ep.after('curl', urls.length, function (htmls) { 45 | // pages 是个数组,包含了 10 次 ep.emit('curl', page) 中的那 10 个 page 46 | var res = htmls.map(function(html) { 47 | // 接下来都是 jQuery 的用法了 48 | return analyze(html); 49 | }); 50 | 51 | // 结果呈现 52 | console.log(res) 53 | }); 54 | 55 | // 开始并发爬取 56 | urls.forEach(function(item) { 57 | fetchUrl(item); 58 | }); -------------------------------------------------------------------------------- /chat/server.js: -------------------------------------------------------------------------------- 1 | var express = require('express'), 2 | app = express(), 3 | server = require('http').createServer(app), 4 | io = require('socket.io').listen(server), 5 | onlineNumber = 0 6 | 7 | // 设置静态资源目录 8 | app.use(express.static('./')) 9 | 10 | server.listen(8080, () => { 11 | console.log('run http://localhost:8080 in your browser') 12 | }) 13 | 14 | app.get('/', (req, res) => { 15 | res.sendFile(__dirname + '/index.html') 16 | }) 17 | 18 | io.sockets.on('connection', (socket) => { 19 | let isNickNameAdded = false 20 | 21 | // 用户刚连接上服务器,给出在线人数 22 | io.emit('showOnlineNumber', onlineNumber) 23 | 24 | // 用户 xxx 进入聊天室 25 | socket.on('finishNickname', () => { 26 | isNickNameAdded = true 27 | onlineNumber++ 28 | io.emit('showOnlineNumber', onlineNumber) 29 | }) 30 | 31 | // 掉线 32 | socket.on('disconnect', () => { 33 | if (isNickNameAdded) { 34 | onlineNumber-- 35 | io.emit('showOnlineNumber', onlineNumber) 36 | } 37 | }) 38 | 39 | // 接受到信息 40 | socket.on('sendMsg', (data) => { 41 | // sending to the client 42 | // 只发送给 sendMsg 过来的客户端 43 | // socket.emit('newMessage', data); 44 | 45 | // sending to all clients except sender 46 | // 给除了发送 sendMsg 过来的客户端外的客户端广播 47 | socket.broadcast.emit('newMessage', data) 48 | 49 | // 给所有客户端广播,两种方式 50 | // io.sockets.emit('newMessage', data) 51 | // io.emit('newMessage', data); 52 | }) 53 | }) 54 | -------------------------------------------------------------------------------- /node-mail/index.js: -------------------------------------------------------------------------------- 1 | var nodemailer = require('nodemailer'); 2 | var smtpTransport = require('nodemailer-smtp-transport'); 3 | 4 | var transporter = nodemailer.createTransport({ 5 | service: "qq", 6 | secure: true, // 使用 SSL 7 | auth: { 8 | user: "xxoo@qq.com", 9 | pass: "***" // 授权码,看 README 10 | } 11 | }); 12 | 13 | 14 | // 也可以这样 15 | // var transporter = nodemailer.createTransport({ 16 | // host: "smtp.qq.com", 17 | // port: 465, 18 | // secure: true, // 使用 SSL 19 | // auth: { 20 | // user: "xxoo@qq.com", 21 | // pass: "***" // 授权码,看 README 22 | // } 23 | // }); 24 | 25 | // 也可以这样 26 | // var transporter = nodemailer.createTransport(smtpTransport({ 27 | // host: "smtp.qq.com", 28 | // port: 465, 29 | // secure: true, // 使用 SSL 30 | // auth: { 31 | // user: "xxoo@qq.com", 32 | // pass: "***" // 授权码,看 README 33 | // } 34 | // })); 35 | 36 | 37 | // NB! No need to recreate the transporter object. You can use 38 | // the same transporter object for all e-mails 39 | 40 | // setup e-mail data with unicode symbols 41 | var mailOptions = { 42 | from: 'xxoo@qq.com', // sender address,和 transporter 中的配置保持一致 43 | to: 'ooxx@foxmail.com, ooxx@qq.com', // 邮件接收者,可以同时发送多个,逗号分隔 44 | subject: '测试邮件 title', // Subject line 45 | text: 'Hello world', // plaintext body 46 | html: fs.readFileSync('./tpl.html', 'utf-8') // html body,发送的邮件内容,当有 html 参数时会忽略 text 参数 47 | }; 48 | 49 | // send mail with defined transport object 50 | transporter.sendMail(mailOptions, function(error, info){ 51 | if(error){ 52 | return console.log(error); 53 | } 54 | 55 | console.log('Message sent: ' + info.response); 56 | }); -------------------------------------------------------------------------------- /cnblogs-auto-login/jsencrypt-demo/php/post.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cnblogs-homepage-analyze/front/total.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 博客园数据分析(获取各时间段发文总量) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 63 | 64 | -------------------------------------------------------------------------------- /cnblogs-homepage-analyze/front/average.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 博客园数据分析(获取各时间段发文平均阅读量) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 68 | 69 | -------------------------------------------------------------------------------- /mongoose/index.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose') 2 | const Schema = mongoose.Schema 3 | 4 | // test 为数据库名 5 | const uri = 'mongodb://localhost:27017/test' 6 | 7 | mongoose 8 | .connect(uri) 9 | .then(db => { 10 | console.log('😄 连接数据库成功') 11 | 12 | // 定义 schema 13 | let schema = new Schema({title:String, url: String}) 14 | 15 | // 定义 model 16 | // 数据库中会新建(如果没有) bookmarks 的 document 17 | let Bookmark = mongoose.model('bookmark', schema) 18 | 19 | 20 | // 以下操作数据库 21 | /////////////////////////////////////////////////////// 22 | 23 | // 增 24 | let doc0 = new Bookmark({title: '我的博客', url: 'https://hanzichi.github.io/blog'}) 25 | let doc1 = new Bookmark({title: '我的 GitHub', url: 'https://github.com/hanzichi'}) 26 | let doc2 = new Bookmark({title: '谷歌', url: 'https://google.com'}) 27 | let doc3 = new Bookmark({title: '思否', url: 'http://sf.gg'}) 28 | 29 | doc0.save(err => { 30 | if (err) { 31 | console.log('出错了') 32 | return 33 | } 34 | 35 | console.log('保存成功') 36 | }) 37 | 38 | let data = [ 39 | doc1, doc2, doc3 40 | ] 41 | 42 | Bookmark.insertMany(data, (err, docs) => { 43 | console.log(docs) 44 | }) 45 | 46 | 47 | // 查 48 | Bookmark.find({}, (err, docs) => { 49 | docs.forEach(item => { 50 | console.log(item.title, item.url) 51 | }) 52 | }) 53 | 54 | 55 | // 改 56 | // 条件 57 | var myWhere = {title: '思否'} 58 | 59 | // 设置新值 60 | // 更新的数据比较少用 $set,可用性还是很好 61 | var newValue = {$set: {title: 'sf'}} 62 | 63 | Bookmark.update(myWhere, newValue, (err, result) => { 64 | if (err) { 65 | console.log(err) 66 | } else { 67 | console.log('update ok') 68 | } 69 | }) 70 | 71 | 72 | // 删 73 | Bookmark.remove({title: 'sf'}, err => { 74 | if (err) { 75 | console.log(err) 76 | } else { 77 | console.log('remove ok') 78 | } 79 | }) 80 | 81 | 82 | // 关闭数据库 83 | // db.close() 84 | }) 85 | .catch(error => console.log('😿 连接数据库失败')) -------------------------------------------------------------------------------- /proxy/superagent-proxy.js: -------------------------------------------------------------------------------- 1 | const request = require('request') 2 | const iconv = require('iconv-lite') 3 | const superagent = require('superagent') 4 | require('superagent-proxy')(superagent) 5 | 6 | 7 | // 获取代理 ip 8 | function getProxyList() { 9 | // 一个免费 ip 库 10 | var apiURL = 'http://www.66ip.cn/mo.php?sxb=&tqsl=100&port=&export=&ktip=&sxa=&submit=%CC%E1++%C8%A1&textarea=http%3A%2F%2Fwww.66ip.cn%2F%3Fsxb%3D%26tqsl%3D100%26ports%255B%255D2%3D%26ktip%3D%26sxa%3D%26radio%3Dradio%26submit%3D%25CC%25E1%2B%2B%25C8%25A1'; 11 | 12 | return new Promise((resolve, reject) => { 13 | var options = { 14 | method: 'GET', 15 | url: apiURL, 16 | gzip: true, 17 | encoding: null, 18 | headers: { 19 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 20 | 'Accept-Encoding': 'gzip, deflate', 21 | 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4', 22 | 'User-Agent': 'Mozilla/8.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36', 23 | 'referer': 'http://www.66ip.cn/' 24 | }, 25 | }; 26 | 27 | request(options, function (error, response, body) { 28 | try { 29 | if (error) 30 | throw error; 31 | 32 | if (/meta.*charset=gb2312/.test(body)) { 33 | body = iconv.decode(body, 'gbk'); 34 | } 35 | 36 | var ret = body.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,4}/g); 37 | resolve(ret); 38 | } catch (e) { 39 | return reject(e); 40 | } 41 | }); 42 | }) 43 | } 44 | 45 | 46 | // 遍历 ip,找到一个能用的就停止 47 | getProxyList().then(function (proxyList) { 48 | let getPage = index => { 49 | let proxy = 'http://' + proxyList[index]; // 设置代理 50 | 51 | superagent 52 | .get('http://zichi.date') // 请求网页源码来测试 proxy 53 | .proxy(proxy) // key code 54 | .timeout(8000) 55 | .end((err, res) => { 56 | if (err) { 57 | console.log(err) 58 | getPage(index + 1) 59 | return; 60 | } 61 | 62 | console.log(res.text); 63 | }) 64 | } 65 | 66 | getPage(0) 67 | }).catch(e => { 68 | console.log(e); 69 | }) -------------------------------------------------------------------------------- /cnblogs-auto-login/node/cnblogs.js: -------------------------------------------------------------------------------- 1 | var superagent = require('superagent') 2 | , myCookie, VerificationTokenValue, input1, input2; 3 | 4 | // start 5 | // 获取加密后的用户名和密码 6 | getEncryptData(); 7 | 8 | // 获取 username & password 加密后的数据 9 | function getEncryptData() { 10 | superagent 11 | .get('http://localhost/cnblogs-auto-login/encrypt-data/a.txt') 12 | .end(function (err, sres) { // callback 13 | var data = JSON.parse(sres.text); 14 | 15 | input1 = data.username; 16 | input2 = data.password; 17 | 18 | // 去登录页面 19 | goToLogin(); 20 | }); 21 | } 22 | 23 | // go to 登录页面 24 | function goToLogin() { 25 | superagent 26 | .get('http://passport.cnblogs.com/user/signin?ReturnUrl=http://passport.cnblogs.com/') 27 | .end(function (err, sres) { // callback 28 | 29 | // 正则匹配获取 VerificationToken 的值 30 | var str = sres.text; 31 | 32 | var pattern = /'VerificationToken': '(.*)'/ 33 | , tmpArr = str.match(pattern); 34 | 35 | VerificationTokenValue = tmpArr[1]; 36 | 37 | // 模拟登录 38 | login(); 39 | }); 40 | } 41 | 42 | // 模拟登录 43 | function login() { 44 | superagent 45 | // 登录 url 46 | .post('http://passport.cnblogs.com/user/signin') 47 | // post 用户名 & 密码 48 | .send({"input1": input1}) 49 | .send({"input2": input2}) 50 | .send({"remember": "false"}) 51 | .set("Content-Type", "application/json; charset=UTF-8") 52 | .set("VerificationToken", VerificationTokenValue) 53 | .set("Cookie", "AspxAutoDetectCookieSupport=1;") 54 | .set("X-Requested-With", "XMLHttpRequest") 55 | .end(function(err, sres) { 56 | var str = sres.header['set-cookie'][0]; 57 | var pos = str.indexOf(';'); 58 | 59 | // 后续操作所需要的 cookie 60 | myCookie = str.substr(0, pos); 61 | 62 | // 后续操作 63 | // ... 64 | // 比如回帖 65 | doSomething(); 66 | }); 67 | } 68 | 69 | // 回帖操作 70 | function doSomething() { 71 | // 回帖 72 | // http://www.cnblogs.com/zichi/p/5331426.html 73 | var content = '好文要顶!'; 74 | 75 | superagent 76 | .post('http://www.cnblogs.com/mvc/PostComment/Add.aspx') 77 | .set("Cookie", myCookie) 78 | .send({"blogApp": "zichi"}) 79 | .send({"body": content}) 80 | .send({"postId": 5331426}) 81 | .end(function (err, sres) { // callback 82 | }) 83 | } -------------------------------------------------------------------------------- /proxy/request-proxy.js: -------------------------------------------------------------------------------- 1 | const request = require("request"); 2 | const iconv = require('iconv-lite'); 3 | const superagent = require('superagent') 4 | require('superagent-proxy')(superagent) 5 | 6 | 7 | // 获取代理 ip 8 | function getProxyList() { 9 | var apiURL = 'http://www.66ip.cn/mo.php?sxb=&tqsl=100&port=&export=&ktip=&sxa=&submit=%CC%E1++%C8%A1&textarea=http%3A%2F%2Fwww.66ip.cn%2F%3Fsxb%3D%26tqsl%3D100%26ports%255B%255D2%3D%26ktip%3D%26sxa%3D%26radio%3Dradio%26submit%3D%25CC%25E1%2B%2B%25C8%25A1'; 10 | 11 | return new Promise((resolve, reject) => { 12 | var options = { 13 | method: 'GET', 14 | url: apiURL, 15 | gzip: true, 16 | encoding: null, 17 | headers: { 18 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 19 | 'Accept-Encoding': 'gzip, deflate', 20 | 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4', 21 | 'User-Agent': 'Mozilla/8.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36', 22 | 'referer': 'http://www.66ip.cn/' 23 | }, 24 | }; 25 | 26 | request(options, function (error, response, body) { 27 | try { 28 | if (error) 29 | throw error; 30 | 31 | if (/meta.*charset=gb2312/.test(body)) { 32 | body = iconv.decode(body, 'gbk'); 33 | } 34 | 35 | var ret = body.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,4}/g); 36 | resolve(ret); 37 | } catch (e) { 38 | return reject(e); 39 | } 40 | }); 41 | }) 42 | } 43 | 44 | 45 | getProxyList().then(function (proxyList) { 46 | let getPage = index => { 47 | 48 | var targetOptions = { 49 | method: 'GET', 50 | url: 'http://zichi.date', // 获取该网站网页 51 | timeout: 8000, 52 | encoding: null, 53 | }; 54 | 55 | targetOptions.proxy = 'http://' + proxyList[index]; // key code 56 | 57 | request(targetOptions, function (error, response, body) { 58 | try { 59 | if (error) { 60 | throw error; 61 | getPage(index + 1) 62 | return 63 | } 64 | 65 | body = body.toString(); 66 | console.log(body); 67 | } catch (e) { 68 | console.error(e); 69 | getPage(index + 1) 70 | } 71 | }); 72 | } 73 | 74 | getPage(0) 75 | }).catch(e => { 76 | console.log(e); 77 | }) 78 | -------------------------------------------------------------------------------- /cnblogs-homepage-analyze/node/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express') 2 | , cheerio = require('cheerio') 3 | , superagent = require('superagent') 4 | , eventproxy = require('eventproxy'); 5 | 6 | // 得到一个 eventproxy 的实例 7 | var ep = new eventproxy() 8 | , app = express(); 9 | 10 | 11 | app.get('/', function (req, res, next) { 12 | var postUrl = 'http://www.cnblogs.com/mvc/AggSite/PostList.aspx' 13 | // 共有 200 页文章 14 | // 从第 51 页开始抓取 15 | , startNum = 51 16 | // 抓取的网页数量 17 | , pageNum = 150; 18 | 19 | // 监听 pageNum 次 `curl` 事件后,执行回调 20 | ep.after('curl', pageNum, function (data) { 21 | // data 是个数组,包含了 pageNum 次 ep.emit('curl', tmp) 中的那 pageNum 个 tmp 22 | 23 | var ans = []; 24 | for (var i = 0, len = data.length; i < len; i++) 25 | Array.prototype.push.apply(ans, data[i]); 26 | 27 | // 返回 jsonp 供前端调用,callback 函数名为 fn 28 | res.send("fn(" + JSON.stringify(ans) + ");"); 29 | }); 30 | 31 | // 从第 51 页开始抓取 32 | for (var i = startNum; i < startNum + pageNum; i++) { 33 | superagent 34 | .post(postUrl) 35 | .send({"CategoryType":"SiteHome","ParentCategoryId":0,"CategoryId":808,"PageIndex":i,"ItemListActionName":"PostList"}) 36 | .end(function (err, sres) { // callback 37 | // 常规的错误处理 38 | if (err) { 39 | return next(err); 40 | } 41 | 42 | // sres.text 里面存储着网页的 html 内容,将它传给 cheerio.load 之后 43 | // 就可以得到一个实现了 jQuery 接口的变量,我们习惯性地将它命名为 `$` 44 | // 剩下就都是 jQuery 的内容了 45 | var $ = cheerio.load(sres.text); 46 | // 存储每页 20 条数据的 20 个对象 47 | var tmp = []; 48 | 49 | // 获取博文发表时间 50 | $('.lightblue').each(function (index, item) { 51 | var str = item.nextSibling.nodeValue 52 | , pos = str.indexOf(":") 53 | , obj = {postHour: str.substring(pos - 2, pos)}; 54 | 55 | tmp.push(obj); 56 | }); 57 | 58 | // 获取博文阅读量 59 | $('.article_view .gray').each(function (index, item) { 60 | var $item = $(item) 61 | , str = $item.html(); 62 | 63 | var start = str.indexOf('(') 64 | , end = str.indexOf(')'); 65 | 66 | tmp[index].viewTimes = str.substring(start + 1, end); 67 | }); 68 | 69 | // 每抓取一个网页,抛出事件 70 | ep.emit('curl', tmp.concat()); 71 | }); 72 | } 73 | }); 74 | 75 | // listen 76 | app.listen(3000, function () { 77 | console.log('app is listening at port 3000'); 78 | }); 79 | -------------------------------------------------------------------------------- /chat/client.js: -------------------------------------------------------------------------------- 1 | let config = { 2 | name: '', // nickname 3 | } 4 | 5 | // 与 server.js 启动地址对应 6 | var socket = io.connect('http://localhost:8080') 7 | 8 | // 监听服务端发出的 newMessage 事件 9 | socket.on('newMessage', (data) => generateMsgItem(data)) 10 | 11 | socket.on('showOnlineNumber', (onlineNumber) => { 12 | $('#onlineNumber').text(`匿名聊天室(当前在线 ${onlineNumber} 人)`) 13 | }) 14 | 15 | // 发送信息 16 | $('#msgBtn').click(() => { 17 | let name = config.name 18 | let msg = document.querySelector('#msgIpt').value 19 | sendMessage({ name, msg }) 20 | $('#msgIpt').val('') 21 | }) 22 | 23 | // 当输入文字时,取消 has-error 样式 24 | $('#nameIpt').on('focus', () => { 25 | $('#myModal').removeClass('has-error') 26 | }) 27 | 28 | // 点击保存昵称 29 | $('#nameBtn').click(() => { 30 | let name = $('#nameIpt').val().trim() 31 | 32 | if (name === '') { 33 | $('#myModal').addClass('has-error') 34 | $('#helpBlock').show() 35 | } else { 36 | config.name = name 37 | $('#myModal').modal('hide') 38 | socket.emit('finishNickname') 39 | } 40 | }) 41 | 42 | // 发送信息以及昵称保存都可以按 enter 键 43 | document.onkeydown = (e) => { 44 | if (e.keyCode !== 13) return 45 | 46 | let id = e.target.id 47 | 48 | // 发送消息 49 | if (id === 'msgIpt') { 50 | let name = config.name, 51 | msg = document.querySelector('#msgIpt').value 52 | 53 | sendMessage({ name, msg }) 54 | $('#msgIpt').val('') 55 | } else if (id === 'nameIpt') { 56 | // 保存昵称 57 | let name = $('#nameIpt').val().trim() 58 | 59 | if (name === '') { 60 | } else { 61 | config.name = name 62 | $('#myModal').modal('hide') // 隐藏遮罩层 63 | socket.emit('finishNickname') 64 | } 65 | } 66 | } 67 | 68 | function sendMessage(data) { 69 | // 发送消息 70 | socket.emit('sendMsg', data) 71 | generateMsgItem(data, true) 72 | } 73 | 74 | function generateMsgItem(data, isRight = false) { 75 | let item = document.createElement('div') 76 | item.className = 'item' + (isRight ? ' text-right' : '') 77 | 78 | if (isRight) 79 | item.innerHTML = `${data.msg}【${data.name}】` 80 | else 81 | item.innerHTML = `【${data.name}】${data.msg}` 82 | 83 | document.querySelector('.chat-area').appendChild(item) 84 | 85 | // 如果聊天区域的内容高度大于了 DOM 高度,则自动 scroll 到最底下 86 | let realHeight = document.querySelector('.chat-area').scrollHeight 87 | let viewHeight = $('.chat-area').height() 88 | $('.chat-area').scrollTop(realHeight - viewHeight) 89 | } 90 | 91 | // 页面初始化时显示 modal 92 | $('#myModal').modal({ show: 'show', backdrop: 'static' }) 93 | -------------------------------------------------------------------------------- /auto-AC-machine/one.js: -------------------------------------------------------------------------------- 1 | var cheerio = require('cheerio') 2 | , superagent = require('superagent') 3 | 4 | const agent = superagent.agent() 5 | 6 | // 模拟代码提交 7 | function post(code, problemId) { 8 | agent 9 | // 代码 post 的 url 10 | .post('http://acm.hdu.edu.cn/submit.php?action=submit') 11 | .set('Content-Type', 'application/x-www-form-urlencoded') 12 | .send({"problemid": problemId}) 13 | .send({"usercode": code}) 14 | .end(function (err, sres) { 15 | }); 16 | } 17 | 18 | 19 | // 从 csdn 题解详情页获取代码 20 | function getCode(solutionUrl, problemId) { 21 | agent.get(solutionUrl, function(err, sres) { 22 | // 为防止该 solutionUrl 可能不是题解详情页 23 | // 如果不是,则没有 class 为 cpp 的 dom 元素 24 | try { 25 | var $ = cheerio.load(sres.text); 26 | var code = $('.cpp').eq(0).text(); 27 | 28 | if (!code) 29 | return; 30 | 31 | post(code, problemId); 32 | } catch(e) { 33 | 34 | } 35 | }); 36 | } 37 | 38 | 39 | // 模拟百度搜索题解 40 | function bdSearch(problemId) { 41 | var searchUrl = 'https://www.baidu.com/s?ie=UTF-8&wd=hdu' + problemId; 42 | 43 | agent 44 | .get(searchUrl) 45 | // 必带的请求头 UA 46 | .set("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36") 47 | .end(function(err, sres) { 48 | var $ = cheerio.load(sres.text); 49 | var lis = $('.t a'); 50 | 51 | for (var i = 0; i < 10; i++) { 52 | var node = lis.eq(i); 53 | 54 | // 获取那个小的 url 地址 55 | var text = node.parent().next().next().children("a").text(); 56 | 57 | // 如果 url 不带有 csdn 字样,则返回 58 | // 只分析 csdn 题解 59 | if (text.toLowerCase().indexOf("csdn") === -1) 60 | continue; 61 | 62 | // 题解详情页 url 63 | var solutionUrl = node.attr('href'); 64 | getCode(solutionUrl, problemId); 65 | } 66 | }); 67 | } 68 | 69 | 70 | // 模拟登录 71 | function login() { 72 | agent 73 | // get 请求任意 acm.hdu.edu.cn 域名下的一个 url 74 | // 获取 key 为 PHPSESSID 这个 Cookie 75 | .get('http://acm.hdu.edu.cn/status.php') 76 | .end(function(err, sres) { 77 | // 模拟登录 78 | agent 79 | // 登录 url 80 | .post('http://acm.hdu.edu.cn/userloginex.php?action=login') 81 | // post 用户名 & 密码 82 | .send({"username": "hanzichi"}) 83 | .send({"userpass": "hanzichi"}) 84 | // 这个请求头是必须的 85 | .set("Content-Type", "application/x-www-form-urlencoded") 86 | .end(function(err, sres) { 87 | // 登录完成后,启动程序 88 | start(); 89 | }); 90 | }); 91 | } 92 | 93 | // 模拟提交 hdoj 1004 94 | function start() { 95 | bdSearch(1000); 96 | } 97 | 98 | login(); -------------------------------------------------------------------------------- /chat/index.html: -------------------------------------------------------------------------------- 1 | 4 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 匿名聊天室 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 43 | 44 | 45 | Send 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 65 | 66 | 67 | Your name cannot be empty ! 73 | 77 | Save 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /auto-AC-machine/all.js: -------------------------------------------------------------------------------- 1 | var cheerio = require('cheerio') 2 | , superagent = require('superagent') 3 | , globalCookie; 4 | 5 | 6 | // 模拟代码提交 7 | function post(code, problemId) { 8 | superagent 9 | // 代码 post 的 url 10 | .post('http://acm.hdu.edu.cn/submit.php?action=submit') 11 | .set('Content-Type', 'application/x-www-form-urlencoded') 12 | .set("Cookie", globalCookie) 13 | .send({"problemid": problemId}) 14 | .send({"usercode": code}) 15 | .end(function (err, sres) { 16 | }); 17 | } 18 | 19 | // 从 csdn 题解详情页获取代码 20 | function getCode(solutionUrl, problemId) { 21 | superagent.get(solutionUrl, function(err, sres) { 22 | // 为防止该 solutionUrl 可能不是题解详情页 23 | // 如果不是,则没有 class 为 cpp 的 dom 元素 24 | try { 25 | var $ = cheerio.load(sres.text); 26 | var code = $('.cpp').eq(0).text(); 27 | 28 | if (!code) 29 | return; 30 | 31 | post(code, problemId); 32 | } catch(e) { 33 | 34 | } 35 | }); 36 | } 37 | 38 | // 模拟百度搜索题解 39 | function bdSearch(problemId) { 40 | var searchUrl = 'https://www.baidu.com/s?ie=UTF-8&wd=hdu' + problemId; 41 | 42 | superagent 43 | .get(searchUrl) 44 | // 必带的请求头 45 | .set("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36") 46 | .end(function(err, sres) { 47 | var $ = cheerio.load(sres.text); 48 | var lis = $('.t a'); 49 | for (var i = 0; i < 10; i++) { 50 | var node = lis.eq(i); 51 | // 获取那个小的 url 地址 52 | var text = node.parent().next().next().children("a").text(); 53 | // 如果 url 不带有 csdn 字样,则返回 54 | if (text.toLowerCase().indexOf("csdn") === -1) 55 | continue; 56 | 57 | // 题解详情页 url 58 | var solutionUrl = node.attr('href'); 59 | getCode(solutionUrl, problemId); 60 | } 61 | }); 62 | } 63 | 64 | 65 | // 模拟登录 66 | function login() { 67 | superagent 68 | // get 请求任意 acm.hdu.edu.cn 域名下的一个 url 69 | // 获取 key 为 PHPSESSID 这个 Cookie 70 | .get('http://acm.hdu.edu.cn/status.php') 71 | .end(function(err, sres) { 72 | // 提取 Cookie 73 | var str = sres.header['set-cookie'][0]; 74 | // 过滤响应头 Cookie 中的 path 字段 75 | var pos = str.indexOf(';'); 76 | // 全局变量存储 Cookie,post 代码提交时候用 77 | globalCookie = str.substr(0, pos); 78 | 79 | // 模拟登录 80 | superagent 81 | // 登录 url 82 | .post('http://acm.hdu.edu.cn/userloginex.php?action=login') 83 | // post 用户名 & 密码 84 | .send({"username": "hanzichi"}) 85 | .send({"userpass": "hanzichi"}) 86 | // 这个请求头是必须的 87 | .set("Content-Type", "application/x-www-form-urlencoded") 88 | // 请求携带 Cookie 89 | .set("Cookie", globalCookie) 90 | .end(function(err, sres) { 91 | // 登录完成后,启动程序 92 | start(); 93 | }); 94 | }); 95 | } 96 | 97 | 98 | // 程序启动 99 | // 控制刷题范围 100 | function start() { 101 | for (var i = 1000; i <= 1010; i++) { 102 | var problemId = i 103 | , delay = (i - 1000) * 10000; 104 | 105 | (function(delay, problemId) { 106 | setTimeout(function() { 107 | bdSearch(problemId); 108 | }, delay); 109 | }(delay, problemId)); 110 | } 111 | } 112 | 113 | login(); -------------------------------------------------------------------------------- /poi/index.js: -------------------------------------------------------------------------------- 1 | const superagent = require('superagent') 2 | const querystring = require('querystring') 3 | const async = require('async') 4 | const connection = require('./model').connection 5 | const insertData = require('./model').insertData 6 | 7 | // 连接数据库 8 | connection.connect() 9 | 10 | // 爬取的数据总数 11 | var total = 0 12 | 13 | var q = async.queue(function(task, callback) { 14 | // callback 运行的时候是这个任务结束的标志,所以如果有异步操作,callback 需要在异步的回调函数中去执行 15 | task.run(callback) 16 | }, 5) // 控制 5 个并发量 17 | 18 | // q.saturated = function() { 19 | // console.log('all workers to be used'); 20 | // } 21 | 22 | /** 23 | * 监听:当所有任务都执行完以后,将调用该函数 24 | */ 25 | q.drain = function() { 26 | console.log('all tasks have been processed!'); 27 | // connection.end(); 28 | console.log(total) 29 | } 30 | 31 | let baseUrl = 'http://api.map.baidu.com/place/v2/search?\ 32 | tag=' + querystring.escape('公司企业') + 33 | '&query=' + querystring.escape('信息$电信$数据$电子商务$互联网$网络') + 34 | '&output=json\ 35 | &ak=TyyWGrjACoSWpsc7SAuupG7Z0156DADe\ 36 | &page_size=20' 37 | 38 | 39 | function getDataInfo(url) { 40 | return new Promise(resolve => { 41 | superagent 42 | .get(url) 43 | .end(function(err, sres) { 44 | if (err) { 45 | console.log('出错了') 46 | } else { 47 | resolve(JSON.parse(sres.text)) 48 | } 49 | }) 50 | }) 51 | } 52 | 53 | function getAllData(bottomLeft, topRight) { 54 | for (let i = 0; i <= 19; i++) { 55 | q.push({ 56 | run: function(cb) { 57 | ;(async function() { 58 | let url = baseUrl + '&bounds=' + bottomLeft[0] + ',' + bottomLeft[1] + ',' + topRight[0] + ',' + topRight[1] + '&page_num=' + i 59 | 60 | let ret = await getDataInfo(url) 61 | cb() 62 | 63 | if (Array.isArray(ret.results) && ret.results.length) { 64 | total += ret.results.length 65 | ret.results.forEach(item => { 66 | insertData(item.name, item.address, item.location.lat, item.location.lng) 67 | }) 68 | } 69 | })() 70 | } 71 | }, () => {console.log('完成抓取')}) 72 | } 73 | } 74 | 75 | function dfs(bottomLeft, topRight) { 76 | q.push({ 77 | run: function(cb) { 78 | ;(async function() { 79 | let url = baseUrl + '&bounds=' + bottomLeft[0] + ',' + bottomLeft[1] + ',' + topRight[0] + ',' + topRight[1] 80 | 81 | let ret = await getDataInfo(url) 82 | cb() 83 | 84 | // 还可以继续递归 85 | if (ret.total === 400) { 86 | console.log('net yet...') 87 | // 分割 88 | let midX = (bottomLeft[0] + topRight[0]) / 2 89 | let midY = (bottomLeft[1] + topRight[1]) / 2 90 | 91 | dfs([midX, bottomLeft[1]], [topRight[0], midY]) 92 | dfs([midX, midY], topRight) 93 | dfs(bottomLeft, [midX, midY]) 94 | dfs([bottomLeft[0], midY], [midX, topRight[1]]) 95 | } else { // 已经是小区块 96 | getAllData(bottomLeft, topRight) 97 | console.log('抓取小区块数据') 98 | } 99 | })() 100 | } 101 | }, () => {console.log('完成抓取')}) 102 | } 103 | 104 | // 开始采集数据 105 | // dfs([29.840924, 119.662545], [30.582335, 120.758016]) 106 | // 左下角坐标 & 右上角坐标 107 | dfs([30.105725,120.09363,], [30.255579,120.410983]) 108 | -------------------------------------------------------------------------------- /cnblogs-backup/index.js: -------------------------------------------------------------------------------- 1 | // config 2 | var baseFileSrc = "C:/Program Files/nodejs/cnblogs/"; 3 | var xmlSrc = "C:/Program Files/nodejs/cnblogs/CNBlogs_BlogBackup_131_201409_201608.xml"; 4 | 5 | 6 | var http = require('http'); 7 | var https = require('https'); 8 | var cheerio = require('cheerio'); 9 | var fs = require('fs'); 10 | 11 | 12 | // to download picture 13 | function download(url, savePath) { 14 | var req = http.get(url, function(res){ 15 | var binImage = ''; 16 | res.setEncoding('binary'); 17 | 18 | res.on('data', function(chunk){ 19 | binImage += chunk; 20 | }); 21 | 22 | res.on('end', function(){ 23 | if (!binImage) { 24 | console.log('image data is null'); 25 | return null; 26 | } 27 | 28 | fs.writeFile(savePath, binImage, 'binary', function(err){ 29 | if (err) throw err; 30 | console.log('It\'s saved!'); // 文件被保存 31 | }); 32 | }); 33 | }); 34 | } 35 | 36 | fs.readFile(xmlSrc, {encoding: "utf-8"}, function(err, data) { 37 | var $ = cheerio.load(data); 38 | $('item').each(function (index, item) { 39 | // 文章正文 40 | var content = $(item).find("description").html(); 41 | content = content.replace("", ""); 42 | 43 | // 文章标题 44 | var title = $(item).find("title").text(); 45 | // 过滤非法字符 46 | title = title.replace(/(\/|\\|\:|\*|\?|\"|\<|\>|\|)/g, ""); 47 | 48 | // 日期,用来做目录索引 49 | // 日期格式:Sun, 24 Jul 2016 09:29:00 GMT 50 | var time = $(item).find("pubDate").text(); 51 | 52 | var date = new Date(time); 53 | var year = date.getFullYear() + ''; 54 | var month = date.getMonth() + ''; 55 | 56 | var isYearFileExists = fs.existsSync(baseFileSrc + year); 57 | !isYearFileExists && fs.mkdirSync(baseFileSrc + year); 58 | 59 | var isMonthFileExists = fs.existsSync(baseFileSrc + year + "/" + month); 60 | !isMonthFileExists && fs.mkdirSync(baseFileSrc + year + "/" + month); 61 | 62 | var isDetailFileExists = fs.existsSync(baseFileSrc + year + '/' + month + '/' + title); 63 | !isDetailFileExists && fs.mkdirSync(baseFileSrc + year + '/' + month + '/' + title); 64 | 65 | // 判断是 HTML 还是 markdown 66 | isHTML = (content.indexOf("style") !== -1 || content.indexOf("class") !== -1) 67 | && content.indexOf("![]") === -1; 68 | 69 | if (isHTML) { 70 | content = '' + content; 71 | 72 | var pattern = /src="(http.*?(jpg|gif|png))/g; 73 | var picId = -1; 74 | 75 | content = content.replace(pattern, function(a, b, c) { 76 | picId++; 77 | isPicFileExits = fs.existsSync(baseFileSrc + year + '/' + month + '/' + title + '/' + 'img'); 78 | !isPicFileExits && fs.mkdirSync(baseFileSrc + year + '/' + month + '/' + title + '/' + 'img'); 79 | 80 | var url = b; 81 | var savePath = baseFileSrc + year + '/' + month + '/' + title + '/' + 'img' + '/' + picId + '.' + c; 82 | 83 | download(url, savePath); 84 | 85 | return "src=\"img/" + picId + "." + c; 86 | }); 87 | 88 | fs.writeFile(baseFileSrc + year + '/' + month + '/' + title + '/' + title + '.html', content); 89 | } 90 | else{ 91 | var pattern = /http.*?(jpg|gif|png)/g; 92 | var picId = -1; 93 | 94 | content = content.replace(pattern, function(a, b) { 95 | picId++; 96 | isPicFileExits = fs.existsSync(baseFileSrc + year + '/' + month + '/' + title + '/' + 'img'); 97 | !isPicFileExits && fs.mkdirSync(baseFileSrc + year + '/' + month + '/' + title + '/' + 'img'); 98 | 99 | var url = a; 100 | var savePath = baseFileSrc + year + '/' + month + '/' + title + '/' + 'img' + '/' + picId + '.' + b; 101 | 102 | download(url, savePath); 103 | 104 | return "img/" + picId + "." + b; 105 | }); 106 | 107 | fs.writeFile(baseFileSrc + year + '/' + month + '/' + title + '/' + title + '.md', content); 108 | } 109 | }); 110 | }); -------------------------------------------------------------------------------- /cnblogs-auto-login/key-generator/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Online RSA Key Generator 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Toggle navigation 18 | 19 | 20 | 21 | 22 | JSEncrypt 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Online RSA Key Generator 31 | 32 | 33 | 34 | 35 | Key Size 36 | 1024 bit 38 | 39 | 512 bit 40 | 1024 bit 41 | 2048 bit 42 | 4096 bit 43 | 44 | 45 | 46 | 47 | Generate New Keys 48 | 49 | 50 | 51 | Async 52 | 53 | 54 | 55 | 56 | Private Key 57 | 58 | 59 | 60 | 61 | 62 | Public Key 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | RSA Encryption Test 73 | 74 | 75 | Text to encrypt: 76 | This is a test! 77 | 78 | 79 | 80 | Encrypt / Decrypt 81 | 82 | 83 | Encrypted: 84 | 85 | 86 | 87 | 88 | 89 | 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /cnblogs-homepage-analyze/front/js/Chart.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Chart.js 3 | * http://chartjs.org/ 4 | * Version: 1.0.2 5 | * 6 | * Copyright 2015 Nick Downie 7 | * Released under the MIT license 8 | * https://github.com/nnnick/Chart.js/blob/master/LICENSE.md 9 | */ 10 | (function(){"use strict";var t=this,i=t.Chart,e=function(t){this.canvas=t.canvas,this.ctx=t;var i=function(t,i){return t["offset"+i]?t["offset"+i]:document.defaultView.getComputedStyle(t).getPropertyValue(i)},e=this.width=i(t.canvas,"Width")||t.canvas.width,n=this.height=i(t.canvas,"Height")||t.canvas.height;return e=this.width=t.canvas.width,n=this.height=t.canvas.height,this.aspectRatio=this.width/this.height,s.retinaScale(this),this};e.defaults={global:{animation:!0,animationSteps:60,animationEasing:"easeOutQuart",showScale:!0,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleIntegersOnly:!0,scaleBeginAtZero:!1,scaleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",responsive:!1,maintainAspectRatio:!0,showTooltips:!0,customTooltips:!1,tooltipEvents:["mousemove","touchstart","touchmove","mouseout"],tooltipFillColor:"rgba(0,0,0,0.8)",tooltipFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:14,tooltipFontStyle:"normal",tooltipFontColor:"#fff",tooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontSize:14,tooltipTitleFontStyle:"bold",tooltipTitleFontColor:"#fff",tooltipTitleTemplate:"<%= label%>",tooltipYPadding:6,tooltipXPadding:6,tooltipCaretSize:8,tooltipCornerRadius:6,tooltipXOffset:10,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>",multiTooltipTemplate:"<%= value %>",multiTooltipKeyBackground:"#fff",segmentColorDefault:["#A6CEE3","#1F78B4","#B2DF8A","#33A02C","#FB9A99","#E31A1C","#FDBF6F","#FF7F00","#CAB2D6","#6A3D9A","#B4B482","#B15928"],segmentHighlightColorDefaults:["#CEF6FF","#47A0DC","#DAFFB2","#5BC854","#FFC2C1","#FF4244","#FFE797","#FFA728","#F2DAFE","#9265C2","#DCDCAA","#D98150"],onAnimationProgress:function(){},onAnimationComplete:function(){}}},e.types={};var s=e.helpers={},n=s.each=function(t,i,e){var s=Array.prototype.slice.call(arguments,3);if(t)if(t.length===+t.length){var n;for(n=0;n=0;s--){var n=t[s];if(i(n))return n}},s.inherits=function(t){var i=this,e=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},s=function(){this.constructor=e};return s.prototype=i.prototype,e.prototype=new s,e.extend=r,t&&a(e.prototype,t),e.__super__=i.prototype,e}),c=s.noop=function(){},u=s.uid=function(){var t=0;return function(){return"chart-"+t++}}(),d=s.warn=function(t){window.console&&"function"==typeof window.console.warn&&console.warn(t)},p=s.amd="function"==typeof define&&define.amd,f=s.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},g=s.max=function(t){return Math.max.apply(Math,t)},m=s.min=function(t){return Math.min.apply(Math,t)},v=(s.cap=function(t,i,e){if(f(i)){if(t>i)return i}else if(f(e)&&e>t)return e;return t},s.getDecimalPlaces=function(t){if(t%1!==0&&f(t)){var i=t.toString();if(i.indexOf("e-")<0)return i.split(".")[1].length;if(i.indexOf(".")<0)return parseInt(i.split("e-")[1]);var e=i.split(".")[1].split("e-");return e[0].length+parseInt(e[1])}return 0}),S=s.radians=function(t){return t*(Math.PI/180)},x=(s.getAngleFromPoint=function(t,i){var e=i.x-t.x,s=i.y-t.y,n=Math.sqrt(e*e+s*s),o=2*Math.PI+Math.atan2(s,e);return 0>e&&0>s&&(o+=2*Math.PI),{angle:o,distance:n}},s.aliasPixel=function(t){return t%2===0?0:.5}),y=(s.splineCurve=function(t,i,e,s){var n=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2)),o=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),a=s*n/(n+o),h=s*o/(n+o);return{inner:{x:i.x-a*(e.x-t.x),y:i.y-a*(e.y-t.y)},outer:{x:i.x+h*(e.x-t.x),y:i.y+h*(e.y-t.y)}}},s.calculateOrderOfMagnitude=function(t){return Math.floor(Math.log(t)/Math.LN10)}),C=(s.calculateScaleRange=function(t,i,e,s,n){var o=2,a=Math.floor(i/(1.5*e)),h=o>=a,l=g(t),r=m(t);l===r&&(l+=.5,r>=.5&&!s?r-=.5:l+=.5);for(var c=Math.abs(l-r),u=y(c),d=Math.ceil(l/(1*Math.pow(10,u)))*Math.pow(10,u),p=s?0:Math.floor(r/(1*Math.pow(10,u)))*Math.pow(10,u),f=d-p,v=Math.pow(10,u),S=Math.round(f/v);(S>a||a>2*S)&&!h;)if(S>a)v*=2,S=Math.round(f/v),S%1!==0&&(h=!0);else if(n&&u>=0){if(v/2%1!==0)break;v/=2,S=Math.round(f/v)}else v/=2,S=Math.round(f/v);return h&&(S=o,v=f/S),{steps:S,stepValue:v,min:p,max:p+S*v}},s.template=function(t,i){function e(t,i){var e=/\W/.test(t)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+t.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):s[t]=s[t];return i?e(i):e}if(t instanceof Function)return t(i);var s={};return e(t,i)}),b=(s.generateLabels=function(t,i,e,s){var o=new Array(i);return t&&n(o,function(i,n){o[n]=C(t,{value:e+s*(n+1)})}),o},s.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-0.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-0.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-0.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-0.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),st?-.5*(s*Math.pow(2,10*(t-=1))*Math.sin((1*t-i)*(2*Math.PI)/e)):s*Math.pow(2,-10*(t-=1))*Math.sin((1*t-i)*(2*Math.PI)/e)*.5+1)},easeInBack:function(t){var i=1.70158;return 1*(t/=1)*t*((i+1)*t-i)},easeOutBack:function(t){var i=1.70158;return 1*((t=t/1-1)*t*((i+1)*t+i)+1)},easeInOutBack:function(t){var i=1.70158;return(t/=.5)<1?.5*(t*t*(((i*=1.525)+1)*t-i)):.5*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)},easeInBounce:function(t){return 1-b.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?1*(7.5625*t*t):2/2.75>t?1*(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return.5>t?.5*b.easeInBounce(2*t):.5*b.easeOutBounce(2*t-1)+.5}}),w=s.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),P=(s.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t,1e3/60)}}(),s.animationLoop=function(t,i,e,s,n,o){var a=0,h=b[e]||b.linear,l=function(){a++;var e=a/i,r=h(e);t.call(o,r,e,a),s.call(o,r,e),i>a?o.animationFrame=w(l):n.apply(o)};w(l)},s.getRelativePosition=function(t){var i,e,s=t.originalEvent||t,n=t.currentTarget||t.srcElement,o=n.getBoundingClientRect();return s.touches?(i=s.touches[0].clientX-o.left,e=s.touches[0].clientY-o.top):(i=s.clientX-o.left,e=s.clientY-o.top),{x:i,y:e}},s.addEvent=function(t,i,e){t.addEventListener?t.addEventListener(i,e):t.attachEvent?t.attachEvent("on"+i,e):t["on"+i]=e}),L=s.removeEvent=function(t,i,e){t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent?t.detachEvent("on"+i,e):t["on"+i]=c},k=(s.bindEvents=function(t,i,e){t.events||(t.events={}),n(i,function(i){t.events[i]=function(){e.apply(t,arguments)},P(t.chart.canvas,i,t.events[i])})},s.unbindEvents=function(t,i){n(i,function(i,e){L(t.chart.canvas,e,i)})}),F=s.getMaximumWidth=function(t){var i=t.parentNode,e=parseInt(R(i,"padding-left"))+parseInt(R(i,"padding-right"));return i.clientWidth-e},A=s.getMaximumHeight=function(t){var i=t.parentNode,e=parseInt(R(i,"padding-bottom"))+parseInt(R(i,"padding-top"));return i.clientHeight-e},R=s.getStyle=function(t,i){return t.currentStyle?t.currentStyle[i]:document.defaultView.getComputedStyle(t,null).getPropertyValue(i)},T=(s.getMaximumSize=s.getMaximumWidth,s.retinaScale=function(t){var i=t.ctx,e=t.canvas.width,s=t.canvas.height;window.devicePixelRatio&&(i.canvas.style.width=e+"px",i.canvas.style.height=s+"px",i.canvas.height=s*window.devicePixelRatio,i.canvas.width=e*window.devicePixelRatio,i.scale(window.devicePixelRatio,window.devicePixelRatio))}),M=s.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},W=s.fontString=function(t,i,e){return i+" "+t+"px "+e},z=s.longestText=function(t,i,e){t.font=i;var s=0;return n(e,function(i){var e=t.measureText(i).width;s=e>s?e:s}),s},B=s.drawRoundedRectangle=function(t,i,e,s,n,o){t.beginPath(),t.moveTo(i+o,e),t.lineTo(i+s-o,e),t.quadraticCurveTo(i+s,e,i+s,e+o),t.lineTo(i+s,e+n-o),t.quadraticCurveTo(i+s,e+n,i+s-o,e+n),t.lineTo(i+o,e+n),t.quadraticCurveTo(i,e+n,i,e+n-o),t.lineTo(i,e+o),t.quadraticCurveTo(i,e,i+o,e),t.closePath()};e.instances={},e.Type=function(t,i,s){this.options=i,this.chart=s,this.id=u(),e.instances[this.id]=this,i.responsive&&this.resize(),this.initialize.call(this,t)},a(e.Type.prototype,{initialize:function(){return this},clear:function(){return M(this.chart),this},stop:function(){return e.animationService.cancelAnimation(this),this},resize:function(t){this.stop();var i=this.chart.canvas,e=F(this.chart.canvas),s=this.options.maintainAspectRatio?e/this.chart.aspectRatio:A(this.chart.canvas);return i.width=this.chart.width=e,i.height=this.chart.height=s,T(this.chart),"function"==typeof t&&t.apply(this,Array.prototype.slice.call(arguments,1)),this},reflow:c,render:function(t){if(t&&this.reflow(),this.options.animation&&!t){var i=new e.Animation;i.numSteps=this.options.animationSteps,i.easing=this.options.animationEasing,i.render=function(t,i){var e=s.easingEffects[i.easing],n=i.currentStep/i.numSteps,o=e(n);t.draw(o,n,i.currentStep)},i.onAnimationProgress=this.options.onAnimationProgress,i.onAnimationComplete=this.options.onAnimationComplete,e.animationService.addAnimation(this,i)}else this.draw(),this.options.onAnimationComplete.call(this);return this},generateLegend:function(){return C(this.options.legendTemplate,this)},destroy:function(){this.clear(),k(this,this.events);var t=this.chart.canvas;t.width=this.chart.width,t.height=this.chart.height,t.style.removeProperty?(t.style.removeProperty("width"),t.style.removeProperty("height")):(t.style.removeAttribute("width"),t.style.removeAttribute("height")),delete e.instances[this.id]},showTooltip:function(t,i){"undefined"==typeof this.activeElements&&(this.activeElements=[]);var o=function(t){var i=!1;return t.length!==this.activeElements.length?i=!0:(n(t,function(t,e){t!==this.activeElements[e]&&(i=!0)},this),i)}.call(this,t);if(o||i){if(this.activeElements=t,this.draw(),this.options.customTooltips&&this.options.customTooltips(!1),t.length>0)if(this.datasets&&this.datasets.length>1){for(var a,h,r=this.datasets.length-1;r>=0&&(a=this.datasets[r].points||this.datasets[r].bars||this.datasets[r].segments,h=l(a,t[0]),-1===h);r--);var c=[],u=[],d=function(t){var i,e,n,o,a,l=[],r=[],d=[];return s.each(this.datasets,function(t){i=t.points||t.bars||t.segments,i[h]&&i[h].hasValue()&&l.push(i[h])}),s.each(l,function(t){r.push(t.x),d.push(t.y),c.push(s.template(this.options.multiTooltipTemplate,t)),u.push({fill:t._saved.fillColor||t.fillColor,stroke:t._saved.strokeColor||t.strokeColor})},this),a=m(d),n=g(d),o=m(r),e=g(r),{x:o>this.chart.width/2?o:e,y:(a+n)/2}}.call(this,h);new e.MultiTooltip({x:d.x,y:d.y,xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,xOffset:this.options.tooltipXOffset,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,titleTextColor:this.options.tooltipTitleFontColor,titleFontFamily:this.options.tooltipTitleFontFamily,titleFontStyle:this.options.tooltipTitleFontStyle,titleFontSize:this.options.tooltipTitleFontSize,cornerRadius:this.options.tooltipCornerRadius,labels:c,legendColors:u,legendColorBackground:this.options.multiTooltipKeyBackground,title:C(this.options.tooltipTitleTemplate,t[0]),chart:this.chart,ctx:this.chart.ctx,custom:this.options.customTooltips}).draw()}else n(t,function(t){var i=t.tooltipPosition();new e.Tooltip({x:Math.round(i.x),y:Math.round(i.y),xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,caretHeight:this.options.tooltipCaretSize,cornerRadius:this.options.tooltipCornerRadius,text:C(this.options.tooltipTemplate,t),chart:this.chart,custom:this.options.customTooltips}).draw()},this);return this}},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)}}),e.Type.extend=function(t){var i=this,s=function(){return i.apply(this,arguments)};if(s.prototype=o(i.prototype),a(s.prototype,t),s.extend=e.Type.extend,t.name||i.prototype.name){var n=t.name||i.prototype.name,l=e.defaults[i.prototype.name]?o(e.defaults[i.prototype.name]):{};e.defaults[n]=a(l,t.defaults),e.types[n]=s,e.prototype[n]=function(t,i){var o=h(e.defaults.global,e.defaults[n],i||{});return new s(t,o,this)}}else d("Name not provided for this chart, so it hasn't been registered");return i},e.Element=function(t){a(this,t),this.initialize.apply(this,arguments),this.save()},a(e.Element.prototype,{initialize:function(){},restore:function(t){return t?n(t,function(t){this[t]=this._saved[t]},this):a(this,this._saved),this},save:function(){return this._saved=o(this),delete this._saved._saved,this},update:function(t){return n(t,function(t,i){this._saved[i]=this[i],this[i]=t},this),this},transition:function(t,i){return n(t,function(t,e){this[e]=(t-this._saved[e])*i+this._saved[e]},this),this},tooltipPosition:function(){return{x:this.x,y:this.y}},hasValue:function(){return f(this.value)}}),e.Element.extend=r,e.Point=e.Element.extend({display:!0,inRange:function(t,i){var e=this.hitDetectionRadius+this.radius;return Math.pow(t-this.x,2)+Math.pow(i-this.y,2)a?a>=n||n>=o:n>=o&&a>=n,l=e.distance>=this.innerRadius&&e.distance<=this.outerRadius;return h&&l},tooltipPosition:function(){var t=this.startAngle+(this.endAngle-this.startAngle)/2,i=(this.outerRadius-this.innerRadius)/2+this.innerRadius;return{x:this.x+Math.cos(t)*i,y:this.y+Math.sin(t)*i}},draw:function(t){var i=this.ctx;i.beginPath(),i.arc(this.x,this.y,this.outerRadius<0?0:this.outerRadius,this.startAngle,this.endAngle),i.arc(this.x,this.y,this.innerRadius<0?0:this.innerRadius,this.endAngle,this.startAngle,!0),i.closePath(),i.strokeStyle=this.strokeColor,i.lineWidth=this.strokeWidth,i.fillStyle=this.fillColor,i.fill(),i.lineJoin="bevel",this.showStroke&&i.stroke()}}),e.Rectangle=e.Element.extend({draw:function(){var t=this.ctx,i=this.width/2,e=this.x-i,s=this.x+i,n=this.base-(this.base-this.y),o=this.strokeWidth/2;this.showStroke&&(e+=o,s-=o,n+=o),t.beginPath(),t.fillStyle=this.fillColor,t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.moveTo(e,this.base),t.lineTo(e,n),t.lineTo(s,n),t.lineTo(s,this.base),t.fill(),this.showStroke&&t.stroke()},height:function(){return this.base-this.y},inRange:function(t,i){return t>=this.x-this.width/2&&t<=this.x+this.width/2&&i>=this.y&&i<=this.base}}),e.Animation=e.Element.extend({currentStep:null,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),e.Tooltip=e.Element.extend({draw:function(){var t=this.chart.ctx;t.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.xAlign="center",this.yAlign="above";var i=this.caretPadding=2,e=t.measureText(this.text).width+2*this.xPadding,s=this.fontSize+2*this.yPadding,n=s+this.caretHeight+i;this.x+e/2>this.chart.width?this.xAlign="left":this.x-e/2<0&&(this.xAlign="right"),this.y-n<0&&(this.yAlign="below");var o=this.x-e/2,a=this.y-n;if(t.fillStyle=this.fillColor,this.custom)this.custom(this);else{switch(this.yAlign){case"above":t.beginPath(),t.moveTo(this.x,this.y-i),t.lineTo(this.x+this.caretHeight,this.y-(i+this.caretHeight)),t.lineTo(this.x-this.caretHeight,this.y-(i+this.caretHeight)),t.closePath(),t.fill();break;case"below":a=this.y+i+this.caretHeight,t.beginPath(),t.moveTo(this.x,this.y+i),t.lineTo(this.x+this.caretHeight,this.y+i+this.caretHeight),t.lineTo(this.x-this.caretHeight,this.y+i+this.caretHeight),t.closePath(),t.fill()}switch(this.xAlign){case"left":o=this.x-e+(this.cornerRadius+this.caretHeight);break;case"right":o=this.x-(this.cornerRadius+this.caretHeight)}B(t,o,a,e,s,this.cornerRadius),t.fill(),t.fillStyle=this.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(this.text,o+e/2,a+s/2)}}}),e.MultiTooltip=e.Element.extend({initialize:function(){this.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.titleFont=W(this.titleFontSize,this.titleFontStyle,this.titleFontFamily),this.titleHeight=this.title?1.5*this.titleFontSize:0,this.height=this.labels.length*this.fontSize+(this.labels.length-1)*(this.fontSize/2)+2*this.yPadding+this.titleHeight,this.ctx.font=this.titleFont;var t=this.ctx.measureText(this.title).width,i=z(this.ctx,this.font,this.labels)+this.fontSize+3,e=g([i,t]);this.width=e+2*this.xPadding;var s=this.height/2;this.y-s<0?this.y=s:this.y+s>this.chart.height&&(this.y=this.chart.height-s),this.x>this.chart.width/2?this.x-=this.xOffset+this.width:this.x+=this.xOffset},getLineHeight:function(t){var i=this.y-this.height/2+this.yPadding,e=t-1;return 0===t?i+this.titleHeight/3:i+(1.5*this.fontSize*e+this.fontSize/2)+this.titleHeight},draw:function(){if(this.custom)this.custom(this);else{B(this.ctx,this.x,this.y-this.height/2,this.width,this.height,this.cornerRadius);var t=this.ctx;t.fillStyle=this.fillColor,t.fill(),t.closePath(),t.textAlign="left",t.textBaseline="middle",t.fillStyle=this.titleTextColor,t.font=this.titleFont,t.fillText(this.title,this.x+this.xPadding,this.getLineHeight(0)),t.font=this.font,s.each(this.labels,function(i,e){t.fillStyle=this.textColor,t.fillText(i,this.x+this.xPadding+this.fontSize+3,this.getLineHeight(e+1)),t.fillStyle=this.legendColorBackground,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize),t.fillStyle=this.legendColors[e].fill,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize)},this)}}}),e.Scale=e.Element.extend({initialize:function(){this.fit()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}));this.yLabelWidth=this.display&&this.showLabels?z(this.ctx,this.font,this.yLabels)+10:0},addXLabel:function(t){this.xLabels.push(t),this.valuesCount++,this.fit()},removeXLabel:function(){this.xLabels.shift(),this.valuesCount--,this.fit()},fit:function(){this.startPoint=this.display?this.fontSize:0,this.endPoint=this.display?this.height-1.5*this.fontSize-5:this.height,this.startPoint+=this.padding,this.endPoint-=this.padding;var t,i=this.endPoint,e=this.endPoint-this.startPoint;for(this.calculateYRange(e),this.buildYLabels(),this.calculateXLabelRotation();e>this.endPoint-this.startPoint;)e=this.endPoint-this.startPoint,t=this.yLabelWidth,this.calculateYRange(e),this.buildYLabels(),tthis.yLabelWidth?e/2:this.yLabelWidth,this.xLabelRotation=0,this.display){var n,o=z(this.ctx,this.font,this.xLabels);this.xLabelWidth=o;for(var a=Math.floor(this.calculateX(1)-this.calculateX(0))-6;this.xLabelWidth>a&&0===this.xLabelRotation||this.xLabelWidth>a&&this.xLabelRotation<=90&&this.xLabelRotation>0;)n=Math.cos(S(this.xLabelRotation)),t=n*e,i=n*s,t+this.fontSize/2>this.yLabelWidth&&(this.xScalePaddingLeft=t+this.fontSize/2),this.xScalePaddingRight=this.fontSize/2,this.xLabelRotation++,this.xLabelWidth=n*o;this.xLabelRotation>0&&(this.endPoint-=Math.sin(S(this.xLabelRotation))*o+3)}else this.xLabelWidth=0,this.xScalePaddingRight=this.padding,this.xScalePaddingLeft=this.padding},calculateYRange:c,drawingArea:function(){return this.startPoint-this.endPoint},calculateY:function(t){var i=this.drawingArea()/(this.min-this.max);return this.endPoint-i*(t-this.min)},calculateX:function(t){var i=(this.xLabelRotation>0,this.width-(this.xScalePaddingLeft+this.xScalePaddingRight)),e=i/Math.max(this.valuesCount-(this.offsetGridLines?0:1),1),s=e*t+this.xScalePaddingLeft;return this.offsetGridLines&&(s+=e/2),Math.round(s)},update:function(t){s.extend(this,t),this.fit()},draw:function(){var t=this.ctx,i=(this.endPoint-this.startPoint)/this.steps,e=Math.round(this.xScalePaddingLeft);this.display&&(t.fillStyle=this.textColor,t.font=this.font,n(this.yLabels,function(n,o){var a=this.endPoint-i*o,h=Math.round(a),l=this.showHorizontalLines;t.textAlign="right",t.textBaseline="middle",this.showLabels&&t.fillText(n,e-10,a),0!==o||l||(l=!0),l&&t.beginPath(),o>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),h+=s.aliasPixel(t.lineWidth),l&&(t.moveTo(e,h),t.lineTo(this.width,h),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(e-5,h),t.lineTo(e,h),t.stroke(),t.closePath()},this),n(this.xLabels,function(i,e){var s=this.calculateX(e)+x(this.lineWidth),n=this.calculateX(e-(this.offsetGridLines?.5:0))+x(this.lineWidth),o=this.xLabelRotation>0,a=this.showVerticalLines;0!==e||a||(a=!0),a&&t.beginPath(),e>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),a&&(t.moveTo(n,this.endPoint),t.lineTo(n,this.startPoint-3),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(n,this.endPoint),t.lineTo(n,this.endPoint+5),t.stroke(),t.closePath(),t.save(),t.translate(s,o?this.endPoint+12:this.endPoint+8),t.rotate(-1*S(this.xLabelRotation)),t.font=this.font,t.textAlign=o?"right":"center",t.textBaseline=o?"middle":"top",t.fillText(i,0,0),t.restore()},this))}}),e.RadialScale=e.Element.extend({initialize:function(){this.size=m([this.height,this.width]),this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2},calculateCenterOffset:function(t){var i=this.drawingArea/(this.max-this.min);return(t-this.min)*i},update:function(){this.lineArc?this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2:this.setScaleSize(),this.buildYLabels()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}))},getCircumference:function(){return 2*Math.PI/this.valuesCount},setScaleSize:function(){var t,i,e,s,n,o,a,h,l,r,c,u,d=m([this.height/2-this.pointLabelFontSize-5,this.width/2]),p=this.width,g=0;for(this.ctx.font=W(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),i=0;ip&&(p=t.x+s,n=i),t.x-sp&&(p=t.x+e,n=i):i>this.valuesCount/2&&t.x-e0){var s,n=e*(this.drawingArea/this.steps),o=this.yCenter-n;if(this.lineWidth>0)if(t.strokeStyle=this.lineColor,t.lineWidth=this.lineWidth,this.lineArc)t.beginPath(),t.arc(this.xCenter,this.yCenter,n,0,2*Math.PI),t.closePath(),t.stroke();else{t.beginPath();for(var a=0;a=0;i--){var e=null,s=null;if(this.angleLineWidth>0&&(e=this.calculateCenterOffset(this.max),s=this.getPointPosition(i,e),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(s.x,s.y),t.stroke(),t.closePath()),this.backgroundColors&&this.backgroundColors.length==this.valuesCount){null==e&&(e=this.calculateCenterOffset(this.max)),null==s&&(s=this.getPointPosition(i,e));var o=this.getPointPosition(0===i?this.valuesCount-1:i-1,e),a=this.getPointPosition(i===this.valuesCount-1?0:i+1,e),h={x:(o.x+s.x)/2,y:(o.y+s.y)/2},l={x:(s.x+a.x)/2,y:(s.y+a.y)/2};t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(h.x,h.y),t.lineTo(s.x,s.y),t.lineTo(l.x,l.y),t.fillStyle=this.backgroundColors[i],t.fill(),t.closePath()}var r=this.getPointPosition(i,this.calculateCenterOffset(this.max)+5);t.font=W(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),t.fillStyle=this.pointLabelFontColor;var c=this.labels.length,u=this.labels.length/2,d=u/2,p=d>i||i>c-d,f=i===d||i===c-d;0===i?t.textAlign="center":i===u?t.textAlign="center":u>i?t.textAlign="left":t.textAlign="right",f?t.textBaseline="middle":p?t.textBaseline="bottom":t.textBaseline="top",t.fillText(this.labels[i],r.x,r.y)}}}}}),e.animationService={frameDuration:17,animations:[],dropFrames:0,addAnimation:function(t,i){for(var e=0;e1&&(i=Math.floor(this.dropFrames),this.dropFrames-=i);for(var e=0;ethis.animations[e].animationObject.numSteps&&(this.animations[e].animationObject.currentStep=this.animations[e].animationObject.numSteps),this.animations[e].animationObject.render(this.animations[e].chartInstance,this.animations[e].animationObject),this.animations[e].animationObject.currentStep==this.animations[e].animationObject.numSteps&&(this.animations[e].animationObject.onAnimationComplete.call(this.animations[e].chartInstance),this.animations.splice(e,1),e--);var n=Date.now(),o=n-t-this.frameDuration,a=o/this.frameDuration;a>1&&(this.dropFrames+=a),this.animations.length>0&&s.requestAnimFrame.call(window,this.digestWrapper)}},s.addEvent(window,"resize",function(){var t;return function(){clearTimeout(t),t=setTimeout(function(){n(e.instances,function(t){t.options.responsive&&t.resize(t.render,!0)})},50)}}()),p?define(function(){return e}):"object"==typeof module&&module.exports&&(module.exports=e),t.Chart=e,e.noConflict=function(){return t.Chart=i,e}}).call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleBeginAtZero:!0,scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,legendTemplate:'<% for (var i=0; i<%if(datasets[i].label){%><%=datasets[i].label%><%}%><%}%>'};i.Type.extend({name:"Bar",defaults:s,initialize:function(t){var s=this.options;this.ScaleClass=i.Scale.extend({offsetGridLines:!0,calculateBarX:function(t,i,e){var n=this.calculateBaseWidth(),o=this.calculateX(e)-n/2,a=this.calculateBarWidth(t);return o+a*i+i*s.barDatasetSpacing+a/2},calculateBaseWidth:function(){return this.calculateX(1)-this.calculateX(0)-2*s.barValueSpacing},calculateBarWidth:function(t){var i=this.calculateBaseWidth()-(t-1)*s.barDatasetSpacing;return i/t}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){ 11 | var i="mouseout"!==t.type?this.getBarsAtEvent(t):[];this.eachBars(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),this.BarClass=i.Rectangle.extend({strokeWidth:this.options.barStrokeWidth,showStroke:this.options.barShowStroke,ctx:this.chart.ctx}),e.each(t.datasets,function(i,s){var n={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,bars:[]};this.datasets.push(n),e.each(i.data,function(e,s){n.bars.push(new this.BarClass({value:e,label:t.labels[s],datasetLabel:i.label,strokeColor:i.strokeColor,fillColor:i.fillColor,highlightFill:i.highlightFill||i.fillColor,highlightStroke:i.highlightStroke||i.strokeColor}))},this)},this),this.buildScale(t.labels),this.BarClass.prototype.base=this.scale.endPoint,this.eachBars(function(t,i,s){e.extend(t,{width:this.scale.calculateBarWidth(this.datasets.length),x:this.scale.calculateBarX(this.datasets.length,s,i),y:this.scale.endPoint}),t.save()},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachBars(function(t){t.save()}),this.render()},eachBars:function(t){e.each(this.datasets,function(i,s){e.each(i.bars,t,this,s)},this)},getBarsAtEvent:function(t){for(var i,s=[],n=e.getRelativePosition(t),o=function(t){s.push(t.bars[i])},a=0;a<% for (var i=0; i<%if(segments[i].label){%><%=segments[i].label%><%}%><%}%>'};i.Type.extend({name:"Doughnut",defaults:s,initialize:function(t){this.segments=[],this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,this.SegmentArc=i.Arc.extend({ctx:this.chart.ctx,x:this.chart.width/2,y:this.chart.height/2}),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.calculateTotal(t),e.each(t,function(i,e){i.color||(i.color="hsl("+360*e/t.length+", 100%, 50%)"),this.addData(i,e,!0)},this),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,e,s){var n=void 0!==e?e:this.segments.length;"undefined"==typeof t.color&&(t.color=i.defaults.global.segmentColorDefault[n%i.defaults.global.segmentColorDefault.length],t.highlight=i.defaults.global.segmentHighlightColorDefaults[n%i.defaults.global.segmentHighlightColorDefaults.length]),this.segments.splice(n,0,new this.SegmentArc({value:t.value,outerRadius:this.options.animateScale?0:this.outerRadius,innerRadius:this.options.animateScale?0:this.outerRadius/100*this.options.percentageInnerCutout,fillColor:t.color,highlightColor:t.highlight||t.color,showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,startAngle:1.5*Math.PI,circumference:this.options.animateRotate?0:this.calculateCircumference(t.value),label:t.label})),s||(this.reflow(),this.update())},calculateCircumference:function(t){return this.total>0?2*Math.PI*(t/this.total):0},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=Math.abs(t.value)},this)},update:function(){this.calculateTotal(this.segments),e.each(this.activeElements,function(t){t.restore(["fillColor"])}),e.each(this.segments,function(t){t.save()}),this.render()},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,e.each(this.segments,function(t){t.update({outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout})},this)},draw:function(t){var i=t?t:1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.calculateCircumference(t.value),outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout},i),t.endAngle=t.startAngle+t.circumference,t.draw(),0===e&&(t.startAngle=1.5*Math.PI),e<% for (var i=0; i<%if(datasets[i].label){%><%=datasets[i].label%><%}%><%}%>',offsetGridLines:!1};i.Type.extend({name:"Line",defaults:s,initialize:function(t){this.PointClass=i.Point.extend({offsetGridLines:this.options.offsetGridLines,strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx,inRange:function(t){return Math.pow(t-this.x,2)0&&ithis.scale.endPoint?t.controlPoints.outer.y=this.scale.endPoint:t.controlPoints.outer.ythis.scale.endPoint?t.controlPoints.inner.y=this.scale.endPoint:t.controlPoints.inner.y0&&(s.lineTo(h[h.length-1].x,this.scale.endPoint),s.lineTo(h[0].x,this.scale.endPoint),s.fillStyle=t.fillColor,s.closePath(),s.fill()),e.each(h,function(t){t.draw()})},this))}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBeginAtZero:!0,scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,scaleShowLine:!0,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<% for (var i=0; i<%if(segments[i].label){%><%=segments[i].label%><%}%><%}%>'};i.Type.extend({name:"PolarArea",defaults:s,initialize:function(t){this.segments=[],this.SegmentArc=i.Arc.extend({showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,ctx:this.chart.ctx,innerRadius:0,x:this.chart.width/2,y:this.chart.height/2}),this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,lineArc:!0,width:this.chart.width,height:this.chart.height,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,valuesCount:t.length}),this.updateScaleRange(t),this.scale.update(),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({fillColor:t.color,highlightColor:t.highlight||t.color,label:t.label,value:t.value,outerRadius:this.options.animateScale?0:this.scale.calculateCenterOffset(t.value),circumference:this.options.animateRotate?0:this.scale.getCircumference(),startAngle:1.5*Math.PI})),e||(this.reflow(),this.update())},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=t.value},this),this.scale.valuesCount=this.segments.length},updateScaleRange:function(t){var i=[];e.each(t,function(t){i.push(t.value)});var s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s,{size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2})},update:function(){this.calculateTotal(this.segments),e.each(this.segments,function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.updateScaleRange(this.segments),this.scale.update(),e.extend(this.scale,{xCenter:this.chart.width/2,yCenter:this.chart.height/2}),e.each(this.segments,function(t){t.update({outerRadius:this.scale.calculateCenterOffset(t.value)})},this)},draw:function(t){var i=t||1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.scale.getCircumference(),outerRadius:this.scale.calculateCenterOffset(t.value)},i),t.endAngle=t.startAngle+t.circumference,0===e&&(t.startAngle=1.5*Math.PI),e<% for (var i=0; i<%if(datasets[i].label){%><%=datasets[i].label%><%}%><%}%>'},initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx}),this.datasets=[],this.buildScale(t),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){var o;this.scale.animation||(o=this.scale.getPointPosition(n,this.scale.calculateCenterOffset(e))),s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,x:this.options.animation?this.scale.xCenter:o.x,y:this.options.animation?this.scale.yCenter:o.y,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this)},this),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=e.getRelativePosition(t),s=e.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},i),n=2*Math.PI/this.scale.valuesCount,o=Math.round((s.angle-1.5*Math.PI)/n),a=[];return(o>=this.scale.valuesCount||0>o)&&(o=0),s.distance<=this.scale.drawingArea&&e.each(this.datasets,function(t){a.push(t.points[o])}),a},buildScale:function(t){this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backgroundColors:this.options.scaleBackgroundColors,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:t.labels,valuesCount:t.datasets[0].data.length}),this.scale.setScaleSize(),this.updateScaleRange(t.datasets),this.scale.buildYLabels()},updateScaleRange:function(t){var i=function(){var i=[];return e.each(t,function(t){t.data?i=i.concat(t.data):e.each(t.points,function(t){i.push(t.value)})}),i}(),s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s)},addData:function(t,i){this.scale.valuesCount++,e.each(t,function(t,e){var s=this.scale.getPointPosition(this.scale.valuesCount,this.scale.calculateCenterOffset(t));this.datasets[e].points.push(new this.PointClass({value:t,label:i,datasetLabel:this.datasets[e].label,x:s.x,y:s.y,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.labels.push(i),this.reflow(),this.update()},removeData:function(){this.scale.valuesCount--,this.scale.labels.shift(),e.each(this.datasets,function(t){t.points.shift()},this),this.reflow(),this.update()},update:function(){this.eachPoints(function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2}),this.updateScaleRange(this.datasets),this.scale.setScaleSize(),this.scale.buildYLabels()},draw:function(t){var i=t||1,s=this.chart.ctx;this.clear(),this.scale.draw(),e.each(this.datasets,function(t){e.each(t.points,function(t,e){t.hasValue()&&t.transition(this.scale.getPointPosition(e,this.scale.calculateCenterOffset(t.value)),i)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(t.points,function(t,i){0===i?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)},this),s.closePath(),s.stroke(),s.fillStyle=t.fillColor,this.options.datasetFill&&s.fill(),e.each(t.points,function(t){t.hasValue()&&t.draw()})},this)}})}.call(this); -------------------------------------------------------------------------------- /cnblogs-auto-login/encrypt-data/js/jquery-1.8.3.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v1.8.3 jquery.com | jquery.org/license */ 2 | (function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;ta",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="t",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;ti.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t0)for(i=r;i=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,"",""],legend:[1,"",""],thead:[1,"",""],tr:[2,"",""],td:[3,"",""],col:[2,"",""],area:[1,"",""],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X",""]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1>$2>");try{for(;r1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1>$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]===""&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/