├── static
└── .gitkeep
├── config
├── prod.env.js
├── dev.env.js
└── index.js
├── .gitignore
├── src
├── assets
│ ├── images
│ │ ├── index.png
│ │ ├── logo.png
│ │ ├── loading.gif
│ │ └── components
│ │ │ ├── user.png
│ │ │ ├── go_icon.png
│ │ │ ├── login_icon.png
│ │ │ ├── nav_icon.png
│ │ │ └── go_next_icon.png
│ └── scss
│ │ ├── CV.scss
│ │ ├── about.scss
│ │ ├── iconfont
│ │ └── iconfont.css
│ │ ├── header.scss
│ │ ├── index.scss
│ │ ├── common
│ │ ├── reset.scss
│ │ └── common.scss
│ │ ├── detail.scss
│ │ ├── topic.scss
│ │ ├── user.scss
│ │ └── github-markdown.css
├── vuex
│ └── user.js
├── libs
│ ├── alert.js
│ ├── utils.js
│ └── llqrcode.js
├── views
│ ├── index.vue
│ ├── about.vue
│ ├── login.vue
│ ├── user.vue
│ ├── message.vue
│ ├── new.vue
│ ├── list.vue
│ └── topic.vue
├── components
│ ├── nvAlert.vue
│ ├── backtotop.vue
│ ├── user-info.vue
│ ├── loading.vue
│ ├── header.vue
│ ├── menu.vue
│ └── reply.vue
├── main.js
├── filters.js
└── routers.js
├── .eslintignore
├── .babelrc
├── .editorconfig
├── .eslintrc
├── index.html
├── README.md
└── package.json
/static/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/config/prod.env.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NODE_ENV: '"production"'
3 | }
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
3 | bower_components
4 | .idea
5 | *.swp
6 | .DS_Store
7 | .DS_Store?
8 |
--------------------------------------------------------------------------------
/src/assets/images/index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shinygang/Vue-cnodejs/HEAD/src/assets/images/index.png
--------------------------------------------------------------------------------
/src/assets/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shinygang/Vue-cnodejs/HEAD/src/assets/images/logo.png
--------------------------------------------------------------------------------
/src/assets/images/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shinygang/Vue-cnodejs/HEAD/src/assets/images/loading.gif
--------------------------------------------------------------------------------
/src/assets/images/components/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shinygang/Vue-cnodejs/HEAD/src/assets/images/components/user.png
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | server.js
2 | gulpfile.js
3 | webpack.config.js
4 | src/libs/llqrcode.js
5 | src/libs/zepto.js
6 | build/
7 | config/
8 |
--------------------------------------------------------------------------------
/src/assets/images/components/go_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shinygang/Vue-cnodejs/HEAD/src/assets/images/components/go_icon.png
--------------------------------------------------------------------------------
/src/assets/images/components/login_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shinygang/Vue-cnodejs/HEAD/src/assets/images/components/login_icon.png
--------------------------------------------------------------------------------
/src/assets/images/components/nav_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shinygang/Vue-cnodejs/HEAD/src/assets/images/components/nav_icon.png
--------------------------------------------------------------------------------
/src/assets/images/components/go_next_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shinygang/Vue-cnodejs/HEAD/src/assets/images/components/go_next_icon.png
--------------------------------------------------------------------------------
/config/dev.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var prodEnv = require('./prod.env')
3 |
4 | module.exports = merge(prodEnv, {
5 | NODE_ENV: '"development"'
6 | })
7 |
--------------------------------------------------------------------------------
/src/assets/scss/CV.scss:
--------------------------------------------------------------------------------
1 | @import 'common/reset.scss';
2 | @import 'common/common.scss';
3 | @import 'index.scss';
4 | @import 'header.scss';
5 | @import 'about.scss';
6 | @import 'topic.scss';
7 | @import 'user.scss';
8 | @import 'detail.scss';
9 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "es2015", "stage-2"
4 | ],
5 | "plugins": ["transform-runtime"],
6 | "comments": false,
7 | "env": {
8 | "test": {
9 | "presets": ["env", "stage-2"],
10 | "plugins": ["istanbul"]
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | end_of_line = lf
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
10 | [*.{vue,js,json,html,yml}]
11 | indent_style = space
12 | indent_size = 4
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/src/assets/scss/about.scss:
--------------------------------------------------------------------------------
1 | .about-info {
2 | height: 100%;
3 | padding: 50px 15px;
4 | line-height: 1.5;
5 | background: #f7f7f7;
6 |
7 | dt {
8 | @extend .title;
9 | padding: 1em 0;
10 | font-weight: bold;
11 | }
12 | dd {
13 | padding-bottom: 15px;
14 | font-size: $font-content;
15 | border-bottom: $border;
16 | }
17 |
18 | a {
19 | color: #42b983;
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "es6": true,
5 | "node": true
6 | },
7 | "root": true,
8 | "extends": "standard",
9 | "parser": "babel-eslint",
10 | "plugins": [
11 | "html",
12 | "vue"
13 | ],
14 | "rules": {
15 | "arrow-parens": 0,
16 | "indent": ["error", 4, { "SwitchCase": 1 }],
17 | "eol-last": 0,
18 | "semi": ["error", "always"],
19 | "space-before-function-paren": 0,
20 | "no-useless-escape": 0
21 | }
22 | }
--------------------------------------------------------------------------------
/src/vuex/user.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import Vuex from 'vuex';
3 | Vue.use(Vuex);
4 |
5 | const userStore = new Vuex.Store({
6 | state: {
7 | userInfo: {}
8 | },
9 | getters: {
10 | getUserInfo(state) {
11 | return state.userInfo;
12 | }
13 | },
14 | mutations: {
15 | setUserInfo(state, userInfo) {
16 | state.userInfo = userInfo;
17 | }
18 | },
19 | actions: {
20 | setUserInfo({ commit }, user) {
21 | commit('setUserInfo', user);
22 | }
23 | }
24 | });
25 |
26 | export default userStore;
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | // see http://vuejs-templates.github.io/webpack for documentation.
2 | var path = require('path')
3 |
4 | module.exports = {
5 | build: {
6 | env: require('./prod.env'),
7 | index: path.resolve(__dirname, '../dist/index.html'),
8 | assetsRoot: path.resolve(__dirname, '../dist'),
9 | assetsSubDirectory: 'public',
10 | assetsPublicPath: '/',
11 | productionSourceMap: true,
12 | productionGzip: false,
13 | productionGzipExtensions: ['js', 'css']
14 | },
15 | dev: {
16 | env: require('./dev.env'),
17 | port: 8020,
18 | proxyTable: {
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/libs/alert.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import $ from 'webpack-zepto';
3 |
4 | /**
5 | * 全局注册弱提示
6 | */
7 | export default {
8 | install() {
9 | let timer = null;
10 | Vue.prototype.$alert = (msg) => {
11 | $('#alertWeek').remove();
12 | let $alert = $('
');
13 | $('body').append($alert);
14 | $alert.html(msg);
15 | $alert.addClass('alert-show');
16 | clearTimeout(timer);
17 | timer = setTimeout(() => {
18 | $alert.remove();
19 | }, 2000);
20 | };
21 | }
22 | };
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Vue.js-Cnodejs社区
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/views/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
21 |
28 |
--------------------------------------------------------------------------------
/src/views/about.vue:
--------------------------------------------------------------------------------
1 |
2 |
28 |
29 |
--------------------------------------------------------------------------------
/src/components/nvAlert.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
--------------------------------------------------------------------------------
/src/components/backtotop.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #基于vue.js重写Cnodejs.org社区的webapp [线上访问地址](http://shinygang.coding.me/)
2 |
3 | ## 注意:当前项目代码已经升级到2.0,均采用vue-cli搭建的程序,非vue-cli的版本请看分支:not-vue-cli
4 | * master分支采用vue-cli构建的2.0版本。
5 | * ssr分支采用服务端渲染
6 | * 1.x代码请看1.x分支。
7 | * not-vue-cli则是没有采用vue-cli搭建的原始版本
8 |
9 | -------
10 | #### ` 如果对你有帮助,恳请给作者累积一个大保健的机会,欢迎扫码`
11 | 
12 |
13 | ###安装
14 |
15 | 项目地址:(`git clone`)
16 |
17 | ```shell
18 | git clone https://github.com/shinygang/Vue-cnodejs.git
19 | ```
20 |
21 | 通过`npm`安装本地服务第三方依赖模块(需要已安装[Node.js](https://nodejs.org/))
22 |
23 | ```
24 | npm install
25 | ```
26 |
27 | 启动服务(http://localhost:8020)
28 |
29 | ```
30 | npm run dev
31 | ```
32 |
33 | 发布代码
34 | ```
35 | npm run build
36 | ```
37 |
38 | ###开发
39 |
40 | ###目录结构
41 |
42 | .
43 | ├── README.md
44 | ├── build // 构建服务和webpack配置
45 | ├── config // 项目不同环境的配置
46 | ├── dist // 项目build目录
47 | ├── index.html // 项目入口文件
48 | ├── package.json // 项目配置文件
49 | ├── src // 生产目录
50 | │ ├── assets // css js 和图片资源
51 | │ ├── components // 各种组件
52 | │ ├── views // 各种页面
53 | │ ├── vuex // vuex状态管理器
54 | │ ├── filters.js // 各种过滤器
55 | │ └── main.js // Webpack 预编译入口
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/assets/scss/iconfont/iconfont.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'iconfont';
3 | src: url('//at.alicdn.com/t/font_1449145493_7316074.eot'); /* IE9*/
4 | src: url('//at.alicdn.com/t/font_1449145493_7316074.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
5 | url('//at.alicdn.com/t/font_1449145493_7316074.woff') format('woff'), /* chrome、firefox */
6 | url('//at.alicdn.com/t/font_1449145493_7316074.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
7 | url('//at.alicdn.com/t/font_1449145493_7316074.svg#iconfont') format('svg'); /* iOS 4.1- */
8 | }
9 |
10 |
11 | .iconfont {
12 | font-family:"iconfont" !important;
13 | font-size:16px;
14 | font-style:normal;
15 | -webkit-font-smoothing: antialiased;
16 | -webkit-text-stroke-width: 0.2px;
17 | -moz-osx-font-smoothing: grayscale;
18 | }
19 | .icon-tianjia:before { content: "\e60d"; margin-right: 30px; }
20 | .icon-fenxiang:before { content: "\e600"; margin-right: 30px; }
21 | .icon-shezhi:before { content: "\e601"; margin-right: 30px;}
22 | .icon-wenda:before { content: "\e602"; margin-right: 30px;}
23 | .icon-hao:before { content: "\e603"; margin-right: 30px;}
24 | .icon-quanbu:before { content: "\e604"; margin-right: 30px;}
25 | .icon-zhaopin:before { content: "\e605"; margin-right: 30px;}
26 | .icon-xiaoxi:before { content: "\e606"; margin-right: 30px;}
27 | .icon-about:before { content: "\e607"; margin-right: 30px;}
28 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import $ from 'webpack-zepto';
3 | import VueRouter from 'vue-router';
4 | import filters from './filters';
5 | import routes from './routers';
6 | import Alert from './libs/alert';
7 | import store from './vuex/user';
8 | import FastClick from 'fastclick';
9 | Vue.use(VueRouter);
10 | Vue.use(Alert);
11 |
12 | $.ajaxSettings.crossDomain = true;
13 |
14 | // 实例化Vue的filter
15 | Object.keys(filters).forEach(k => Vue.filter(k, filters[k]));
16 |
17 | // 实例化VueRouter
18 | const router = new VueRouter({
19 | mode: 'history',
20 | routes
21 | });
22 | FastClick.attach(document.body);
23 |
24 | // 处理刷新的时候vuex被清空但是用户已经登录的情况
25 | if (window.sessionStorage.user) {
26 | store.dispatch('setUserInfo', JSON.parse(window.sessionStorage.user));
27 | }
28 |
29 | // 登录中间验证,页面需要登录而没有登录的情况直接跳转登录
30 | router.beforeEach((to, from, next) => {
31 | // 处理左侧滚动不影响右边
32 | // $('html, body, #page').removeClass('scroll-hide');
33 | $('body').css('overflow', 'auto');
34 | if (to.matched.some(record => record.meta.requiresAuth)) {
35 | if (store.state.userInfo.userId) {
36 | next();
37 | } else {
38 | next({
39 | path: '/login',
40 | query: { redirect: to.fullPath }
41 | });
42 | }
43 | } else {
44 | next();
45 | }
46 | });
47 |
48 | new Vue({
49 | router,
50 | store
51 | }).$mount('#app');
52 |
--------------------------------------------------------------------------------
/src/components/user-info.vue:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
48 |
49 |
52 |
--------------------------------------------------------------------------------
/src/assets/scss/header.scss:
--------------------------------------------------------------------------------
1 | #hd {
2 | border-bottom: 1px solid #e8e8e8;
3 | &.fix-header {
4 | width: 100%;
5 | background-color: rgba(255, 255, 255, 0.95);
6 | position: fixed;
7 | top: 0;
8 | left: 0;
9 | transition: all .3s ease;
10 | box-shadow: 0 0 4px rgba(0,0,0,0.25);
11 | z-index: 6;
12 | }
13 | &.no-fix {
14 | width: 100%;
15 | background-color: #fff;
16 | overflow: hidden;
17 | }
18 | &.show {
19 | transform: translateX(200px);
20 | }
21 | }
22 | .nv-toolbar {
23 | width: 100%;
24 | height: 44px;
25 | display: flex;
26 | align-items: center;
27 |
28 |
29 | .toolbar-nav {
30 | width: 49px;
31 | height: 44px;
32 | position: absolute;
33 | background: url("../images/components/nav_icon.png") no-repeat center center;
34 | background-size: 19px 16px;
35 | margin: 0;
36 | z-index: 1;
37 | top: 0;
38 | left: 0;
39 | }
40 |
41 | &>span {
42 | display: block;
43 | text-align: center;
44 | height: 100%;
45 | line-height: 44px;
46 | font-size: 16px;
47 | width: 100%;
48 | position: relative;
49 | z-index: 0;
50 | }
51 | .num {
52 | background-color: #80bd01;
53 | color: #fff;
54 | width: 20px;
55 | height: 20px;
56 | line-height: 20px;
57 | vertical-align: middle;
58 | text-align: center;
59 | border-radius: 50%;
60 | position: absolute;
61 | right: 10px;
62 | top: 10px;
63 | z-index: 10;
64 | }
65 | .add-icon{
66 | color: #42b983;
67 | position: absolute;
68 | right: 10px;
69 | top: 10px;
70 | z-index: 10;
71 | padding: 5px 15px;
72 | border-radius: 5px;
73 | }
74 | }
75 | .scroll-hide{
76 | height: 100%;
77 | overflow: hidden;
78 | }
79 |
--------------------------------------------------------------------------------
/src/components/loading.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{showTxt}}...
5 |
6 |
7 |
8 |
14 |
60 |
--------------------------------------------------------------------------------
/src/filters.js:
--------------------------------------------------------------------------------
1 | import utils from './libs/utils';
2 |
3 | /** 格式化时间
4 | * @param {string} time 需要格式化的时间
5 | * @param {bool} friendly 是否是fromNow
6 | */
7 | exports.getLastTimeStr = (time, friendly) => {
8 | if (friendly) {
9 | return utils.MillisecondToDate(time);
10 | } else {
11 | return utils.fmtDate(new Date(time), 'yyyy-MM-dd hh:mm');
12 | }
13 | };
14 |
15 | /** 获取文字标签
16 | * @param {string} tab Tab分类
17 | * @param {bool} good 是否是精华帖
18 | * @param {bool} top 是否是置顶帖
19 | */
20 | exports.getTabStr = (tab, good, top) => {
21 | let str = '';
22 | if (top) {
23 | str = '置顶';
24 | } else if (good) {
25 | str = '精华';
26 | } else {
27 | switch (tab) {
28 | case 'share':
29 | str = '分享';
30 | break;
31 | case 'ask':
32 | str = '问答';
33 | break;
34 | case 'job':
35 | str = '招聘';
36 | break;
37 | default:
38 | str = '暂无';
39 | break;
40 | }
41 | }
42 | return str;
43 | };
44 |
45 | /** 获取标签样式
46 | * @param {string} tab Tab分类
47 | * @param {bool} good 是否是精华帖
48 | * @param {bool} top 是否是置顶帖
49 | */
50 | exports.getTabClassName = (tab, good, top) => {
51 | let className = '';
52 |
53 | if (top) {
54 | className = 'top';
55 | } else if (good) {
56 | className = 'good';
57 | } else {
58 | switch (tab) {
59 | case 'share':
60 | className = 'share';
61 | break;
62 | case 'ask':
63 | className = 'ask';
64 | break;
65 | case 'job':
66 | className = 'job';
67 | break;
68 | default:
69 | className = 'default';
70 | break;
71 | }
72 | }
73 | return className;
74 | };
--------------------------------------------------------------------------------
/src/components/header.vue:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
59 |
--------------------------------------------------------------------------------
/src/assets/scss/index.scss:
--------------------------------------------------------------------------------
1 | #brim-mask {
2 | pointer-events: none;
3 | }
4 |
5 | #page {
6 | padding-top: 44px;
7 | background-color:#fff;
8 | transition: all .3s ease;
9 | overflow-x:hidden;
10 | }
11 |
12 | .show-menu {
13 | transform: translateX($gap*40);
14 | }
15 |
16 | .page-cover {
17 | position: fixed;
18 | top: 0;
19 | right: 0;
20 | bottom: 0;
21 | left: 0;
22 | background: rgba(0, 0, 0, .4);
23 | z-index: 7;
24 | }
25 |
26 |
27 | /*模块入口样式*/
28 |
29 | .posts-list {
30 | background-color: $white;
31 | li {
32 | padding: 10px $padding;
33 | border-bottom: $border;
34 | }
35 | h3 {
36 | @extend .title;
37 | &:before {
38 | content: attr(title);
39 | margin-right: 10px;
40 | margin-top: -3px;
41 | @extend .tag;
42 | color: $white;
43 | }
44 | &.top:before {
45 | background: #E74C3C;
46 | }
47 | &.ask:before {
48 | background: #3498DB;
49 | }
50 | &.good:before {
51 | background: #E67E22;
52 | }
53 | &.job:before {
54 | background: #9B59B6;
55 | }
56 | &.share:before {
57 | background: #1ABC9C;
58 | }
59 | }
60 | .content {
61 | padding-top: 10px;
62 | display: flex;
63 | }
64 | .avatar {
65 | @extend .user-avatar;
66 | }
67 | .info {
68 | display: block;
69 | width: 100%;
70 | flex: 1;
71 | }
72 | p {
73 | padding: 3px 0;
74 | display: flex;
75 | color: $text;
76 | font-size: $font-info;
77 |
78 | &:first-child {
79 | font-size: $font-content;
80 | }
81 | .name, time:first-child {
82 | display: block;
83 | width: 100%;
84 | flex: 1;
85 | }
86 | b {
87 | color: #42b983;
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/assets/scss/common/reset.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * Global Reset of all HTML Elements
3 | *
4 | * Resetting all of our HTML Elements ensures a smoother
5 | * visual transition between browsers. If you don't believe me,
6 | * try temporarily commenting out this block of code, then go
7 | * and look at Mozilla versus Safari, both good browsers with
8 | * a good implementation of CSS. The thing is, all browser CSS
9 | * defaults are different and at the end of the day if visual
10 | * consistency is what we're shooting for, then we need to
11 | * make sure we're resetting all spacing elements.
12 | *
13 | */
14 | html, body {
15 | height: 100%;
16 | border: 0;
17 | font-family: "Helvetica-Neue", "Helvetica", Arial, sans-serif;
18 | line-height: 1.5;
19 | margin: 0;
20 | padding: 0;
21 | }
22 |
23 | div, span, object, iframe, img, table, caption, thead, tbody,
24 | tfoot, tr, tr, td, article, aside, canvas, details, figure, hgroup, menu,
25 | nav, footer, header, section, summary, mark, audio, video {
26 | border: 0;
27 | margin: 0;
28 | padding: 0;
29 | }
30 |
31 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, address, cit, code,
32 | del, dfn, em, ins, q, samp, small, strong, sub, sup, b, i, hr, dl, dt, dd,
33 | ol, ul, li, fieldset, legend, label {
34 | border: 0;
35 | font-size: 100%;
36 | vertical-align: baseline;
37 | margin: 0;
38 | padding: 0;
39 | }
40 |
41 | article, aside, canvas, figure, figure img, figcaption, hgroup,
42 | footer, header, nav, section, audio, video {
43 | display: block;
44 | }
45 |
46 | table {
47 | border-collapse: separate;
48 | border-spacing: 0;
49 | caption, th, td {
50 | text-align: left;
51 | vertical-align: middle;
52 | }
53 | }
54 | li{
55 | list-style: none;
56 | }
57 | a{
58 | text-decoration: none;
59 | }
60 | a img {
61 | border: 0;
62 | }
63 |
64 | :focus {
65 | outline: 0;
66 | }
67 | *{
68 | box-sizing: border-box;
69 | }
70 | textarea{
71 | resize: none;
72 | appearance: none;
73 | }
74 | input{
75 | appearance: none;
76 | }
77 | select {
78 | appearance: none;
79 | background-color: #fff;
80 | }
81 |
--------------------------------------------------------------------------------
/src/routers.js:
--------------------------------------------------------------------------------
1 | // require.ensure 是 Webpack 的特殊语法,用来设置 code-split point
2 | const Home = resolve => {
3 | require.ensure(['./views/index.vue'], () => {
4 | resolve(require('./views/index.vue'));
5 | });
6 | };
7 |
8 | const List = resolve => {
9 | require.ensure(['./views/list.vue'], () => {
10 | resolve(require('./views/list.vue'));
11 | });
12 | };
13 |
14 | const routers = [{
15 | path: '/',
16 | name: 'home',
17 | component: Home
18 | }, {
19 | path: '/cnodevue',
20 | name: 'cnodevue',
21 | component: Home
22 | }, {
23 | path: '/list',
24 | name: 'list',
25 | component: List
26 | }, {
27 | path: '/topic/:id',
28 | name: 'topic',
29 | component(resolve) {
30 | require.ensure(['./views/topic.vue'], () => {
31 | resolve(require('./views/topic.vue'));
32 | });
33 | }
34 | }, {
35 | path: '/add',
36 | name: 'add',
37 | component(resolve) {
38 | require.ensure(['./views/new.vue'], () => {
39 | resolve(require('./views/new.vue'));
40 | });
41 | },
42 | meta: { requiresAuth: true }
43 | }, {
44 | path: '/message',
45 | name: 'message',
46 | component(resolve) {
47 | require.ensure(['./views/message.vue'], () => {
48 | resolve(require('./views/message.vue'));
49 | });
50 | },
51 | meta: { requiresAuth: true }
52 | }, {
53 | path: '/user/:loginname',
54 | name: 'user',
55 | component(resolve) {
56 | require.ensure(['./views/user.vue'], () => {
57 | resolve(require('./views/user.vue'));
58 | });
59 | }
60 | }, {
61 | path: '/about',
62 | name: 'about',
63 | component(resolve) {
64 | require.ensure(['./views/about.vue'], () => {
65 | resolve(require('./views/about.vue'));
66 | });
67 | }
68 | }, {
69 | path: '/login',
70 | name: 'login',
71 | component(resolve) {
72 | require.ensure(['./views/login.vue'], () => {
73 | resolve(require('./views/login.vue'));
74 | });
75 | }
76 | }, {
77 | path: '*',
78 | component: Home
79 | }];
80 |
81 | export default routers;
--------------------------------------------------------------------------------
/src/components/menu.vue:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
24 |
25 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-cnode",
3 | "version": "2.0.0",
4 | "description": "用Vue.js 重写Cnodejs社区",
5 | "author": "唐岗 <429517385@qq.com>",
6 | "private": true,
7 | "scripts": {
8 | "dev": "node build/dev-server.js",
9 | "build": "node build/build.js",
10 | "lint": "eslint --ext .js,.vue src"
11 | },
12 | "keywords": [
13 | "cnode",
14 | "WebApp",
15 | "Vue",
16 | "Webpack",
17 | "vue.js"
18 | ],
19 | "dependencies": {
20 | "timeago.js": "^2.0.3",
21 | "vue": "^2.2.6",
22 | "vue-router": "^2.3.0",
23 | "vuex": "^2.2.1"
24 | },
25 | "devDependencies": {
26 | "autoprefixer": "^6.7.2",
27 | "babel-core": "^6.22.1",
28 | "babel-eslint": "^7.1.1",
29 | "babel-loader": "^6.2.10",
30 | "babel-plugin-transform-runtime": "^6.22.0",
31 | "babel-preset-env": "^1.2.1",
32 | "babel-preset-es2015": "^6.24.0",
33 | "babel-preset-stage-2": "^6.22.0",
34 | "babel-register": "^6.22.0",
35 | "chalk": "^1.1.3",
36 | "connect-history-api-fallback": "^1.1.0",
37 | "css-loader": "^0.27.3",
38 | "eslint": "^3.9.1",
39 | "eslint-config-standard": "^6.1.0",
40 | "eslint-friendly-formatter": "^2.0.5",
41 | "eslint-loader": "^1.5.0",
42 | "eslint-plugin-html": "^1.6.0",
43 | "eslint-plugin-promise": "^3.3.0",
44 | "eslint-plugin-standard": "^2.0.1",
45 | "eslint-plugin-vue": "^1.0.0",
46 | "eventsource-polyfill": "^0.9.6",
47 | "express": "^4.13.3",
48 | "extract-text-webpack-plugin": "^2.1.0",
49 | "fastclick": "^1.0.6",
50 | "file-loader": "^0.9.0",
51 | "friendly-errors-webpack-plugin": "^1.1.3",
52 | "function-bind": "^1.1.0",
53 | "html-webpack-plugin": "^2.28.0",
54 | "http-proxy-middleware": "^0.17.3",
55 | "json-loader": "^0.5.4",
56 | "lodash": "^4.16.6",
57 | "markdown": "^0.5.0",
58 | "node-sass": "^4.5.3",
59 | "opn": "^4.0.2",
60 | "optimize-css-assets-webpack-plugin": "^1.3.0",
61 | "ora": "^0.3.0",
62 | "path": "^0.12.7",
63 | "postcss-loader": "^1.1.1",
64 | "sass-loader": "^6.0.6",
65 | "semver": "^5.3.0",
66 | "shelljs": "^0.7.4",
67 | "style-loader": "^0.14.1",
68 | "url-loader": "^0.5.7",
69 | "vue-loader": "^11.1.4",
70 | "vue-style-loader": "^2.0.0",
71 | "vue-template-compiler": "^2.2.4",
72 | "webpack": "^2.2.1",
73 | "webpack-bundle-analyzer": "^2.2.1",
74 | "webpack-dev-middleware": "^1.10.0",
75 | "webpack-hot-middleware": "^2.16.1",
76 | "webpack-merge": "^2.6.1",
77 | "webpack-zepto": "0.0.1"
78 | },
79 | "engines": {
80 | "node": ">= 4.0.0",
81 | "npm": ">= 3.0.0"
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/assets/scss/detail.scss:
--------------------------------------------------------------------------------
1 | .page {
2 | background-color: $colorfff;
3 | height: 100%;
4 | padding: $gap*3 0;
5 |
6 | .reply_num {
7 | margin-top: $gap*4;
8 | background-color: $colore7;
9 | padding: $gap*2 0 $gap*2 $gap*2;
10 | border-top: solid 1px $colord4;
11 | border-bottom: solid 1px $colord4;
12 | }
13 | .reply-list {
14 | width: 100%;
15 | margin-top: $gap*3;
16 | ul {
17 | width: 100%;
18 | list-style: none;
19 | padding-left: 0;
20 | li {
21 | width: 100%;
22 | list-style: none;
23 | border-bottom: solid 1px $colord4;
24 | &:last-child {
25 | border-bottom: none;
26 | }
27 | .uped {
28 | color: $color80;
29 | }
30 | .icon {
31 | font-size: 26px;
32 | }
33 | }
34 | }
35 | }
36 | .topic_content {
37 | margin: 0 $gap*2;
38 | }
39 | .reply {
40 | width: 100%;
41 | margin-top: $gap*3;
42 | border-top: solid 1px $colord4;
43 | .text {
44 | margin: $gap*3 2%;
45 | width: 96%;
46 | border-color: $colord4;
47 | color: #000;
48 | }
49 | .btn {
50 | display: inline-block;
51 | border-radius: $gap;
52 | text-align: center;
53 | font-size: 16px;
54 | margin: 0 2% $gap*3;
55 | width: 96%;
56 | background-color: $color80;
57 | padding: $gap*2 0;
58 | color: $colorfff;
59 | }
60 | .err {
61 | border-color: red;
62 | }
63 | }
64 | .message {
65 | border-bottom: solid 1px $colord4;
66 | padding: $gap*2 0;
67 | }
68 | .tabs {
69 | width: 100%;
70 | height: $gap*8.2;
71 | margin-top: $gap*6;
72 | list-style: none;
73 | border-bottom: solid 1px $colord4;
74 | position: relative;
75 | .item {
76 | width: 50%;
77 | padding: $gap*2.5 0;
78 | float: left;
79 | font-size: 16;
80 | text-align: center;
81 | font-weight: bold;
82 |
83 | }
84 | .read {
85 | font-size:$gap*5;
86 | color: $color80;
87 | position:absolute;
88 | right:$gap*1;
89 | top:$gap*1.5;
90 | font-weight:bold;
91 | }
92 | .br {
93 | border-right: solid 1px $colord4;
94 | }
95 | .selected {
96 | color: $red;
97 | border-bottom: solid 2px $red;
98 | }
99 | }
100 | .icon-empty {
101 | font-size: $gap*25;
102 | display: block;
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/src/assets/scss/topic.scss:
--------------------------------------------------------------------------------
1 | .topic-title {
2 | padding: $gap;
3 | margin:$padding;
4 | font-size: 18px;
5 | color: $title;
6 | line-height: 1.5;
7 | background-color:$colorf0;
8 | border-radius:$gap;
9 | }
10 |
11 | .author-info {
12 | display: flex;
13 | align-items: center;
14 | padding: 0 $padding;
15 | color: $text;
16 | font-size: 12px;
17 | .col {
18 | display: block;
19 | width: 100%;
20 | flex: 1;
21 | }
22 | .avatar {
23 | display: block;
24 | width: 40px;
25 | height: 40px;
26 | margin-right: $padding;
27 | border-radius: 50%;
28 | }
29 | .right{
30 | text-align: right;
31 | }
32 | span, time {
33 | display: block;
34 | padding: 5px 0;
35 | }
36 | .tag {
37 | @extend .tag;
38 | color: #ffffff;
39 | &.top {
40 | background: #E74C3C;
41 | }
42 | &.ask {
43 | background: #3498DB;
44 | }
45 | &.good {
46 | background: #E67E22;
47 | }
48 | &.job {
49 | background: #9B59B6;
50 | }
51 | &.share {
52 | background: #1ABC9C;
53 | }
54 | }
55 | }
56 | .topic-content {
57 | padding: $padding;
58 | margin-top: $padding;
59 | background: #ffffff;
60 | border-bottom: solid 1px $colord4;
61 | .from{
62 | color:$red;
63 | }
64 | }
65 | .topic-reply {
66 | @extend .title;
67 | padding: $padding;
68 | border-bottom: solid 1px $colord4;
69 | strong {
70 | color: #42b983;
71 | }
72 | }
73 | .reply_num {
74 | margin-top: $gap*4;
75 | background-color: $colore7;
76 | padding: $gap*2 0 $gap*2 $gap*2;
77 | border-top: solid 1px $colord4;
78 | border-bottom: solid 1px $colord4;
79 | }
80 | .reply-list {
81 | width: 100%;
82 | margin-top: $gap*3;
83 | ul {
84 | width: 100%;
85 | list-style: none;
86 | padding-left: 0;
87 | li {
88 | width: 100%;
89 | list-style: none;
90 | border-bottom: solid 1px $colord4;
91 | &:last-child {
92 | border-bottom: none;
93 | }
94 | .uped {
95 | color: $color80;
96 | }
97 | .icon {
98 | font-size: 26px;
99 | }
100 | .from{
101 | color:$red;
102 | }
103 | .language-javascript{
104 | background-color:$colorf0;
105 | overflow-x:auto;
106 | }
107 | }
108 | }
109 | }
110 |
111 | /* 回复框样式 */
112 |
113 | .reply {
114 | margin: 0 $padding;
115 | textarea {
116 | display: block;
117 | width: 100%;
118 | flex: 1;
119 | border: $border;
120 | background-color: #fff;
121 | font-size: 14px;
122 | padding: $padding;
123 | color: #313131;
124 | }
125 | .button {
126 | display: inline-block;
127 | width: 100%;
128 | height: 42px;
129 | margin: $padding 0;
130 | line-height: 42px;
131 | color: #fff;
132 | font-size: 16px;
133 | background-color: #4fc08d;
134 | border: none;
135 | border-bottom: 2px solid #3aa373;
136 | text-align: center;
137 | vertical-align: middle;
138 | }
139 | }
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/src/components/reply.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
92 |
--------------------------------------------------------------------------------
/src/views/login.vue:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
65 |
112 |
--------------------------------------------------------------------------------
/src/views/user.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ![]()
6 |
7 |
8 |
9 | 积分:{{user.score}}
10 |
11 |
12 |
13 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | {{item.title}}
24 |
25 | {{item.author.loginname}}
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | 暂无数据!
36 |
37 |
38 |
39 |
40 |
99 |
--------------------------------------------------------------------------------
/src/assets/scss/user.scss:
--------------------------------------------------------------------------------
1 | /*侧边栏用户信息区域*/
2 | .user-info {
3 | padding: 15px;
4 | font-size: 15px;
5 | color: #313131;
6 | }
7 |
8 | /*未登录*/
9 | .login-no {
10 | overflow: hidden;
11 | margin: 8px 9px;
12 | &>li {
13 | float: right;
14 | height: 24px;
15 | line-height: 24px;
16 | padding-left: 34px;
17 | position: relative;
18 | &:before {
19 | width: 24px;
20 | height: 24px;
21 | content: '';
22 | position: absolute;
23 | left: 0;
24 | top: 0;
25 | }
26 | }
27 | .login {
28 | float: left;
29 | &:before {
30 | background: url("../images/components/login_icon.png") no-repeat left center;
31 | background-size: 24px 24px;
32 | }
33 | }
34 | }
35 |
36 | /*已登录*/
37 | .login-yes {
38 | height: 100%;
39 | background: url("../images/components/go_next_icon.png") no-repeat right center;
40 | background-size: 6px 10px;
41 | overflow: hidden;
42 | position: relative;
43 | .avertar {
44 | width: 40px;
45 | height: 40px;
46 | background: url("../images/components/user.png") no-repeat center center;
47 | background-size: 40px 40px;
48 | border-radius: 20px;
49 | overflow: hidden;
50 | float: left;
51 | &>img {
52 | width: 40px;
53 | height: 40px;
54 | display: block;
55 | }
56 | }
57 | .info {
58 | margin-left: 10px;
59 | overflow: hidden;
60 | float: left;
61 | }
62 | p {
63 | width: 85px;
64 | overflow: hidden;
65 | white-space: nowrap;
66 | text-overflow: ellipsis;
67 | font-size: 12px;
68 | line-height: 12px;
69 | line-height: 40px;
70 | &.lh20 {
71 | line-height: 20px;
72 | }
73 | }
74 | &:after {
75 | display: block;
76 | background: url("../images/components/go_icon.png") no-repeat center right;
77 | background-size: 7px 7px;
78 | }
79 | }
80 |
81 | .userinfo {
82 | margin-top:$gap*9;
83 | width: 100%;
84 | background-color: $colore7;
85 | text-align: center;
86 | height: 180px;
87 | .u-img {
88 | width: 100px;
89 | height: 100px;
90 | border-radius: 50%;
91 | margin-top: $gap*3;
92 | display: inline-block;
93 | }
94 | .u-name {
95 | color: #000;
96 | }
97 | .u-bottom {
98 | background-color: $colore7;
99 | width: 100%;
100 | margin-top: 20px;
101 | .u-time {
102 | width: 50%;
103 | float: left;
104 | padding-left: $gap*2;
105 | }
106 | .u-score {
107 | width: 50%;
108 | float: left;
109 | text-align: right;
110 | padding-right: $gap*2;
111 | color: $color80;
112 | }
113 | }
114 | }
115 |
116 | .message {
117 | background-color:#fff;
118 | padding: $gap;
119 | border-bottom: solid 1px $colord4;
120 | }
121 |
122 | .user-tabs {
123 | width: 100%;
124 | height: $gap*8.2;
125 | list-style: none;
126 | border-bottom: solid 1px $colord4;
127 | position: relative;
128 | .item {
129 | width: 50%;
130 | padding: $gap*2.5 0;
131 | float: left;
132 | font-size: 16;
133 | text-align: center;
134 | font-weight: bold;
135 | }
136 | .read {
137 | font-size: $gap*5;
138 | color: $color80;
139 | position: absolute;
140 | right: $gap*1;
141 | top: $gap*1.5;
142 | font-weight: bold;
143 | }
144 | .br {
145 | border-right: solid 1px $colord4;
146 | }
147 | .selected {
148 | color: $red;
149 | border-bottom: solid 2px $red;
150 | }
151 | }
152 |
153 | .icon-empty {
154 | font-size: $gap*25;
155 | color:$colord4;
156 | display: block;
157 | }
158 |
--------------------------------------------------------------------------------
/src/views/message.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 | - 已读消息
11 | -
12 | 未读消息
13 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | {{item.author.loginname}}
23 | 在回复中@了您
24 | 回复了您的话题
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | 话题:{{item.topic.title}}
35 |
36 |
37 |
38 |
39 |
40 | 暂无数据!
41 |
42 |
43 |
44 |
45 |
112 |
--------------------------------------------------------------------------------
/src/views/new.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
选择分类:
8 |
13 |
发布
14 |
15 |
16 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
97 |
98 |
--------------------------------------------------------------------------------
/src/assets/scss/common/common.scss:
--------------------------------------------------------------------------------
1 | $color31:#313131;
2 | $colorf0:#f0f0f0;
3 | $colorfff:#fff;
4 | $colore7:#e7e7e7;
5 | $colorfa:#fafafa;
6 | $color62:#626262;
7 | $colord4:#d4d4d4;
8 | $colora0:#a0a0a0;
9 | $red:#ff5a5f;
10 | $yellow:#feb501;
11 | $color80:#80bd01;
12 | $gap:5px;
13 |
14 | body {
15 | height: 100%;
16 | width: 100%;
17 | font-size: 14px;
18 | color: #313131;
19 | overflow-x: hidden;
20 | line-height: 1;
21 | background: url('../images/loading.gif') no-repeat center 250px;
22 | }
23 |
24 | .mt5 {
25 | margin-top: $gap;
26 | }
27 |
28 | .mt10 {
29 | margin-top: $gap*2;
30 | }
31 |
32 | .color80 {
33 | color: #42b983;
34 | }
35 |
36 | .clear {
37 | zoom: 1;
38 | &:after {
39 | content: '';
40 | display: table;
41 | clear: both;
42 | }
43 | }
44 |
45 | #app {
46 | height: 100%;
47 | }
48 |
49 | .display-flex {
50 | display: -moz-box;
51 | /* Firefox */
52 | display: -ms-flexbox;
53 | /* IE10 */
54 | display: -webkit-box;
55 | /* Safari */
56 | display: -webkit-flex;
57 | /* Chrome, WebKit */
58 | display: flexbox;
59 | display: flex;
60 | }
61 |
62 | .break {
63 | overflow: hidden;
64 | text-overflow: ellipsis;
65 | white-space: nowrap;
66 | }
67 |
68 | .user {
69 | width: 100%;
70 | margin: $gap*2 0;
71 | padding: 0 $gap*2;
72 | display: flex;
73 | .tab {
74 | display: inline-block;
75 | width: $gap*8;
76 | color: $color62;
77 | border-radius: $gap;
78 | background-color: $colore7;
79 | margin-right: $gap*2;
80 | text-align: center;
81 | height: $gap*4;
82 | line-height: $gap*4;
83 | vertical-align: middle;
84 | }
85 | .good {
86 | background-color: $color80;
87 | color: $colorfff;
88 | }
89 | .title {
90 | font-size: $gap*3.6;
91 | font-weight: bold;
92 | display: block;
93 | width: 100%;
94 | flex: 1;
95 | @extend .break;
96 | }
97 | .head {
98 | display: inline-block;
99 | width: $gap*9;
100 | height: $gap*9;
101 | margin-right: $gap*2;
102 | border-radius: 10px;
103 | img {
104 | width: $gap*9;
105 | border: 2px solid #fff6e6;
106 | border-radius: 50%;
107 | }
108 | }
109 | .info {
110 | overflow: hidden;
111 | display: block;
112 | width: 100%;
113 | flex: 1;
114 | &:after {
115 | clear: both;
116 | }
117 | .t-title {
118 | font-size: $gap*3.6;
119 | font-weight: bold;
120 | width: 100%;
121 | color: #333;
122 | @extend .break;
123 | }
124 | .mt12 {
125 | margin-top: 12px;
126 | }
127 | .cl {
128 | display: inline-block;
129 | width: 68%;
130 | .name {
131 | color: $color62;
132 | }
133 | .mt10 {
134 | margin-top: $gap*2;
135 | }
136 | }
137 | .cr {
138 | width: 30%;
139 | display: inline-block;
140 | text-align: right;
141 | .name {
142 | margin-top: $gap*2;
143 | color: $color80;
144 | font-size: $gap*2.4;
145 | }
146 | }
147 | }
148 | }
149 |
150 | .reply_content {
151 | padding: 0 $gap*3;
152 | margin-bottom: $gap*3;
153 | img {
154 | width: auto\9;
155 | height: auto;
156 | max-width: 100%;
157 | vertical-align: middle;
158 | border: 0;
159 | -ms-interpolation-mode: bicubic;
160 | }
161 | p {
162 | line-height: 1.3;
163 | }
164 | }
165 |
166 | .no-data {
167 | width: 100%;
168 | height: 100%;
169 | padding: 40% 0;
170 | color: $colord4;
171 | display: inline-block;
172 | font-size: 18px;
173 | text-align: center;
174 | }
175 |
176 |
177 | /*
178 | ** rework 分界线
179 | ** ------------
180 | */
181 |
182 |
183 | /* 颜色 */
184 |
185 | $white: #ffffff;
186 | $light: #d5dbdb;
187 | $title: #2c3e50;
188 | $text: #34495e;
189 |
190 | /* 基础布局 */
191 |
192 | $padding: 15px;
193 | $border: 1px solid $light;
194 | $radius: 4px;
195 | $font-title: 16px;
196 | $font-content: 14px;
197 | $font-info: 12px;
198 | $font-tag: 10px;
199 |
200 | /* 综合布局 */
201 |
202 | .text-overflow {
203 | white-space: nowrap;
204 | text-overflow: ellipsis;
205 | overflow: hidden;
206 | }
207 |
208 | .title {
209 | color: $title;
210 | font-size: $font-title;
211 | line-height: 1.5;
212 | @extend .text-overflow;
213 | }
214 |
215 | .tag {
216 | padding: 5px 6px;
217 | font-size: $font-tag;
218 | font-weight: 400;
219 | border-radius: $radius;
220 | background-color: $colore7;
221 | text-align: center;
222 | vertical-align: middle;
223 | }
224 |
225 | .user-avatar {
226 | display: block;
227 | width: 40px;
228 | height: 40px;
229 | border-radius: 50%;
230 | margin-right: 10px;
231 | border: 1px solid #F3F3F3;
232 | }
233 |
234 | .week-alert {
235 | position: fixed;
236 | top: 0;
237 | left: 0;
238 | right: 0;
239 | text-align: center;
240 | background-color: rgba(75, 75, 75, 0.85);
241 | color: #fff;
242 | padding: 9px 20px;
243 | font-size: 15px;
244 | z-index: 999;
245 | &.alert-show {
246 | animation: show 2s;
247 | }
248 | @keyframes show {
249 | 0% {
250 | transform: translateY(-100%);
251 | }
252 | 20% {
253 | transform: translateY(0);
254 | }
255 | 50% {
256 | transform: translateY(0);
257 | }
258 | 80% {
259 | transform: translateY(0);
260 | }
261 | 100% {
262 | transform: translateY(-100%);
263 | }
264 | }
265 | }
266 |
--------------------------------------------------------------------------------
/src/libs/utils.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import _ from 'lodash';
4 | import Timeago from 'timeago.js';
5 |
6 | let getCheck = {
7 | checkEmail(val) {
8 | var filter = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
9 | if (filter.test(val)) {
10 | return true;
11 | } else {
12 | return false;
13 | }
14 | },
15 | checkPhone(val) {
16 | var filter = /^1\d{10}$/;
17 |
18 | if (filter.test(val)) {
19 | return true;
20 | } else {
21 | return false;
22 | }
23 | }
24 | };
25 |
26 | /**
27 | * 从文本中提取出@username 标记的用户名数组
28 | * @param {String} text 文本内容
29 | * @return {Array} 用户名数组
30 | */
31 | const fetchUsers = (text) => {
32 | if (!text) {
33 | return [];
34 | }
35 |
36 | var ignoreRegexs = [
37 | /```.+?```/g, // 去除单行的 ```
38 | /^```[\s\S]+?^```/gm, // ``` 里面的是 pre 标签内容
39 | /`[\s\S]+?`/g, // 同一行中,`some code` 中内容也不该被解析
40 | /^.*/gm, // 4个空格也是 pre 标签,在这里 . 不会匹配换行
41 | /\b\S*?@[^\s]*?\..+?\b/g, // somebody@gmail.com 会被去除
42 | /\[@.+?\\]\(\/.+?\)/g // 已经被 link 的 username
43 | ];
44 |
45 | ignoreRegexs.forEach((ignoreRegex) => {
46 | text = text.replace(ignoreRegex, '');
47 | });
48 |
49 | var results = text.match(/@[a-z0-9\-_]+\b/igm);
50 | var names = [];
51 | if (results) {
52 | for (var i = 0, l = results.length; i < l; i++) {
53 | var s = results[i];
54 | // remove leading char @
55 | s = s.slice(1);
56 | names.push(s);
57 | }
58 | }
59 | names = _.uniq(names);
60 | return names;
61 | };
62 |
63 | /**
64 | * 根据文本内容,替换为数据库中的数据
65 | * @param {String} text 文本内容
66 | * @param {Function} callback 回调函数
67 | */
68 | const linkUsers = (text) => {
69 | var users = fetchUsers(text);
70 | for (var i = 0, l = users.length; i < l; i++) {
71 | var name = users[i];
72 | text = text.replace(new RegExp('@' + name + '\\b(?!\\])', 'g'), '[@' + name + '](/user/' + name + ')');
73 | }
74 | return text;
75 | };
76 |
77 | /**
78 | * 对Date的扩展,将 Date 转化为指定格式的String
79 | * 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
80 | * 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
81 | * 例子:
82 | * (new Date()).Format('yyyy-MM-dd hh:mm:ss.S') ==> 2006-07-02 08:09:04.423
83 | * (new Date()).Format('yyyy-M-d h:m:s.S') ==> 2006-7-2 8:9:4.18
84 | */
85 | const fmtDate = (date, fmt) => { // author: meizz
86 | var o = {
87 | 'M+': date.getMonth() + 1, // 月份
88 | 'd+': date.getDate(), // 日
89 | 'h+': date.getHours(), // 小时
90 | 'm+': date.getMinutes(), // 分
91 | 's+': date.getSeconds(), // 秒
92 | 'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
93 | 'S': date.getMilliseconds() // 毫秒
94 | };
95 | if (/(y+)/.test(fmt)) {
96 | fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
97 | }
98 | for (var k in o) {
99 | if (new RegExp('(' + k + ')').test(fmt)) {
100 | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)));
101 | }
102 | }
103 | return fmt;
104 | };
105 |
106 | /**
107 | * 调用Timeago库显示到现在的时间
108 | */
109 | const MillisecondToDate = (time) => {
110 | var str = '';
111 | if (time !== null && time !== '') {
112 | let timeagoInstance = new Timeago();
113 | str = timeagoInstance.format(time, 'zh_CN');
114 | }
115 | return str;
116 | };
117 |
118 | /**
119 | * 格式化日期或时间
120 | * @param {string} time 需要格式化的时间
121 | * @param {bool} friendly 是否是fromNow
122 | */
123 | exports.getLastTimeStr = (time, friendly) => {
124 | if (friendly) {
125 | return MillisecondToDate(time);
126 | } else {
127 | return fmtDate(new Date(time), 'yyyy-MM-dd hh:mm');
128 | }
129 | };
130 |
131 | /**
132 | * 获取不同tab的信息
133 | * @param {[type]} tab [tab分类]
134 | * @param {[type]} good [是否是精华]
135 | * @param {[type]} top [是否置顶]
136 | * @param {Boolean} isClass [是否是样式]
137 | * @return {[type]} [返回对应字符串]
138 | */
139 | exports.getTabInfo = (tab, good, top, isClass) => {
140 | let str = '';
141 | let className = '';
142 | if (top) {
143 | str = '置顶';
144 | className = 'top';
145 | } else if (good) {
146 | str = '精华';
147 | className = 'good';
148 | } else {
149 | switch (tab) {
150 | case 'share':
151 | str = '分享';
152 | className = 'share';
153 | break;
154 | case 'ask':
155 | str = '问答';
156 | className = 'ask';
157 | break;
158 | case 'job':
159 | str = '招聘';
160 | className = 'job';
161 | break;
162 | default:
163 | str = '暂无';
164 | className = 'default';
165 | break;
166 | }
167 | }
168 | return isClass ? className : str;
169 | };
170 |
171 | /**
172 | * 配置节流函数
173 | * @param {[Function]} fn [要执行的函数]
174 | * @param {[Number]} delay [延迟执行的毫秒数]
175 | * @param {[Number]} mustRun [至少多久执行一次]
176 | * @return {[Function]} [节流函数]
177 | */
178 | exports.throttle = (fn, wait, mustRun) => {
179 | let timeout;
180 | let startTime = new Date();
181 | return function() {
182 | let context = this;
183 | let args = arguments;
184 | let curTime = new Date();
185 |
186 | clearTimeout(timeout);
187 | // 如果达到了规定的触发时间间隔,触发 handler
188 | if (curTime - startTime >= mustRun) {
189 | fn.apply(context, args);
190 | startTime = curTime;
191 | // 没达到触发间隔,重新设定定时器
192 | } else {
193 | timeout = setTimeout(fn, wait);
194 | }
195 | };
196 | };
197 |
198 | exports.linkUsers = linkUsers;
199 | exports.fetchUsers = fetchUsers;
200 | exports.getCheck = getCheck;
201 | exports.fmtDate = fmtDate;
202 | exports.MillisecondToDate = MillisecondToDate;
--------------------------------------------------------------------------------
/src/views/list.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
18 |
19 |
20 |
![]()
21 |
22 |
23 |
24 | {{item.author.loginname}}
25 |
26 |
27 | {{item.reply_count}}
28 | /{{item.visit_count}}
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
194 |
--------------------------------------------------------------------------------
/src/views/topic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 | {{topic.author.loginname}}
18 |
21 |
22 |
23 |
26 |
27 | {{topic.visit_count}}次浏览
28 |
29 |
30 |
31 |
34 |
35 |
36 | {{topic.reply_count}} 回复
37 |
38 |
39 |
40 |
41 | -
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | 发布于:{{item.create_at | getLastTimeStr(true)}}
52 |
53 |
54 |
57 | {{item.ups.length}}
58 |
59 |
60 |
61 |
62 |
63 |
70 |
71 |
72 |
73 |
74 |
77 |
78 |
79 |
80 |
81 |
82 | 该话题不存在!
83 |
84 |
85 |
86 |
193 |
--------------------------------------------------------------------------------
/src/assets/scss/github-markdown.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: octicons-anchor;
3 | src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAYcAA0AAAAACjQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABMAAAABwAAAAca8vGTk9TLzIAAAFMAAAARAAAAFZG1VHVY21hcAAAAZAAAAA+AAABQgAP9AdjdnQgAAAB0AAAAAQAAAAEACICiGdhc3AAAAHUAAAACAAAAAj//wADZ2x5ZgAAAdwAAADRAAABEKyikaNoZWFkAAACsAAAAC0AAAA2AtXoA2hoZWEAAALgAAAAHAAAACQHngNFaG10eAAAAvwAAAAQAAAAEAwAACJsb2NhAAADDAAAAAoAAAAKALIAVG1heHAAAAMYAAAAHwAAACABEAB2bmFtZQAAAzgAAALBAAAFu3I9x/Nwb3N0AAAF/AAAAB0AAAAvaoFvbwAAAAEAAAAAzBdyYwAAAADP2IQvAAAAAM/bz7t4nGNgZGFgnMDAysDB1Ml0hoGBoR9CM75mMGLkYGBgYmBlZsAKAtJcUxgcPsR8iGF2+O/AEMPsznAYKMwIkgMA5REMOXicY2BgYGaAYBkGRgYQsAHyGMF8FgYFIM0ChED+h5j//yEk/3KoSgZGNgYYk4GRCUgwMaACRoZhDwCs7QgGAAAAIgKIAAAAAf//AAJ4nHWMMQrCQBBF/0zWrCCIKUQsTDCL2EXMohYGSSmorScInsRGL2DOYJe0Ntp7BK+gJ1BxF1stZvjz/v8DRghQzEc4kIgKwiAppcA9LtzKLSkdNhKFY3HF4lK69ExKslx7Xa+vPRVS43G98vG1DnkDMIBUgFN0MDXflU8tbaZOUkXUH0+U27RoRpOIyCKjbMCVejwypzJJG4jIwb43rfl6wbwanocrJm9XFYfskuVC5K/TPyczNU7b84CXcbxks1Un6H6tLH9vf2LRnn8Ax7A5WQAAAHicY2BkYGAA4teL1+yI57f5ysDNwgAC529f0kOmWRiYVgEpDgYmEA8AUzEKsQAAAHicY2BkYGB2+O/AEMPCAAJAkpEBFbAAADgKAe0EAAAiAAAAAAQAAAAEAAAAAAAAKgAqACoAiAAAeJxjYGRgYGBhsGFgYgABEMkFhAwM/xn0QAIAD6YBhwB4nI1Ty07cMBS9QwKlQapQW3VXySvEqDCZGbGaHULiIQ1FKgjWMxknMfLEke2A+IJu+wntrt/QbVf9gG75jK577Lg8K1qQPCfnnnt8fX1NRC/pmjrk/zprC+8D7tBy9DHgBXoWfQ44Av8t4Bj4Z8CLtBL9CniJluPXASf0Lm4CXqFX8Q84dOLnMB17N4c7tBo1AS/Qi+hTwBH4rwHHwN8DXqQ30XXAS7QaLwSc0Gn8NuAVWou/gFmnjLrEaEh9GmDdDGgL3B4JsrRPDU2hTOiMSuJUIdKQQayiAth69r6akSSFqIJuA19TrzCIaY8sIoxyrNIrL//pw7A2iMygkX5vDj+G+kuoLdX4GlGK/8Lnlz6/h9MpmoO9rafrz7ILXEHHaAx95s9lsI7AHNMBWEZHULnfAXwG9/ZqdzLI08iuwRloXE8kfhXYAvE23+23DU3t626rbs8/8adv+9DWknsHp3E17oCf+Z48rvEQNZ78paYM38qfk3v/u3l3u3GXN2Dmvmvpf1Srwk3pB/VSsp512bA/GG5i2WJ7wu430yQ5K3nFGiOqgtmSB5pJVSizwaacmUZzZhXLlZTq8qGGFY2YcSkqbth6aW1tRmlaCFs2016m5qn36SbJrqosG4uMV4aP2PHBmB3tjtmgN2izkGQyLWprekbIntJFing32a5rKWCN/SdSoga45EJykyQ7asZvHQ8PTm6cslIpwyeyjbVltNikc2HTR7YKh9LBl9DADC0U/jLcBZDKrMhUBfQBvXRzLtFtjU9eNHKin0x5InTqb8lNpfKv1s1xHzTXRqgKzek/mb7nB8RZTCDhGEX3kK/8Q75AmUM/eLkfA+0Hi908Kx4eNsMgudg5GLdRD7a84npi+YxNr5i5KIbW5izXas7cHXIMAau1OueZhfj+cOcP3P8MNIWLyYOBuxL6DRylJ4cAAAB4nGNgYoAALjDJyIAOWMCiTIxMLDmZedkABtIBygAAAA==) format('woff');
4 | }
5 |
6 | .markdown-body {
7 | -webkit-text-size-adjust: 100%;
8 | text-size-adjust: 100%;
9 | color: #333;
10 | font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
11 | font-size: 16px;
12 | line-height: 1.6;
13 | word-wrap: break-word;
14 | }
15 |
16 | .markdown-body a {
17 | background-color: transparent;
18 | }
19 |
20 | .markdown-body a:active,
21 | .markdown-body a:hover {
22 | outline: 0;
23 | }
24 |
25 | .markdown-body strong {
26 | font-weight: bold;
27 | }
28 |
29 | .markdown-body h1 {
30 | font-size: 2em;
31 | margin: 0.67em 0;
32 | }
33 |
34 | .markdown-body img {
35 | border: 0;
36 | }
37 |
38 | .markdown-body hr {
39 | box-sizing: content-box;
40 | height: 0;
41 | }
42 |
43 | .markdown-body pre {
44 | overflow: auto;
45 | }
46 |
47 | .markdown-body code,
48 | .markdown-body kbd,
49 | .markdown-body pre {
50 | font-family: monospace, monospace;
51 | font-size: 1em;
52 | }
53 |
54 | .markdown-body input {
55 | color: inherit;
56 | font: inherit;
57 | margin: 0;
58 | }
59 |
60 | .markdown-body html input[disabled] {
61 | cursor: default;
62 | }
63 |
64 | .markdown-body input {
65 | line-height: normal;
66 | }
67 |
68 | .markdown-body input[type="checkbox"] {
69 | box-sizing: border-box;
70 | padding: 0;
71 | }
72 |
73 | .markdown-body table {
74 | border-collapse: collapse;
75 | border-spacing: 0;
76 | }
77 |
78 | .markdown-body td,
79 | .markdown-body th {
80 | padding: 0;
81 | }
82 |
83 | .markdown-body * {
84 | box-sizing: border-box;
85 | }
86 |
87 | .markdown-body input {
88 | font: 13px/1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
89 | }
90 |
91 | .markdown-body a {
92 | color: #4078c0;
93 | text-decoration: none;
94 | }
95 |
96 | .markdown-body a:hover,
97 | .markdown-body a:active {
98 | text-decoration: underline;
99 | }
100 |
101 | .markdown-body hr {
102 | height: 0;
103 | margin: 15px 0;
104 | overflow: hidden;
105 | background: transparent;
106 | border: 0;
107 | border-bottom: 1px solid #ddd;
108 | }
109 |
110 | .markdown-body hr:before {
111 | display: table;
112 | content: "";
113 | }
114 |
115 | .markdown-body hr:after {
116 | display: table;
117 | clear: both;
118 | content: "";
119 | }
120 |
121 | .markdown-body h1,
122 | .markdown-body h2,
123 | .markdown-body h3,
124 | .markdown-body h4,
125 | .markdown-body h5,
126 | .markdown-body h6 {
127 | margin-top: 15px;
128 | margin-bottom: 15px;
129 | line-height: 1.1;
130 | }
131 |
132 | .markdown-body h1 {
133 | font-size: 30px;
134 | }
135 |
136 | .markdown-body h2 {
137 | font-size: 21px;
138 | }
139 |
140 | .markdown-body h3 {
141 | font-size: 16px;
142 | }
143 |
144 | .markdown-body h4 {
145 | font-size: 14px;
146 | }
147 |
148 | .markdown-body h5 {
149 | font-size: 12px;
150 | }
151 |
152 | .markdown-body h6 {
153 | font-size: 11px;
154 | }
155 |
156 | .markdown-body blockquote {
157 | margin: 0;
158 | }
159 |
160 | .markdown-body ul,
161 | .markdown-body ol {
162 | padding: 0;
163 | margin-top: 0;
164 | margin-bottom: 0;
165 | }
166 |
167 | .markdown-body ol ol,
168 | .markdown-body ul ol {
169 | list-style-type: lower-roman;
170 | }
171 |
172 | .markdown-body ul ul ol,
173 | .markdown-body ul ol ol,
174 | .markdown-body ol ul ol,
175 | .markdown-body ol ol ol {
176 | list-style-type: lower-alpha;
177 | }
178 |
179 | .markdown-body dd {
180 | margin-left: 0;
181 | }
182 |
183 | .markdown-body code {
184 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
185 | font-size: 12px;
186 | }
187 |
188 | .markdown-body pre {
189 | margin-top: 0;
190 | margin-bottom: 0;
191 | font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
192 | }
193 |
194 | .markdown-body .select::-ms-expand {
195 | opacity: 0;
196 | }
197 |
198 | .markdown-body .octicon {
199 | font: normal normal normal 16px/1 octicons-anchor;
200 | display: inline-block;
201 | text-decoration: none;
202 | text-rendering: auto;
203 | -webkit-font-smoothing: antialiased;
204 | -moz-osx-font-smoothing: grayscale;
205 | user-select: none;
206 | }
207 |
208 | .markdown-body .octicon-link:before {
209 | content: '\f05c';
210 | }
211 |
212 | .markdown-body>*:first-child {
213 | margin-top: 0 !important;
214 | }
215 |
216 | .markdown-body>*:last-child {
217 | margin-bottom: 0 !important;
218 | }
219 |
220 | .markdown-body a:not([href]) {
221 | color: inherit;
222 | text-decoration: none;
223 | }
224 |
225 | .markdown-body .anchor {
226 | display: inline-block;
227 | padding-right: 2px;
228 | margin-left: -18px;
229 | }
230 |
231 | .markdown-body .anchor:focus {
232 | outline: none;
233 | }
234 |
235 | .markdown-body h1,
236 | .markdown-body h2,
237 | .markdown-body h3,
238 | .markdown-body h4,
239 | .markdown-body h5,
240 | .markdown-body h6 {
241 | margin-top: 1em;
242 | margin-bottom: 16px;
243 | font-weight: bold;
244 | line-height: 1.4;
245 | }
246 |
247 | .markdown-body h1 .octicon-link,
248 | .markdown-body h2 .octicon-link,
249 | .markdown-body h3 .octicon-link,
250 | .markdown-body h4 .octicon-link,
251 | .markdown-body h5 .octicon-link,
252 | .markdown-body h6 .octicon-link {
253 | color: #000;
254 | vertical-align: middle;
255 | visibility: hidden;
256 | }
257 |
258 | .markdown-body h1:hover .anchor,
259 | .markdown-body h2:hover .anchor,
260 | .markdown-body h3:hover .anchor,
261 | .markdown-body h4:hover .anchor,
262 | .markdown-body h5:hover .anchor,
263 | .markdown-body h6:hover .anchor {
264 | text-decoration: none;
265 | }
266 |
267 | .markdown-body h1:hover .anchor .octicon-link,
268 | .markdown-body h2:hover .anchor .octicon-link,
269 | .markdown-body h3:hover .anchor .octicon-link,
270 | .markdown-body h4:hover .anchor .octicon-link,
271 | .markdown-body h5:hover .anchor .octicon-link,
272 | .markdown-body h6:hover .anchor .octicon-link {
273 | visibility: visible;
274 | }
275 |
276 | .markdown-body h1 {
277 | padding-bottom: 0.3em;
278 | font-size: 2.25em;
279 | line-height: 1.2;
280 | border-bottom: 1px solid #eee;
281 | }
282 |
283 | .markdown-body h1 .anchor {
284 | line-height: 1;
285 | }
286 |
287 | .markdown-body h2 {
288 | padding-bottom: 0.3em;
289 | font-size: 1.75em;
290 | line-height: 1.225;
291 | border-bottom: 1px solid #eee;
292 | }
293 |
294 | .markdown-body h2 .anchor {
295 | line-height: 1;
296 | }
297 |
298 | .markdown-body h3 {
299 | font-size: 1.5em;
300 | line-height: 1.43;
301 | }
302 |
303 | .markdown-body h3 .anchor {
304 | line-height: 1.2;
305 | }
306 |
307 | .markdown-body h4 {
308 | font-size: 1.25em;
309 | }
310 |
311 | .markdown-body h4 .anchor {
312 | line-height: 1.2;
313 | }
314 |
315 | .markdown-body h5 {
316 | font-size: 1em;
317 | }
318 |
319 | .markdown-body h5 .anchor {
320 | line-height: 1.1;
321 | }
322 |
323 | .markdown-body h6 {
324 | font-size: 1em;
325 | color: #777;
326 | }
327 |
328 | .markdown-body h6 .anchor {
329 | line-height: 1.1;
330 | }
331 |
332 | .markdown-body p,
333 | .markdown-body blockquote,
334 | .markdown-body ul,
335 | .markdown-body ol,
336 | .markdown-body dl,
337 | .markdown-body table,
338 | .markdown-body pre {
339 | margin-top: 0;
340 | margin-bottom: 16px;
341 | }
342 |
343 | .markdown-body hr {
344 | height: 4px;
345 | padding: 0;
346 | margin: 16px 0;
347 | background-color: #e7e7e7;
348 | border: 0 none;
349 | }
350 |
351 | .markdown-body ul,
352 | .markdown-body ol {
353 | padding-left: 2em;
354 | }
355 |
356 | .markdown-body ul ul,
357 | .markdown-body ul ol,
358 | .markdown-body ol ol,
359 | .markdown-body ol ul {
360 | margin-top: 0;
361 | margin-bottom: 0;
362 | }
363 |
364 | .markdown-body li>p {
365 | margin-top: 16px;
366 | }
367 |
368 | .markdown-body dl {
369 | padding: 0;
370 | }
371 |
372 | .markdown-body dl dt {
373 | padding: 0;
374 | margin-top: 16px;
375 | font-size: 1em;
376 | font-style: italic;
377 | font-weight: bold;
378 | }
379 |
380 | .markdown-body dl dd {
381 | padding: 0 16px;
382 | margin-bottom: 16px;
383 | }
384 |
385 | .markdown-body blockquote {
386 | padding: 0 15px;
387 | color: #777;
388 | border-left: 4px solid #ddd;
389 | }
390 |
391 | .markdown-body blockquote>:first-child {
392 | margin-top: 0;
393 | }
394 |
395 | .markdown-body blockquote>:last-child {
396 | margin-bottom: 0;
397 | }
398 |
399 | .markdown-body table {
400 | display: block;
401 | width: 100%;
402 | overflow: auto;
403 | word-break: normal;
404 | word-break: keep-all;
405 | }
406 |
407 | .markdown-body table th {
408 | font-weight: bold;
409 | }
410 |
411 | .markdown-body table th,
412 | .markdown-body table td {
413 | padding: 6px 13px;
414 | border: 1px solid #ddd;
415 | }
416 |
417 | .markdown-body table tr {
418 | background-color: #fff;
419 | border-top: 1px solid #ccc;
420 | }
421 |
422 | .markdown-body table tr:nth-child(2n) {
423 | background-color: #f8f8f8;
424 | }
425 |
426 | .markdown-body img {
427 | max-width: 100%;
428 | box-sizing: content-box;
429 | background-color: #fff;
430 | }
431 |
432 | .markdown-body code {
433 | padding: 0;
434 | padding-top: 0.2em;
435 | padding-bottom: 0.2em;
436 | margin: 0;
437 | font-size: 85%;
438 | background-color: rgba(0,0,0,0.04);
439 | border-radius: 3px;
440 | }
441 |
442 | .markdown-body code:before,
443 | .markdown-body code:after {
444 | letter-spacing: -0.2em;
445 | content: "\00a0";
446 | }
447 |
448 | .markdown-body pre>code {
449 | padding: 0;
450 | margin: 0;
451 | font-size: 100%;
452 | word-break: normal;
453 | white-space: pre;
454 | background: transparent;
455 | border: 0;
456 | }
457 |
458 | .markdown-body .highlight {
459 | margin-bottom: 16px;
460 | }
461 |
462 | .markdown-body .highlight pre,
463 | .markdown-body pre {
464 | padding: 16px;
465 | overflow: auto;
466 | font-size: 85%;
467 | line-height: 1.45;
468 | background-color: #f7f7f7;
469 | border-radius: 3px;
470 | }
471 |
472 | .markdown-body .highlight pre {
473 | margin-bottom: 0;
474 | word-break: normal;
475 | }
476 |
477 | .markdown-body pre {
478 | word-wrap: normal;
479 | }
480 |
481 | .markdown-body pre code {
482 | display: inline;
483 | max-width: initial;
484 | padding: 0;
485 | margin: 0;
486 | overflow: initial;
487 | line-height: inherit;
488 | word-wrap: normal;
489 | background-color: transparent;
490 | border: 0;
491 | }
492 |
493 | .markdown-body pre code:before,
494 | .markdown-body pre code:after {
495 | content: normal;
496 | }
497 |
498 | .markdown-body kbd {
499 | display: inline-block;
500 | padding: 3px 5px;
501 | font-size: 11px;
502 | line-height: 10px;
503 | color: #555;
504 | vertical-align: middle;
505 | background-color: #fcfcfc;
506 | border: solid 1px #ccc;
507 | border-bottom-color: #bbb;
508 | border-radius: 3px;
509 | box-shadow: inset 0 -1px 0 #bbb;
510 | }
511 |
512 | .markdown-body .pl-c {
513 | color: #969896;
514 | }
515 |
516 | .markdown-body .pl-c1,
517 | .markdown-body .pl-s .pl-v {
518 | color: #0086b3;
519 | }
520 |
521 | .markdown-body .pl-e,
522 | .markdown-body .pl-en {
523 | color: #795da3;
524 | }
525 |
526 | .markdown-body .pl-s .pl-s1,
527 | .markdown-body .pl-smi {
528 | color: #333;
529 | }
530 |
531 | .markdown-body .pl-ent {
532 | color: #63a35c;
533 | }
534 |
535 | .markdown-body .pl-k {
536 | color: #a71d5d;
537 | }
538 |
539 | .markdown-body .pl-pds,
540 | .markdown-body .pl-s,
541 | .markdown-body .pl-s .pl-pse .pl-s1,
542 | .markdown-body .pl-sr,
543 | .markdown-body .pl-sr .pl-cce,
544 | .markdown-body .pl-sr .pl-sra,
545 | .markdown-body .pl-sr .pl-sre {
546 | color: #183691;
547 | }
548 |
549 | .markdown-body .pl-v {
550 | color: #ed6a43;
551 | }
552 |
553 | .markdown-body .pl-id {
554 | color: #b52a1d;
555 | }
556 |
557 | .markdown-body .pl-ii {
558 | background-color: #b52a1d;
559 | color: #f8f8f8;
560 | }
561 |
562 | .markdown-body .pl-sr .pl-cce {
563 | color: #63a35c;
564 | font-weight: bold;
565 | }
566 |
567 | .markdown-body .pl-ml {
568 | color: #693a17;
569 | }
570 |
571 | .markdown-body .pl-mh,
572 | .markdown-body .pl-mh .pl-en,
573 | .markdown-body .pl-ms {
574 | color: #1d3e81;
575 | font-weight: bold;
576 | }
577 |
578 | .markdown-body .pl-mq {
579 | color: #008080;
580 | }
581 |
582 | .markdown-body .pl-mi {
583 | color: #333;
584 | font-style: italic;
585 | }
586 |
587 | .markdown-body .pl-mb {
588 | color: #333;
589 | font-weight: bold;
590 | }
591 |
592 | .markdown-body .pl-md {
593 | background-color: #ffecec;
594 | color: #bd2c00;
595 | }
596 |
597 | .markdown-body .pl-mi1 {
598 | background-color: #eaffea;
599 | color: #55a532;
600 | }
601 |
602 | .markdown-body .pl-mdr {
603 | color: #795da3;
604 | font-weight: bold;
605 | }
606 |
607 | .markdown-body .pl-mo {
608 | color: #1d3e81;
609 | }
610 |
611 | .markdown-body kbd {
612 | display: inline-block;
613 | padding: 3px 5px;
614 | font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
615 | line-height: 10px;
616 | color: #555;
617 | vertical-align: middle;
618 | background-color: #fcfcfc;
619 | border: solid 1px #ccc;
620 | border-bottom-color: #bbb;
621 | border-radius: 3px;
622 | box-shadow: inset 0 -1px 0 #bbb;
623 | }
624 |
625 | .markdown-body:before {
626 | display: table;
627 | content: "";
628 | }
629 |
630 | .markdown-body:after {
631 | display: table;
632 | clear: both;
633 | content: "";
634 | }
635 |
636 | .markdown-body .task-list-item {
637 | list-style-type: none;
638 | }
639 |
640 | .markdown-body .task-list-item+.task-list-item {
641 | margin-top: 3px;
642 | }
643 |
644 | .markdown-body .task-list-item input {
645 | margin: 0 0.35em 0.25em -1.6em;
646 | vertical-align: middle;
647 | }
648 |
649 | .markdown-body :checked+.radio-label {
650 | z-index: 1;
651 | position: relative;
652 | border-color: #4078c0;
653 | }
654 |
--------------------------------------------------------------------------------
/src/libs/llqrcode.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | var _aa = {};
4 | _aa._ab = function(f, e) {
5 | var d = qrcode.width;
6 | var b = qrcode.height;
7 | var c = true;
8 | for (var g = 0; g < e.length && c; g += 2) {
9 | var a = Math.floor(e[g]);
10 | var h = Math.floor(e[g + 1]);
11 | if (a < -1 || a > d || h < -1 || h > b) {
12 | throw "Error._ab "
13 | }
14 | c = false;
15 | if (a == -1) {
16 | e[g] = 0;
17 | c = true
18 | } else {
19 | if (a == d) {
20 | e[g] = d - 1;
21 | c = true
22 | }
23 | }
24 | if (h == -1) {
25 | e[g + 1] = 0;
26 | c = true
27 | } else {
28 | if (h == b) {
29 | e[g + 1] = b - 1;
30 | c = true
31 | }
32 | }
33 | }
34 | c = true;
35 | for (var g = e.length - 2; g >= 0 && c; g -= 2) {
36 | var a = Math.floor(e[g]);
37 | var h = Math.floor(e[g + 1]);
38 | if (a < -1 || a > d || h < -1 || h > b) {
39 | throw "Error._ab "
40 | }
41 | c = false;
42 | if (a == -1) {
43 | e[g] = 0;
44 | c = true
45 | } else {
46 | if (a == d) {
47 | e[g] = d - 1;
48 | c = true
49 | }
50 | }
51 | if (h == -1) {
52 | e[g + 1] = 0;
53 | c = true
54 | } else {
55 | if (h == b) {
56 | e[g + 1] = b - 1;
57 | c = true
58 | }
59 | }
60 | }
61 | };
62 | _aa._af = function(b, d, a) {
63 | var l = new _ac(d);
64 | var k = new Array(d << 1);
65 | for (var g = 0; g < d; g++) {
66 | var h = k.length;
67 | var j = g + 0.5;
68 | for (var i = 0; i < h; i += 2) {
69 | k[i] = (i >> 1) + 0.5;
70 | k[i + 1] = j
71 | }
72 | a._ad(k);
73 | _aa._ab(b, k);
74 | try {
75 | for (var i = 0; i < h; i += 2) {
76 | var e = (Math.floor(k[i]) * 4) + (Math.floor(k[i + 1]) * qrcode.width * 4);
77 | var f = b[Math.floor(k[i]) + qrcode.width * Math.floor(k[i + 1])];
78 | qrcode.imagedata.data[e] = f ? 255 : 0;
79 | qrcode.imagedata.data[e + 1] = f ? 255 : 0;
80 | qrcode.imagedata.data[e + 2] = 0;
81 | qrcode.imagedata.data[e + 3] = 255;
82 | if (f) {
83 | l._dq(i >> 1, g)
84 | }
85 | }
86 | } catch (c) {
87 | throw "Error._ab"
88 | }
89 | }
90 | return l
91 | };
92 | _aa._ah = function(h, o, l, k, r, q, b, a, f, e, n, m, t, s, d, c, j, i) {
93 | var g = _ae._ag(l, k, r, q, b, a, f, e, n, m, t, s, d, c, j, i);
94 | return _aa._af(h, o, g)
95 | };
96 |
97 | function _a1(b, a) {
98 | this.count = b;
99 | this._fc = a;
100 | this.__defineGetter__("Count",
101 | function() {
102 | return this.count
103 | });
104 | this.__defineGetter__("_dm",
105 | function() {
106 | return this._fc
107 | })
108 | }
109 |
110 | function _a2(a, c, b) {
111 | this._bm = a;
112 | if (b) {
113 | this._do = new Array(c, b)
114 | } else {
115 | this._do = new Array(c)
116 | }
117 | this.__defineGetter__("_bo",
118 | function() {
119 | return this._bm
120 | });
121 | this.__defineGetter__("_dn",
122 | function() {
123 | return this._bm * this._fo
124 | });
125 | this.__defineGetter__("_fo",
126 | function() {
127 | var e = 0;
128 | for (var d = 0; d < this._do.length; d++) {
129 | e += this._do[d].length
130 | }
131 | return e
132 | });
133 | this._fb = function() {
134 | return this._do
135 | }
136 | }
137 |
138 | function _a3(k, l, h, g, f, e) {
139 | this._bs = k;
140 | this._ar = l;
141 | this._do = new Array(h, g, f, e);
142 | var j = 0;
143 | var b = h._bo;
144 | var a = h._fb();
145 | for (var d = 0; d < a.length; d++) {
146 | var c = a[d];
147 | j += c.Count * (c._dm + b)
148 | }
149 | this._br = j;
150 | this.__defineGetter__("_fd",
151 | function() {
152 | return this._bs
153 | });
154 | this.__defineGetter__("_as",
155 | function() {
156 | return this._ar
157 | });
158 | this.__defineGetter__("_dp",
159 | function() {
160 | return this._br
161 | });
162 | this.__defineGetter__("_cr",
163 | function() {
164 | return 17 + 4 * this._bs
165 | });
166 | this._aq = function() {
167 | var r = this._cr;
168 | var o = new _ac(r);
169 | o._bq(0, 0, 9, 9);
170 | o._bq(r - 8, 0, 8, 9);
171 | o._bq(0, r - 8, 9, 8);
172 | var n = this._ar.length;
173 | for (var m = 0; m < n; m++) {
174 | var q = this._ar[m] - 2;
175 | for (var s = 0; s < n; s++) {
176 | if ((m == 0 && (s == 0 || s == n - 1)) || (m == n - 1 && s == 0)) {
177 | continue
178 | }
179 | o._bq(this._ar[s] - 2, q, 5, 5)
180 | }
181 | }
182 | o._bq(6, 9, 1, r - 17);
183 | o._bq(9, 6, r - 17, 1);
184 | if (this._bs > 6) {
185 | o._bq(r - 11, 0, 3, 6);
186 | o._bq(0, r - 11, 6, 3)
187 | }
188 | return o
189 | };
190 | this._bu = function(i) {
191 | return this._do[i.ordinal()]
192 | }
193 | }
194 | _a3._bv = new Array(31892, 34236, 39577, 42195, 48118, 51042, 55367, 58893, 63784, 68472, 70749, 76311, 79154, 84390, 87683, 92361, 96236, 102084, 102881, 110507, 110734, 117786, 119615, 126325, 127568, 133589, 136944, 141498, 145311, 150283, 152622, 158308, 161089, 167017);
195 | _a3.VERSIONS = _ay();
196 | _a3._av = function(a) {
197 | if (a < 1 || a > 40) {
198 | throw "bad arguments"
199 | }
200 | return _a3.VERSIONS[a - 1]
201 | };
202 | _a3._at = function(b) {
203 | if (b % 4 != 1) {
204 | throw "Error _at"
205 | }
206 | try {
207 | return _a3._av((b - 17) >> 2)
208 | } catch (a) {
209 | throw "Error _av"
210 | }
211 | };
212 | _a3._aw = function(d) {
213 | var b = 4294967295;
214 | var f = 0;
215 | for (var c = 0; c < _a3._bv.length; c++) {
216 | var a = _a3._bv[c];
217 | if (a == d) {
218 | return this._av(c + 7)
219 | }
220 | var e = _ax._gj(d, a);
221 | if (e < b) {
222 | f = c + 7;
223 | b = e
224 | }
225 | }
226 | if (b <= 3) {
227 | return this._av(f)
228 | }
229 | return null
230 | };
231 |
232 | function _ay() {
233 | return new Array(new _a3(1, new Array(), new _a2(7, new _a1(1, 19)), new _a2(10, new _a1(1, 16)), new _a2(13, new _a1(1, 13)), new _a2(17, new _a1(1, 9))), new _a3(2, new Array(6, 18), new _a2(10, new _a1(1, 34)), new _a2(16, new _a1(1, 28)), new _a2(22, new _a1(1, 22)), new _a2(28, new _a1(1, 16))), new _a3(3, new Array(6, 22), new _a2(15, new _a1(1, 55)), new _a2(26, new _a1(1, 44)), new _a2(18, new _a1(2, 17)), new _a2(22, new _a1(2, 13))), new _a3(4, new Array(6, 26), new _a2(20, new _a1(1, 80)), new _a2(18, new _a1(2, 32)), new _a2(26, new _a1(2, 24)), new _a2(16, new _a1(4, 9))), new _a3(5, new Array(6, 30), new _a2(26, new _a1(1, 108)), new _a2(24, new _a1(2, 43)), new _a2(18, new _a1(2, 15), new _a1(2, 16)), new _a2(22, new _a1(2, 11), new _a1(2, 12))), new _a3(6, new Array(6, 34), new _a2(18, new _a1(2, 68)), new _a2(16, new _a1(4, 27)), new _a2(24, new _a1(4, 19)), new _a2(28, new _a1(4, 15))), new _a3(7, new Array(6, 22, 38), new _a2(20, new _a1(2, 78)), new _a2(18, new _a1(4, 31)), new _a2(18, new _a1(2, 14), new _a1(4, 15)), new _a2(26, new _a1(4, 13), new _a1(1, 14))), new _a3(8, new Array(6, 24, 42), new _a2(24, new _a1(2, 97)), new _a2(22, new _a1(2, 38), new _a1(2, 39)), new _a2(22, new _a1(4, 18), new _a1(2, 19)), new _a2(26, new _a1(4, 14), new _a1(2, 15))), new _a3(9, new Array(6, 26, 46), new _a2(30, new _a1(2, 116)), new _a2(22, new _a1(3, 36), new _a1(2, 37)), new _a2(20, new _a1(4, 16), new _a1(4, 17)), new _a2(24, new _a1(4, 12), new _a1(4, 13))), new _a3(10, new Array(6, 28, 50), new _a2(18, new _a1(2, 68), new _a1(2, 69)), new _a2(26, new _a1(4, 43), new _a1(1, 44)), new _a2(24, new _a1(6, 19), new _a1(2, 20)), new _a2(28, new _a1(6, 15), new _a1(2, 16))), new _a3(11, new Array(6, 30, 54), new _a2(20, new _a1(4, 81)), new _a2(30, new _a1(1, 50), new _a1(4, 51)), new _a2(28, new _a1(4, 22), new _a1(4, 23)), new _a2(24, new _a1(3, 12), new _a1(8, 13))), new _a3(12, new Array(6, 32, 58), new _a2(24, new _a1(2, 92), new _a1(2, 93)), new _a2(22, new _a1(6, 36), new _a1(2, 37)), new _a2(26, new _a1(4, 20), new _a1(6, 21)), new _a2(28, new _a1(7, 14), new _a1(4, 15))), new _a3(13, new Array(6, 34, 62), new _a2(26, new _a1(4, 107)), new _a2(22, new _a1(8, 37), new _a1(1, 38)), new _a2(24, new _a1(8, 20), new _a1(4, 21)), new _a2(22, new _a1(12, 11), new _a1(4, 12))), new _a3(14, new Array(6, 26, 46, 66), new _a2(30, new _a1(3, 115), new _a1(1, 116)), new _a2(24, new _a1(4, 40), new _a1(5, 41)), new _a2(20, new _a1(11, 16), new _a1(5, 17)), new _a2(24, new _a1(11, 12), new _a1(5, 13))), new _a3(15, new Array(6, 26, 48, 70), new _a2(22, new _a1(5, 87), new _a1(1, 88)), new _a2(24, new _a1(5, 41), new _a1(5, 42)), new _a2(30, new _a1(5, 24), new _a1(7, 25)), new _a2(24, new _a1(11, 12), new _a1(7, 13))), new _a3(16, new Array(6, 26, 50, 74), new _a2(24, new _a1(5, 98), new _a1(1, 99)), new _a2(28, new _a1(7, 45), new _a1(3, 46)), new _a2(24, new _a1(15, 19), new _a1(2, 20)), new _a2(30, new _a1(3, 15), new _a1(13, 16))), new _a3(17, new Array(6, 30, 54, 78), new _a2(28, new _a1(1, 107), new _a1(5, 108)), new _a2(28, new _a1(10, 46), new _a1(1, 47)), new _a2(28, new _a1(1, 22), new _a1(15, 23)), new _a2(28, new _a1(2, 14), new _a1(17, 15))), new _a3(18, new Array(6, 30, 56, 82), new _a2(30, new _a1(5, 120), new _a1(1, 121)), new _a2(26, new _a1(9, 43), new _a1(4, 44)), new _a2(28, new _a1(17, 22), new _a1(1, 23)), new _a2(28, new _a1(2, 14), new _a1(19, 15))), new _a3(19, new Array(6, 30, 58, 86), new _a2(28, new _a1(3, 113), new _a1(4, 114)), new _a2(26, new _a1(3, 44), new _a1(11, 45)), new _a2(26, new _a1(17, 21), new _a1(4, 22)), new _a2(26, new _a1(9, 13), new _a1(16, 14))), new _a3(20, new Array(6, 34, 62, 90), new _a2(28, new _a1(3, 107), new _a1(5, 108)), new _a2(26, new _a1(3, 41), new _a1(13, 42)), new _a2(30, new _a1(15, 24), new _a1(5, 25)), new _a2(28, new _a1(15, 15), new _a1(10, 16))), new _a3(21, new Array(6, 28, 50, 72, 94), new _a2(28, new _a1(4, 116), new _a1(4, 117)), new _a2(26, new _a1(17, 42)), new _a2(28, new _a1(17, 22), new _a1(6, 23)), new _a2(30, new _a1(19, 16), new _a1(6, 17))), new _a3(22, new Array(6, 26, 50, 74, 98), new _a2(28, new _a1(2, 111), new _a1(7, 112)), new _a2(28, new _a1(17, 46)), new _a2(30, new _a1(7, 24), new _a1(16, 25)), new _a2(24, new _a1(34, 13))), new _a3(23, new Array(6, 30, 54, 74, 102), new _a2(30, new _a1(4, 121), new _a1(5, 122)), new _a2(28, new _a1(4, 47), new _a1(14, 48)), new _a2(30, new _a1(11, 24), new _a1(14, 25)), new _a2(30, new _a1(16, 15), new _a1(14, 16))), new _a3(24, new Array(6, 28, 54, 80, 106), new _a2(30, new _a1(6, 117), new _a1(4, 118)), new _a2(28, new _a1(6, 45), new _a1(14, 46)), new _a2(30, new _a1(11, 24), new _a1(16, 25)), new _a2(30, new _a1(30, 16), new _a1(2, 17))), new _a3(25, new Array(6, 32, 58, 84, 110), new _a2(26, new _a1(8, 106), new _a1(4, 107)), new _a2(28, new _a1(8, 47), new _a1(13, 48)), new _a2(30, new _a1(7, 24), new _a1(22, 25)), new _a2(30, new _a1(22, 15), new _a1(13, 16))), new _a3(26, new Array(6, 30, 58, 86, 114), new _a2(28, new _a1(10, 114), new _a1(2, 115)), new _a2(28, new _a1(19, 46), new _a1(4, 47)), new _a2(28, new _a1(28, 22), new _a1(6, 23)), new _a2(30, new _a1(33, 16), new _a1(4, 17))), new _a3(27, new Array(6, 34, 62, 90, 118), new _a2(30, new _a1(8, 122), new _a1(4, 123)), new _a2(28, new _a1(22, 45), new _a1(3, 46)), new _a2(30, new _a1(8, 23), new _a1(26, 24)), new _a2(30, new _a1(12, 15), new _a1(28, 16))), new _a3(28, new Array(6, 26, 50, 74, 98, 122), new _a2(30, new _a1(3, 117), new _a1(10, 118)), new _a2(28, new _a1(3, 45), new _a1(23, 46)), new _a2(30, new _a1(4, 24), new _a1(31, 25)), new _a2(30, new _a1(11, 15), new _a1(31, 16))), new _a3(29, new Array(6, 30, 54, 78, 102, 126), new _a2(30, new _a1(7, 116), new _a1(7, 117)), new _a2(28, new _a1(21, 45), new _a1(7, 46)), new _a2(30, new _a1(1, 23), new _a1(37, 24)), new _a2(30, new _a1(19, 15), new _a1(26, 16))), new _a3(30, new Array(6, 26, 52, 78, 104, 130), new _a2(30, new _a1(5, 115), new _a1(10, 116)), new _a2(28, new _a1(19, 47), new _a1(10, 48)), new _a2(30, new _a1(15, 24), new _a1(25, 25)), new _a2(30, new _a1(23, 15), new _a1(25, 16))), new _a3(31, new Array(6, 30, 56, 82, 108, 134), new _a2(30, new _a1(13, 115), new _a1(3, 116)), new _a2(28, new _a1(2, 46), new _a1(29, 47)), new _a2(30, new _a1(42, 24), new _a1(1, 25)), new _a2(30, new _a1(23, 15), new _a1(28, 16))), new _a3(32, new Array(6, 34, 60, 86, 112, 138), new _a2(30, new _a1(17, 115)), new _a2(28, new _a1(10, 46), new _a1(23, 47)), new _a2(30, new _a1(10, 24), new _a1(35, 25)), new _a2(30, new _a1(19, 15), new _a1(35, 16))), new _a3(33, new Array(6, 30, 58, 86, 114, 142), new _a2(30, new _a1(17, 115), new _a1(1, 116)), new _a2(28, new _a1(14, 46), new _a1(21, 47)), new _a2(30, new _a1(29, 24), new _a1(19, 25)), new _a2(30, new _a1(11, 15), new _a1(46, 16))), new _a3(34, new Array(6, 34, 62, 90, 118, 146), new _a2(30, new _a1(13, 115), new _a1(6, 116)), new _a2(28, new _a1(14, 46), new _a1(23, 47)), new _a2(30, new _a1(44, 24), new _a1(7, 25)), new _a2(30, new _a1(59, 16), new _a1(1, 17))), new _a3(35, new Array(6, 30, 54, 78, 102, 126, 150), new _a2(30, new _a1(12, 121), new _a1(7, 122)), new _a2(28, new _a1(12, 47), new _a1(26, 48)), new _a2(30, new _a1(39, 24), new _a1(14, 25)), new _a2(30, new _a1(22, 15), new _a1(41, 16))), new _a3(36, new Array(6, 24, 50, 76, 102, 128, 154), new _a2(30, new _a1(6, 121), new _a1(14, 122)), new _a2(28, new _a1(6, 47), new _a1(34, 48)), new _a2(30, new _a1(46, 24), new _a1(10, 25)), new _a2(30, new _a1(2, 15), new _a1(64, 16))), new _a3(37, new Array(6, 28, 54, 80, 106, 132, 158), new _a2(30, new _a1(17, 122), new _a1(4, 123)), new _a2(28, new _a1(29, 46), new _a1(14, 47)), new _a2(30, new _a1(49, 24), new _a1(10, 25)), new _a2(30, new _a1(24, 15), new _a1(46, 16))), new _a3(38, new Array(6, 32, 58, 84, 110, 136, 162), new _a2(30, new _a1(4, 122), new _a1(18, 123)), new _a2(28, new _a1(13, 46), new _a1(32, 47)), new _a2(30, new _a1(48, 24), new _a1(14, 25)), new _a2(30, new _a1(42, 15), new _a1(32, 16))), new _a3(39, new Array(6, 26, 54, 82, 110, 138, 166), new _a2(30, new _a1(20, 117), new _a1(4, 118)), new _a2(28, new _a1(40, 47), new _a1(7, 48)), new _a2(30, new _a1(43, 24), new _a1(22, 25)), new _a2(30, new _a1(10, 15), new _a1(67, 16))), new _a3(40, new Array(6, 30, 58, 86, 114, 142, 170), new _a2(30, new _a1(19, 118), new _a1(6, 119)), new _a2(28, new _a1(18, 47), new _a1(31, 48)), new _a2(30, new _a1(34, 24), new _a1(34, 25)), new _a2(30, new _a1(20, 15), new _a1(61, 16))))
234 | }
235 |
236 | function _ae(i, f, c, h, e, b, g, d, a) {
237 | this.a11 = i;
238 | this.a12 = h;
239 | this.a13 = g;
240 | this.a21 = f;
241 | this.a22 = e;
242 | this.a23 = d;
243 | this.a31 = c;
244 | this.a32 = b;
245 | this.a33 = a;
246 | this._ad = function(w) {
247 | var t = w.length;
248 | var A = this.a11;
249 | var z = this.a12;
250 | var v = this.a13;
251 | var r = this.a21;
252 | var q = this.a22;
253 | var o = this.a23;
254 | var m = this.a31;
255 | var k = this.a32;
256 | var j = this.a33;
257 | for (var n = 0; n < t; n += 2) {
258 | var u = w[n];
259 | var s = w[n + 1];
260 | var l = v * u + o * s + j;
261 | w[n] = (A * u + r * s + m) / l;
262 | w[n + 1] = (z * u + q * s + k) / l
263 | }
264 | };
265 | this._fp = function(m, k) {
266 | var r = m.length;
267 | for (var l = 0; l < r; l++) {
268 | var j = m[l];
269 | var q = k[l];
270 | var o = this.a13 * j + this.a23 * q + this.a33;
271 | m[l] = (this.a11 * j + this.a21 * q + this.a31) / o;
272 | k[l] = (this.a12 * j + this.a22 * q + this.a32) / o
273 | }
274 | };
275 | this._fr = function() {
276 | return new _ae(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21)
277 | };
278 | this.times = function(j) {
279 | return new _ae(this.a11 * j.a11 + this.a21 * j.a12 + this.a31 * j.a13, this.a11 * j.a21 + this.a21 * j.a22 + this.a31 * j.a23, this.a11 * j.a31 + this.a21 * j.a32 + this.a31 * j.a33, this.a12 * j.a11 + this.a22 * j.a12 + this.a32 * j.a13, this.a12 * j.a21 + this.a22 * j.a22 + this.a32 * j.a23, this.a12 * j.a31 + this.a22 * j.a32 + this.a32 * j.a33, this.a13 * j.a11 + this.a23 * j.a12 + this.a33 * j.a13, this.a13 * j.a21 + this.a23 * j.a22 + this.a33 * j.a23, this.a13 * j.a31 + this.a23 * j.a32 + this.a33 * j.a33)
280 | }
281 | }
282 | _ae._ag = function(q, e, o, d, n, c, m, b, h, r, l, f, a, j, i, s) {
283 | var g = this._be(q, e, o, d, n, c, m, b);
284 | var k = this._bf(h, r, l, f, a, j, i, s);
285 | return k.times(g)
286 | };
287 | _ae._bf = function(f, h, d, g, b, e, a, c) {
288 | var dy2 = c - e;
289 | var dy3 = h - g + e - c;
290 | if (dy2 == 0 && dy3 == 0) {
291 | return new _ae(d - f, b - d, f, g - h, e - g, h, 0, 0, 1)
292 | } else {
293 | var dx1 = d - b;
294 | var dx2 = a - b;
295 | var dx3 = f - d + b - a;
296 | var dy1 = g - e;
297 | var _dr = dx1 * dy2 - dx2 * dy1;
298 | var a13 = (dx3 * dy2 - dx2 * dy3) / _dr;
299 | var a23 = (dx1 * dy3 - dx3 * dy1) / _dr;
300 | return new _ae(d - f + a13 * d, a - f + a23 * a, f, g - h + a13 * g, c - h + a23 * c, h, a13, a23, 1)
301 | }
302 | };
303 | _ae._be = function(f, h, d, g, b, e, a, c) {
304 | return this._bf(f, h, d, g, b, e, a, c)._fr()
305 | };
306 |
307 | function _bg(b, a) {
308 | this.bits = b;
309 | this.points = a
310 | }
311 | var xDiff = 0;
312 | var yDiff = 0;
313 | function Detector(a) {
314 | this.image = a;
315 | this._am = null;
316 | this._bi = function(m, l, c, b) {
317 | var d = Math.abs(b - l) > Math.abs(c - m);
318 | if (d) {
319 | var s = m;
320 | m = l;
321 | l = s;
322 | s = c;
323 | c = b;
324 | b = s
325 | }
326 | var j = Math.abs(c - m);
327 | var i = Math.abs(b - l);
328 | var q = -j >> 1;
329 | var v = l < b ? 1 : -1;
330 | var f = m < c ? 1 : -1;
331 | var e = 0;
332 | for (var h = m,
333 | g = l; h != c; h += f) {
334 | var u = d ? g : h;
335 | var t = d ? h : g;
336 | if (e == 1) {
337 | if (this.image[u + t * qrcode.width]) {
338 | e++
339 | }
340 | } else {
341 | if (!this.image[u + t * qrcode.width]) {
342 | e++
343 | }
344 | }
345 | if (e == 3) {
346 | var o = h - m;
347 | var n = g - l;
348 | return Math.sqrt((o * o + n * n))
349 | }
350 | q += i;
351 | if (q > 0) {
352 | if (g == b) {
353 | break
354 | }
355 | g += v;
356 | q -= j
357 | }
358 | }
359 | var k = c - m;
360 | var r = b - l;
361 | return Math.sqrt((k * k + r * r))
362 | };
363 | this._bh = function(i, g, h, f) {
364 | var b = this._bi(i, g, h, f);
365 | var e = 1;
366 | var d = i - (h - i);
367 | if (d < 0) {
368 | e = i / (i - d);
369 | d = 0
370 | } else {
371 | if (d >= qrcode.width) {
372 | e = (qrcode.width - 1 - i) / (d - i);
373 | d = qrcode.width - 1
374 | }
375 | }
376 | var c = Math.floor(g - (f - g) * e);
377 | e = 1;
378 | if (c < 0) {
379 | e = g / (g - c);
380 | c = 0
381 | } else {
382 | if (c >= qrcode.height) {
383 | e = (qrcode.height - 1 - g) / (c - g);
384 | c = qrcode.height - 1
385 | }
386 | }
387 | d = Math.floor(i + (d - i) * e);
388 | b += this._bi(i, g, d, c);
389 | return b - 1
390 | };
391 | this._bj = function(c, d) {
392 | var b = this._bh(Math.floor(c.X), Math.floor(c.Y), Math.floor(d.X), Math.floor(d.Y));
393 | var e = this._bh(Math.floor(d.X), Math.floor(d.Y), Math.floor(c.X), Math.floor(c.Y));
394 | if (isNaN(b)) {
395 | return e / 7
396 | }
397 | if (isNaN(e)) {
398 | return b / 7
399 | }
400 | return (b + e) / 14
401 | };
402 | this._bk = function(d, c, b) {
403 | return (this._bj(d, c) + this._bj(d, b)) / 2
404 | };
405 | this.distance = function(c, b) {
406 | xDiff = c.X - b.X;
407 | yDiff = c.Y - b.Y;
408 | return Math.sqrt((xDiff * xDiff + yDiff * yDiff))
409 | };
410 | this._bx = function(g, f, d, e) {
411 | var b = Math.round(this.distance(g, f) / e);
412 | var c = Math.round(this.distance(g, d) / e);
413 | var h = ((b + c) >> 1) + 7;
414 | switch (h & 3) {
415 | case 0:
416 | h++;
417 | break;
418 | case 2:
419 | h--;
420 | break;
421 | case 3:
422 | throw "Error"
423 | }
424 | return h
425 | };
426 | this._bl = function(g, f, d, j) {
427 | var k = Math.floor(j * g);
428 | var h = Math.max(0, f - k);
429 | var i = Math.min(qrcode.width - 1, f + k);
430 | if (i - h < g * 3) {
431 | throw "Error"
432 | }
433 | var b = Math.max(0, d - k);
434 | var c = Math.min(qrcode.height - 1, d + k);
435 | var e = new _ak(this.image, h, b, i - h, c - b, g, this._am);
436 | return e.find()
437 | };
438 | this.createTransform = function(l, h, k, b, g) {
439 | var j = g - 3.5;
440 | var i;
441 | var f;
442 | var e;
443 | var c;
444 | if (b != null) {
445 | i = b.X;
446 | f = b.Y;
447 | e = c = j - 3
448 | } else {
449 | i = (h.X - l.X) + k.X;
450 | f = (h.Y - l.Y) + k.Y;
451 | e = c = j
452 | }
453 | var d = _ae._ag(3.5, 3.5, j, 3.5, e, c, 3.5, j, l.X, l.Y, h.X, h.Y, i, f, k.X, k.Y);
454 | return d
455 | };
456 | this._bz = function(e, b, d) {
457 | var c = _aa;
458 | return c._af(e, d, b)
459 | };
460 | this._cd = function(r) {
461 | var j = r._gq;
462 | var h = r._gs;
463 | var n = r._gp;
464 | var d = this._bk(j, h, n);
465 | if (d < 1) {
466 | throw "Error"
467 | }
468 | var s = this._bx(j, h, n, d);
469 | var b = _a3._at(s);
470 | var k = b._cr - 7;
471 | var l = null;
472 | if (b._as.length > 0) {
473 | var f = h.X - j.X + n.X;
474 | var e = h.Y - j.Y + n.Y;
475 | var c = 1 - 3 / k;
476 | var u = Math.floor(j.X + c * (f - j.X));
477 | var t = Math.floor(j.Y + c * (e - j.Y));
478 | for (var q = 4; q <= 16; q <<= 1) {
479 | l = this._bl(d, u, t, q);
480 | break
481 | }
482 | }
483 | var g = this.createTransform(j, h, n, l, s);
484 | var m = this._bz(this.image, g, s);
485 | var o;
486 | if (l == null) {
487 | o = new Array(n, j, h)
488 | } else {
489 | o = new Array(n, j, h, l)
490 | }
491 | return new _bg(m, o)
492 | };
493 | this.detect = function() {
494 | var b = new _cc()._ce(this.image);
495 | return this._cd(b)
496 | }
497 | }
498 | var _ca = 21522;
499 | var _cb = new Array(new Array(21522, 0), new Array(20773, 1), new Array(24188, 2), new Array(23371, 3), new Array(17913, 4), new Array(16590, 5), new Array(20375, 6), new Array(19104, 7), new Array(30660, 8), new Array(29427, 9), new Array(32170, 10), new Array(30877, 11), new Array(26159, 12), new Array(25368, 13), new Array(27713, 14), new Array(26998, 15), new Array(5769, 16), new Array(5054, 17), new Array(7399, 18), new Array(6608, 19), new Array(1890, 20), new Array(597, 21), new Array(3340, 22), new Array(2107, 23), new Array(13663, 24), new Array(12392, 25), new Array(16177, 26), new Array(14854, 27), new Array(9396, 28), new Array(8579, 29), new Array(11994, 30), new Array(11245, 31));
500 | var _ch = new Array(0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4);
501 |
502 | function _ax(a) {
503 | this._cf = _cg.forBits((a >> 3) & 3);
504 | this._fe = (a & 7);
505 | this.__defineGetter__("_cg",
506 | function() {
507 | return this._cf
508 | });
509 | this.__defineGetter__("_dx",
510 | function() {
511 | return this._fe
512 | });
513 | this.GetHashCode = function() {
514 | return (this._cf.ordinal() << 3) | _fe
515 | };
516 | this.Equals = function(c) {
517 | var b = c;
518 | return this._cf == b._cf && this._fe == b._fe
519 | }
520 | }
521 | _ax._gj = function(d, c) {
522 | d ^= c;
523 | return _ch[d & 15] + _ch[(_ew(d, 4) & 15)] + _ch[(_ew(d, 8) & 15)] + _ch[(_ew(d, 12) & 15)] + _ch[(_ew(d, 16) & 15)] + _ch[(_ew(d, 20) & 15)] + _ch[(_ew(d, 24) & 15)] + _ch[(_ew(d, 28) & 15)]
524 | };
525 | _ax._ci = function(a) {
526 | var b = _ax._cj(a);
527 | if (b != null) {
528 | return b
529 | }
530 | return _ax._cj(a ^ _ca)
531 | };
532 | _ax._cj = function(d) {
533 | var b = 4294967295;
534 | var a = 0;
535 | for (var c = 0; c < _cb.length; c++) {
536 | var g = _cb[c];
537 | var f = g[0];
538 | if (f == d) {
539 | return new _ax(g[1])
540 | }
541 | var e = this._gj(d, f);
542 | if (e < b) {
543 | a = g[1];
544 | b = e
545 | }
546 | }
547 | if (b <= 3) {
548 | return new _ax(a)
549 | }
550 | return null
551 | };
552 |
553 | function _cg(a, c, b) {
554 | this._ff = a;
555 | this.bits = c;
556 | this.name = b;
557 | this.__defineGetter__("Bits",
558 | function() {
559 | return this.bits
560 | });
561 | this.__defineGetter__("Name",
562 | function() {
563 | return this.name
564 | });
565 | this.ordinal = function() {
566 | return this._ff
567 | }
568 | }
569 | _cg.forBits = function(a) {
570 | if (a < 0 || a >= FOR_BITS.length) {
571 | throw "bad arguments"
572 | }
573 | return FOR_BITS[a]
574 | };
575 | var L = new _cg(0, 1, "L");
576 | var M = new _cg(1, 0, "M");
577 | var Q = new _cg(2, 3, "Q");
578 | var H = new _cg(3, 2, "H");
579 | var FOR_BITS = new Array(M, L, H, Q);
580 |
581 | function _ac(d, a) {
582 | if (!a) {
583 | a = d
584 | }
585 | if (d < 1 || a < 1) {
586 | throw "Both dimensions must be greater than 0"
587 | }
588 | this.width = d;
589 | this.height = a;
590 | var c = d >> 5;
591 | if ((d & 31) != 0) {
592 | c++
593 | }
594 | this.rowSize = c;
595 | this.bits = new Array(c * a);
596 | for (var b = 0; b < this.bits.length; b++) {
597 | this.bits[b] = 0
598 | }
599 | this.__defineGetter__("Width",
600 | function() {
601 | return this.width
602 | });
603 | this.__defineGetter__("Height",
604 | function() {
605 | return this.height
606 | });
607 | this.__defineGetter__("Dimension",
608 | function() {
609 | if (this.width != this.height) {
610 | throw "Can't call getDimension() on a non-square matrix"
611 | }
612 | return this.width
613 | });
614 | this._ds = function(e, g) {
615 | var f = g * this.rowSize + (e >> 5);
616 | return ((_ew(this.bits[f], (e & 31))) & 1) != 0
617 | };
618 | this._dq = function(e, g) {
619 | var f = g * this.rowSize + (e >> 5);
620 | this.bits[f] |= 1 << (e & 31)
621 | };
622 | this.flip = function(e, g) {
623 | var f = g * this.rowSize + (e >> 5);
624 | this.bits[f] ^= 1 << (e & 31)
625 | };
626 | this.clear = function() {
627 | var e = this.bits.length;
628 | for (var f = 0; f < e; f++) {
629 | this.bits[f] = 0
630 | }
631 | };
632 | this._bq = function(g, j, f, m) {
633 | if (j < 0 || g < 0) {
634 | throw "Left and top must be nonnegative"
635 | }
636 | if (m < 1 || f < 1) {
637 | throw "Height and width must be at least 1"
638 | }
639 | var l = g + f;
640 | var e = j + m;
641 | if (e > this.height || l > this.width) {
642 | throw "The region must fit inside the matrix"
643 | }
644 | for (var i = j; i < e; i++) {
645 | var h = i * this.rowSize;
646 | for (var k = g; k < l; k++) {
647 | this.bits[h + (k >> 5)] |= 1 << (k & 31)
648 | }
649 | }
650 | }
651 | }
652 |
653 | function _dl(a, b) {
654 | this._dv = a;
655 | this._dw = b;
656 | this.__defineGetter__("_du",
657 | function() {
658 | return this._dv
659 | });
660 | this.__defineGetter__("Codewords",
661 | function() {
662 | return this._dw
663 | })
664 | }
665 | _dl._gn = function(c, h, s) {
666 | if (c.length != h._dp) {
667 | throw "bad arguments"
668 | }
669 | var k = h._bu(s);
670 | var e = 0;
671 | var d = k._fb();
672 | for (var r = 0; r < d.length; r++) {
673 | e += d[r].Count
674 | }
675 | var l = new Array(e);
676 | var n = 0;
677 | for (var o = 0; o < d.length; o++) {
678 | var f = d[o];
679 | for (var r = 0; r < f.Count; r++) {
680 | var m = f._dm;
681 | var t = k._bo + m;
682 | l[n++] = new _dl(m, new Array(t))
683 | }
684 | }
685 | var u = l[0]._dw.length;
686 | var b = l.length - 1;
687 | while (b >= 0) {
688 | var w = l[b]._dw.length;
689 | if (w == u) {
690 | break
691 | }
692 | b--
693 | }
694 | b++;
695 | var g = u - k._bo;
696 | var a = 0;
697 | for (var r = 0; r < g; r++) {
698 | for (var o = 0; o < n; o++) {
699 | l[o]._dw[r] = c[a++]
700 | }
701 | }
702 | for (var o = b; o < n; o++) {
703 | l[o]._dw[g] = c[a++]
704 | }
705 | var q = l[0]._dw.length;
706 | for (var r = g; r < q; r++) {
707 | for (var o = 0; o < n; o++) {
708 | var v = o < b ? r : r + 1;
709 | l[o]._dw[v] = c[a++]
710 | }
711 | }
712 | return l
713 | };
714 |
715 | function _cl(a) {
716 | var b = a.Dimension;
717 | if (b < 21 || (b & 3) != 1) {
718 | throw "Error _cl"
719 | }
720 | this._au = a;
721 | this._cp = null;
722 | this._co = null;
723 | this._dk = function(d, c, e) {
724 | return this._au._ds(d, c) ? (e << 1) | 1 : e << 1
725 | };
726 | this._cm = function() {
727 | if (this._co != null) {
728 | return this._co
729 | }
730 | var g = 0;
731 | for (var e = 0; e < 6; e++) {
732 | g = this._dk(e, 8, g)
733 | }
734 | g = this._dk(7, 8, g);
735 | g = this._dk(8, 8, g);
736 | g = this._dk(8, 7, g);
737 | for (var c = 5; c >= 0; c--) {
738 | g = this._dk(8, c, g)
739 | }
740 | this._co = _ax._ci(g);
741 | if (this._co != null) {
742 | return this._co
743 | }
744 | var f = this._au.Dimension;
745 | g = 0;
746 | var d = f - 8;
747 | for (var e = f - 1; e >= d; e--) {
748 | g = this._dk(e, 8, g)
749 | }
750 | for (var c = f - 7; c < f; c++) {
751 | g = this._dk(8, c, g)
752 | }
753 | this._co = _ax._ci(g);
754 | if (this._co != null) {
755 | return this._co
756 | }
757 | throw "Error _cm"
758 | };
759 | this._cq = function() {
760 | if (this._cp != null) {
761 | return this._cp
762 | }
763 | var h = this._au.Dimension;
764 | var f = (h - 17) >> 2;
765 | if (f <= 6) {
766 | return _a3._av(f)
767 | }
768 | var g = 0;
769 | var e = h - 11;
770 | for (var c = 5; c >= 0; c--) {
771 | for (var d = h - 9; d >= e; d--) {
772 | g = this._dk(d, c, g)
773 | }
774 | }
775 | this._cp = _a3._aw(g);
776 | if (this._cp != null && this._cp._cr == h) {
777 | return this._cp
778 | }
779 | g = 0;
780 | for (var d = 5; d >= 0; d--) {
781 | for (var c = h - 9; c >= e; c--) {
782 | g = this._dk(d, c, g)
783 | }
784 | }
785 | this._cp = _a3._aw(g);
786 | if (this._cp != null && this._cp._cr == h) {
787 | return this._cp
788 | }
789 | throw "Error _cq"
790 | };
791 | this._gk = function() {
792 | var r = this._cm();
793 | var o = this._cq();
794 | var c = _dx._gl(r._dx);
795 | var f = this._au.Dimension;
796 | c._dj(this._au, f);
797 | var k = o._aq();
798 | var n = true;
799 | var s = new Array(o._dp);
800 | var m = 0;
801 | var q = 0;
802 | var h = 0;
803 | for (var e = f - 1; e > 0; e -= 2) {
804 | if (e == 6) {
805 | e--
806 | }
807 | for (var l = 0; l < f; l++) {
808 | var g = n ? f - 1 - l : l;
809 | for (var d = 0; d < 2; d++) {
810 | if (!k._ds(e - d, g)) {
811 | h++;
812 | q <<= 1;
813 | if (this._au._ds(e - d, g)) {
814 | q |= 1
815 | }
816 | if (h == 8) {
817 | s[m++] = q;
818 | h = 0;
819 | q = 0
820 | }
821 | }
822 | }
823 | }
824 | n ^= true
825 | }
826 | if (m != o._dp) {
827 | throw "Error _gk"
828 | }
829 | return s
830 | }
831 | }
832 | var _dx = {};
833 | _dx._gl = function(a) {
834 | if (a < 0 || a > 7) {
835 | throw "bad arguments"
836 | }
837 | return _dx._dy[a]
838 | };
839 |
840 | function _fg() {
841 | this._dj = function(c, d) {
842 | for (var b = 0; b < d; b++) {
843 | for (var a = 0; a < d; a++) {
844 | if (this._fw(b, a)) {
845 | c.flip(a, b)
846 | }
847 | }
848 | }
849 | };
850 | this._fw = function(b, a) {
851 | return ((b + a) & 1) == 0
852 | }
853 | }
854 |
855 | function _fh() {
856 | this._dj = function(c, d) {
857 | for (var b = 0; b < d; b++) {
858 | for (var a = 0; a < d; a++) {
859 | if (this._fw(b, a)) {
860 | c.flip(a, b)
861 | }
862 | }
863 | }
864 | };
865 | this._fw = function(b, a) {
866 | return (b & 1) == 0
867 | }
868 | }
869 |
870 | function _fi() {
871 | this._dj = function(c, d) {
872 | for (var b = 0; b < d; b++) {
873 | for (var a = 0; a < d; a++) {
874 | if (this._fw(b, a)) {
875 | c.flip(a, b)
876 | }
877 | }
878 | }
879 | };
880 | this._fw = function(b, a) {
881 | return a % 3 == 0
882 | }
883 | }
884 |
885 | function _fj() {
886 | this._dj = function(c, d) {
887 | for (var b = 0; b < d; b++) {
888 | for (var a = 0; a < d; a++) {
889 | if (this._fw(b, a)) {
890 | c.flip(a, b)
891 | }
892 | }
893 | }
894 | };
895 | this._fw = function(b, a) {
896 | return (b + a) % 3 == 0
897 | }
898 | }
899 |
900 | function _fk() {
901 | this._dj = function(c, d) {
902 | for (var b = 0; b < d; b++) {
903 | for (var a = 0; a < d; a++) {
904 | if (this._fw(b, a)) {
905 | c.flip(a, b)
906 | }
907 | }
908 | }
909 | };
910 | this._fw = function(b, a) {
911 | return (((_ew(b, 1)) + (a / 3)) & 1) == 0
912 | }
913 | }
914 |
915 | function _fl() {
916 | this._dj = function(c, d) {
917 | for (var b = 0; b < d; b++) {
918 | for (var a = 0; a < d; a++) {
919 | if (this._fw(b, a)) {
920 | c.flip(a, b)
921 | }
922 | }
923 | }
924 | };
925 | this._fw = function(c, b) {
926 | var a = c * b;
927 | return (a & 1) + (a % 3) == 0
928 | }
929 | }
930 |
931 | function _fm() {
932 | this._dj = function(c, d) {
933 | for (var b = 0; b < d; b++) {
934 | for (var a = 0; a < d; a++) {
935 | if (this._fw(b, a)) {
936 | c.flip(a, b)
937 | }
938 | }
939 | }
940 | };
941 | this._fw = function(c, b) {
942 | var a = c * b;
943 | return (((a & 1) + (a % 3)) & 1) == 0
944 | }
945 | }
946 |
947 | function _fn() {
948 | this._dj = function(c, d) {
949 | for (var b = 0; b < d; b++) {
950 | for (var a = 0; a < d; a++) {
951 | if (this._fw(b, a)) {
952 | c.flip(a, b)
953 | }
954 | }
955 | }
956 | };
957 | this._fw = function(b, a) {
958 | return ((((b + a) & 1) + ((b * a) % 3)) & 1) == 0
959 | }
960 | }
961 | _dx._dy = new Array(new _fg(), new _fh(), new _fi(), new _fj(), new _fk(), new _fl(), new _fm(), new _fn());
962 |
963 | function _db(_fa) {
964 | this._fa = _fa;
965 | this.decode = function(received, _fv) {
966 | var poly = new _bp(this._fa, received);
967 | var _dh = new Array(_fv);
968 | for (var i = 0; i < _dh.length; i++) {
969 | _dh[i] = 0
970 | }
971 | var _fq = false;
972 | var noError = true;
973 | for (var i = 0; i < _fv; i++) {
974 | var evs = poly.evaluateAt(this._fa.exp(_fq ? i + 1 : i));
975 | _dh[_dh.length - 1 - i] = evs;
976 | if (evs != 0) {
977 | noError = false
978 | }
979 | }
980 | if (noError) {
981 | return
982 | }
983 | var _fu = new _bp(this._fa, _dh);
984 | var _dg = this._eb(this._fa._ba(_fv, 1), _fu, _fv);
985 | var sigma = _dg[0];
986 | var omega = _dg[1];
987 | var _dz = this._ey(sigma);
988 | var _ea = this._di(omega, _dz, _fq);
989 | for (var i = 0; i < _dz.length; i++) {
990 | var position = received.length - 1 - this._fa.log(_dz[i]);
991 | if (position < 0) {
992 | throw "ReedSolomonException Bad error location"
993 | }
994 | received[position] = _az._bd(received[position], _ea[i])
995 | }
996 | };
997 | this._eb = function(a, b, R) {
998 | if (a._ec < b._ec) {
999 | var temp = a;
1000 | a = b;
1001 | b = temp
1002 | }
1003 | var rLast = a;
1004 | var r = b;
1005 | var sLast = this._fa.One;
1006 | var s = this._fa.Zero;
1007 | var tLast = this._fa.Zero;
1008 | var t = this._fa.One;
1009 | while (r._ec >= Math.floor(R / 2)) {
1010 | var rLastLast = rLast;
1011 | var _ga = sLast;
1012 | var _gb = tLast;
1013 | rLast = r;
1014 | sLast = s;
1015 | tLast = t;
1016 | if (rLast.Zero) {
1017 | throw "r_{i-1} was zero"
1018 | }
1019 | r = rLastLast;
1020 | var q = this._fa.Zero;
1021 | var _df = rLast._ex(rLast._ec);
1022 | var _fy = this._fa.inverse(_df);
1023 | while (r._ec >= rLast._ec && !r.Zero) {
1024 | var _fx = r._ec - rLast._ec;
1025 | var scale = this._fa.multiply(r._ex(r._ec), _fy);
1026 | q = q._bd(this._fa._ba(_fx, scale));
1027 | r = r._bd(rLast._dc(_fx, scale))
1028 | }
1029 | s = q.multiply1(sLast)._bd(_ga);
1030 | t = q.multiply1(tLast)._bd(_gb)
1031 | }
1032 | var _de = t._ex(0);
1033 | if (_de == 0) {
1034 | throw "ReedSolomonException sigmaTilde(0) was zero"
1035 | }
1036 | var inverse = this._fa.inverse(_de);
1037 | var sigma = t.multiply2(inverse);
1038 | var omega = r.multiply2(inverse);
1039 | return new Array(sigma, omega)
1040 | };
1041 | this._ey = function(_ez) {
1042 | var _fz = _ez._ec;
1043 | if (_fz == 1) {
1044 | return new Array(_ez._ex(1))
1045 | }
1046 | var result = new Array(_fz);
1047 | var e = 0;
1048 | for (var i = 1; i < 256 && e < _fz; i++) {
1049 | if (_ez.evaluateAt(i) == 0) {
1050 | result[e] = this._fa.inverse(i);
1051 | e++
1052 | }
1053 | }
1054 | if (e != _fz) {
1055 | throw "Error locator degree does not match number of roots"
1056 | }
1057 | return result
1058 | };
1059 | this._di = function(_fs, _dz, _fq) {
1060 | var s = _dz.length;
1061 | var result = new Array(s);
1062 | for (var i = 0; i < s; i++) {
1063 | var _gc = this._fa.inverse(_dz[i]);
1064 | var _dr = 1;
1065 | for (var j = 0; j < s; j++) {
1066 | if (i != j) {
1067 | _dr = this._fa.multiply(_dr, _az._bd(1, this._fa.multiply(_dz[j], _gc)))
1068 | }
1069 | }
1070 | result[i] = this._fa.multiply(_fs.evaluateAt(_gc), this._fa.inverse(_dr));
1071 | if (_fq) {
1072 | result[i] = this._fa.multiply(result[i], _gc)
1073 | }
1074 | }
1075 | return result
1076 | }
1077 | }
1078 |
1079 | function _bp(f, e) {
1080 | if (e == null || e.length == 0) {
1081 | throw "bad arguments"
1082 | }
1083 | this._fa = f;
1084 | var c = e.length;
1085 | if (c > 1 && e[0] == 0) {
1086 | var d = 1;
1087 | while (d < c && e[d] == 0) {
1088 | d++
1089 | }
1090 | if (d == c) {
1091 | this._dd = f.Zero._dd
1092 | } else {
1093 | this._dd = new Array(c - d);
1094 | for (var b = 0; b < this._dd.length; b++) {
1095 | this._dd[b] = 0
1096 | }
1097 | for (var a = 0; a < this._dd.length; a++) {
1098 | this._dd[a] = e[d + a]
1099 | }
1100 | }
1101 | } else {
1102 | this._dd = e
1103 | }
1104 | this.__defineGetter__("Zero",
1105 | function() {
1106 | return this._dd[0] == 0
1107 | });
1108 | this.__defineGetter__("_ec",
1109 | function() {
1110 | return this._dd.length - 1
1111 | });
1112 | this.__defineGetter__("Coefficients",
1113 | function() {
1114 | return this._dd
1115 | });
1116 | this._ex = function(g) {
1117 | return this._dd[this._dd.length - 1 - g]
1118 | };
1119 | this.evaluateAt = function(h) {
1120 | if (h == 0) {
1121 | return this._ex(0)
1122 | }
1123 | var l = this._dd.length;
1124 | if (h == 1) {
1125 | var g = 0;
1126 | for (var k = 0; k < l; k++) {
1127 | g = _az._bd(g, this._dd[k])
1128 | }
1129 | return g
1130 | }
1131 | var j = this._dd[0];
1132 | for (var k = 1; k < l; k++) {
1133 | j = _az._bd(this._fa.multiply(h, j), this._dd[k])
1134 | }
1135 | return j
1136 | };
1137 | this._bd = function(g) {
1138 | if (this._fa != g._fa) {
1139 | throw "GF256Polys do not have same _az _fa"
1140 | }
1141 | if (this.Zero) {
1142 | return g
1143 | }
1144 | if (g.Zero) {
1145 | return this
1146 | }
1147 | var o = this._dd;
1148 | var n = g._dd;
1149 | if (o.length > n.length) {
1150 | var j = o;
1151 | o = n;
1152 | n = j
1153 | }
1154 | var h = new Array(n.length);
1155 | var k = n.length - o.length;
1156 | for (var m = 0; m < k; m++) {
1157 | h[m] = n[m]
1158 | }
1159 | for (var l = k; l < n.length; l++) {
1160 | h[l] = _az._bd(o[l - k], n[l])
1161 | }
1162 | return new _bp(f, h)
1163 | };
1164 | this.multiply1 = function(o) {
1165 | if (this._fa != o._fa) {
1166 | throw "GF256Polys do not have same _az _fa"
1167 | }
1168 | if (this.Zero || o.Zero) {
1169 | return this._fa.Zero
1170 | }
1171 | var r = this._dd;
1172 | var g = r.length;
1173 | var l = o._dd;
1174 | var n = l.length;
1175 | var q = new Array(g + n - 1);
1176 | for (var m = 0; m < g; m++) {
1177 | var h = r[m];
1178 | for (var k = 0; k < n; k++) {
1179 | q[m + k] = _az._bd(q[m + k], this._fa.multiply(h, l[k]))
1180 | }
1181 | }
1182 | return new _bp(this._fa, q)
1183 | };
1184 | this.multiply2 = function(g) {
1185 | if (g == 0) {
1186 | return this._fa.Zero
1187 | }
1188 | if (g == 1) {
1189 | return this
1190 | }
1191 | var j = this._dd.length;
1192 | var k = new Array(j);
1193 | for (var h = 0; h < j; h++) {
1194 | k[h] = this._fa.multiply(this._dd[h], g)
1195 | }
1196 | return new _bp(this._fa, k)
1197 | };
1198 | this._dc = function(l, g) {
1199 | if (l < 0) {
1200 | throw "bad arguments"
1201 | }
1202 | if (g == 0) {
1203 | return this._fa.Zero
1204 | }
1205 | var j = this._dd.length;
1206 | var k = new Array(j + l);
1207 | for (var h = 0; h < k.length; h++) {
1208 | k[h] = 0
1209 | }
1210 | for (var h = 0; h < j; h++) {
1211 | k[h] = this._fa.multiply(this._dd[h], g)
1212 | }
1213 | return new _bp(this._fa, k)
1214 | };
1215 | this.divide = function(l) {
1216 | if (this._fa != l._fa) {
1217 | throw "GF256Polys do not have same _az _fa"
1218 | }
1219 | if (l.Zero) {
1220 | throw "Divide by 0"
1221 | }
1222 | var j = this._fa.Zero;
1223 | var o = this;
1224 | var g = l._ex(l._ec);
1225 | var n = this._fa.inverse(g);
1226 | while (o._ec >= l._ec && !o.Zero) {
1227 | var m = o._ec - l._ec;
1228 | var h = this._fa.multiply(o._ex(o._ec), n);
1229 | var i = l._dc(m, h);
1230 | var k = this._fa._ba(m, h);
1231 | j = j._bd(k);
1232 | o = o._bd(i)
1233 | }
1234 | return new Array(j, o)
1235 | }
1236 | }
1237 |
1238 | function _az(b) {
1239 | this._gh = new Array(256);
1240 | this._gi = new Array(256);
1241 | var a = 1;
1242 | for (var e = 0; e < 256; e++) {
1243 | this._gh[e] = a;
1244 | a <<= 1;
1245 | if (a >= 256) {
1246 | a ^= b
1247 | }
1248 | }
1249 | for (var e = 0; e < 255; e++) {
1250 | this._gi[this._gh[e]] = e
1251 | }
1252 | var d = new Array(1);
1253 | d[0] = 0;
1254 | this.zero = new _bp(this, new Array(d));
1255 | var c = new Array(1);
1256 | c[0] = 1;
1257 | this.one = new _bp(this, new Array(c));
1258 | this.__defineGetter__("Zero",
1259 | function() {
1260 | return this.zero
1261 | });
1262 | this.__defineGetter__("One",
1263 | function() {
1264 | return this.one
1265 | });
1266 | this._ba = function(j, f) {
1267 | if (j < 0) {
1268 | throw "bad arguments"
1269 | }
1270 | if (f == 0) {
1271 | return zero
1272 | }
1273 | var h = new Array(j + 1);
1274 | for (var g = 0; g < h.length; g++) {
1275 | h[g] = 0
1276 | }
1277 | h[0] = f;
1278 | return new _bp(this, h)
1279 | };
1280 | this.exp = function(f) {
1281 | return this._gh[f]
1282 | };
1283 | this.log = function(f) {
1284 | if (f == 0) {
1285 | throw "bad arguments"
1286 | }
1287 | return this._gi[f]
1288 | };
1289 | this.inverse = function(f) {
1290 | if (f == 0) {
1291 | throw "System.ArithmeticException"
1292 | }
1293 | return this._gh[255 - this._gi[f]]
1294 | };
1295 | this.multiply = function(g, f) {
1296 | if (g == 0 || f == 0) {
1297 | return 0
1298 | }
1299 | if (g == 1) {
1300 | return f
1301 | }
1302 | if (f == 1) {
1303 | return g
1304 | }
1305 | return this._gh[(this._gi[g] + this._gi[f]) % 255]
1306 | }
1307 | }
1308 | _az._bb = new _az(285);
1309 | _az._bc = new _az(301);
1310 | _az._bd = function(d, c) {
1311 | return d ^ c
1312 | };
1313 | var Decoder = {};
1314 | Decoder.rsDecoder = new _db(_az._bb);
1315 | Decoder.correctErrors = function(g, b) {
1316 | var d = g.length;
1317 | var f = new Array(d);
1318 | for (var e = 0; e < d; e++) {
1319 | f[e] = g[e] & 255
1320 | }
1321 | var a = g.length - b;
1322 | try {
1323 | Decoder.rsDecoder.decode(f, a)
1324 | } catch (c) {
1325 | throw c
1326 | }
1327 | for (var e = 0; e < b; e++) {
1328 | g[e] = f[e]
1329 | }
1330 | };
1331 | Decoder.decode = function(r) {
1332 | var b = new _cl(r);
1333 | var o = b._cq();
1334 | var c = b._cm()._cg;
1335 | var q = b._gk();
1336 | var a = _dl._gn(q, o, c);
1337 | var f = 0;
1338 | for (var k = 0; k < a.length; k++) {
1339 | f += a[k]._du
1340 | }
1341 | var e = new Array(f);
1342 | var n = 0;
1343 | for (var h = 0; h < a.length; h++) {
1344 | var m = a[h];
1345 | var d = m.Codewords;
1346 | var g = m._du;
1347 | Decoder.correctErrors(d, g);
1348 | for (var k = 0; k < g; k++) {
1349 | e[n++] = d[k]
1350 | }
1351 | }
1352 | var l = new QRCodeDataBlockReader(e, o._fd, c.Bits);
1353 | return l
1354 | };
1355 | var browser = {
1356 | versions: function() {
1357 | var u = navigator.userAgent,
1358 | app = navigator.appVersion;
1359 | return { //移动终端浏览器版本信息
1360 | ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
1361 | android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
1362 | iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
1363 | iPad: u.indexOf('iPad') > -1, //是否iPad
1364 | };
1365 | }(),
1366 | }
1367 |
1368 | var qrcode = {};
1369 | qrcode.imagedata = null;
1370 | qrcode.width = 0;
1371 | qrcode.height = 0;
1372 | qrcode.qrCodeSymbol = null;
1373 | qrcode.debug = false;
1374 | qrcode.maxImgSize = 1024 * 1024;
1375 | qrcode._eo = [
1376 | [10, 9, 8, 8],
1377 | [12, 11, 16, 10],
1378 | [14, 13, 16, 12]
1379 | ];
1380 | qrcode.callback = null;
1381 | qrcode.decode = function(d) {
1382 | if (arguments.length == 0) {
1383 | var b = document.getElementById("qr-canvas");
1384 | var a = b.getContext("2d");
1385 | qrcode.width = b.width;
1386 | qrcode.height = b.height;
1387 | qrcode.imagedata = a.getImageData(0, 0, qrcode.width, qrcode.height);
1388 | qrcode.result = qrcode.process(a);
1389 | if (qrcode.callback != null) {
1390 | qrcode.callback(qrcode.result)
1391 | }
1392 | return qrcode.result
1393 | } else {
1394 | var c = new Image();
1395 | c.onload = function() {
1396 | var g = document.getElementById("out-canvas");
1397 | if (g != null) {
1398 | var j = g.getContext("2d");
1399 | j.clearRect(0, 0, 320, 240);
1400 | if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {
1401 | drawImageIOSFix(j, c, 0, 0, 320, 240);
1402 | }
1403 | else{
1404 | j.drawImage(c, 0, 0, 320, 240);
1405 | }
1406 | }
1407 | var i = document.createElement("canvas");
1408 | var h = i.getContext("2d");
1409 | var f = c.height;
1410 | var l = c.width;
1411 | if (c.width * c.height > qrcode.maxImgSize) {
1412 | var k = c.width / c.height;
1413 | f = Math.sqrt(qrcode.maxImgSize / k);
1414 | l = k * f
1415 | }
1416 | i.width = l;
1417 | i.height = f;
1418 | i.style.display ="none";
1419 | var u = navigator.userAgent,
1420 | app = navigator.appVersion;
1421 | if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {
1422 | drawImageIOSFix(h, c, 0, 0, i.width, i.height);
1423 | } else {
1424 | h.drawImage(c, 0, 0, i.width, i.height);
1425 | }
1426 | qrcode.width = i.width;
1427 | qrcode.height = i.height;
1428 | try {
1429 | qrcode.imagedata = h.getImageData(0, 0, i.width, i.height)
1430 | } catch (m) {
1431 | qrcode.result = "Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!";
1432 | if (qrcode.callback != null) {
1433 | qrcode.callback(qrcode.result)
1434 | }
1435 | return
1436 | }
1437 | try {
1438 | qrcode.result = qrcode.process(h)
1439 | } catch (m) {
1440 | console.log(m);
1441 | qrcode.result = "error decoding QR Code"
1442 | }
1443 | if (qrcode.callback != null) {
1444 | qrcode.callback(qrcode.result)
1445 | }
1446 | };
1447 | c.src = d
1448 | }
1449 | };
1450 | qrcode.isUrl = function(a) {
1451 | var b = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
1452 | return b.test(a)
1453 | };
1454 | qrcode.decode_url = function(b) {
1455 | var d = "";
1456 | try {
1457 | d = escape(b)
1458 | } catch (c) {
1459 | console.log(c);
1460 | d = b
1461 | }
1462 | var a = "";
1463 | try {
1464 | a = decodeURIComponent(d)
1465 | } catch (c) {
1466 | console.log(c);
1467 | a = d
1468 | }
1469 | return a
1470 | };
1471 | qrcode.decode_utf8 = function(a) {
1472 | if (qrcode.isUrl(a)) {
1473 | return qrcode.decode_url(a)
1474 | } else {
1475 | return a
1476 | }
1477 | };
1478 | qrcode.process = function(r) {
1479 | var a = new Date().getTime();
1480 | var c = qrcode.grayScaleToBitmap(qrcode.grayscale());
1481 | if (qrcode.debug) {
1482 | for (var m = 0; m < qrcode.height; m++) {
1483 | for (var n = 0; n < qrcode.width; n++) {
1484 | var o = (n * 4) + (m * qrcode.width * 4);
1485 | qrcode.imagedata.data[o] = c[n + m * qrcode.width] ? 0 : 0;
1486 | qrcode.imagedata.data[o + 1] = c[n + m * qrcode.width] ? 0 : 0;
1487 | qrcode.imagedata.data[o + 2] = c[n + m * qrcode.width] ? 255 : 0
1488 | }
1489 | }
1490 | r.putImageData(qrcode.imagedata, 0, 0)
1491 | }
1492 | var h = new Detector(c);
1493 | var q = h.detect();
1494 | if (qrcode.debug) {
1495 | r.putImageData(qrcode.imagedata, 0, 0)
1496 | }
1497 | var k = Decoder.decode(q.bits);
1498 | var g = k.DataByte;
1499 | var l = "";
1500 | for (var f = 0; f < g.length; f++) {
1501 | for (var e = 0; e < g[f].length; e++) {
1502 | l += String.fromCharCode(g[f][e])
1503 | }
1504 | }
1505 | var d = new Date().getTime();
1506 | var b = d - a;
1507 | console.log(b);
1508 | return qrcode.decode_utf8(l)
1509 | };
1510 | qrcode.getPixel = function(a, b) {
1511 | if (qrcode.width < a) {
1512 | throw "point error"
1513 | }
1514 | if (qrcode.height < b) {
1515 | throw "point error"
1516 | }
1517 | var point = (a * 4) + (b * qrcode.width * 4);
1518 | var p = (qrcode.imagedata.data[point] * 33 + qrcode.imagedata.data[point + 1] * 34 + qrcode.imagedata.data[point + 2] * 33) / 100;
1519 | return p
1520 | };
1521 | qrcode.binarize = function(d) {
1522 | var c = new Array(qrcode.width * qrcode.height);
1523 | for (var e = 0; e < qrcode.height; e++) {
1524 | for (var b = 0; b < qrcode.width; b++) {
1525 | var a = qrcode.getPixel(b, e);
1526 | c[b + e * qrcode.width] = a <= d ? true : false
1527 | }
1528 | }
1529 | return c
1530 | };
1531 | qrcode._em = function(d) {
1532 | var c = 4;
1533 | var k = Math.floor(qrcode.width / c);
1534 | var j = Math.floor(qrcode.height / c);
1535 | var f = new Array(c);
1536 | for (var g = 0; g < c; g++) {
1537 | f[g] = new Array(c);
1538 | for (var e = 0; e < c; e++) {
1539 | f[g][e] = new Array(0, 0)
1540 | }
1541 | }
1542 | for (var o = 0; o < c; o++) {
1543 | for (var a = 0; a < c; a++) {
1544 | f[a][o][0] = 255;
1545 | for (var l = 0; l < j; l++) {
1546 | for (var n = 0; n < k; n++) {
1547 | var h = d[k * a + n + (j * o + l) * qrcode.width];
1548 | if (h < f[a][o][0]) {
1549 | f[a][o][0] = h
1550 | }
1551 | if (h > f[a][o][1]) {
1552 | f[a][o][1] = h
1553 | }
1554 | }
1555 | }
1556 | }
1557 | }
1558 | var m = new Array(c);
1559 | for (var b = 0; b < c; b++) {
1560 | m[b] = new Array(c)
1561 | }
1562 | for (var o = 0; o < c; o++) {
1563 | for (var a = 0; a < c; a++) {
1564 | m[a][o] = Math.floor((f[a][o][0] + f[a][o][1]) / 2)
1565 | }
1566 | }
1567 | return m
1568 | };
1569 | qrcode.grayScaleToBitmap = function(f) {
1570 | var j = qrcode._em(f);
1571 | var b = j.length;
1572 | var e = Math.floor(qrcode.width / b);
1573 | var d = Math.floor(qrcode.height / b);
1574 | var c = new Array(qrcode.height * qrcode.width);
1575 | for (var i = 0; i < b; i++) {
1576 | for (var a = 0; a < b; a++) {
1577 | for (var g = 0; g < d; g++) {
1578 | for (var h = 0; h < e; h++) {
1579 | c[e * a + h + (d * i + g) * qrcode.width] = (f[e * a + h + (d * i + g) * qrcode.width] < j[a][i]) ? true : false
1580 | }
1581 | }
1582 | }
1583 | }
1584 | return c
1585 | };
1586 | qrcode.grayscale = function() {
1587 | var c = new Array(qrcode.width * qrcode.height);
1588 | for (var d = 0; d < qrcode.height; d++) {
1589 | for (var b = 0; b < qrcode.width; b++) {
1590 | var a = qrcode.getPixel(b, d);
1591 | c[b + d * qrcode.width] = a
1592 | }
1593 | }
1594 | return c
1595 | };
1596 |
1597 | function _ew(a, b) {
1598 | if (a >= 0) {
1599 | return a >> b
1600 | } else {
1601 | return (a >> b) + (2 << ~b)
1602 | }
1603 | }
1604 | Array.prototype.remove = function(c, b) {
1605 | var a = this.slice((b || c) + 1 || this.length);
1606 | this.length = c < 0 ? this.length + c : c;
1607 | return this.push.apply(this, a)
1608 | };
1609 | var _gf = 3;
1610 | var _eh = 57;
1611 | var _el = 8;
1612 | var _eg = 2;
1613 | exports.qrcode = qrcode;
1614 | qrcode._er = function(c) {
1615 | function b(l, k) {
1616 | xDiff = l.X - k.X;
1617 | yDiff = l.Y - k.Y;
1618 | return Math.sqrt((xDiff * xDiff + yDiff * yDiff))
1619 | }
1620 |
1621 | function d(k, o, n) {
1622 | var m = o.x;
1623 | var l = o.y;
1624 | return ((n.x - m) * (k.y - l)) - ((n.y - l) * (k.x - m))
1625 | }
1626 | var i = b(c[0], c[1]);
1627 | var f = b(c[1], c[2]);
1628 | var e = b(c[0], c[2]);
1629 | var a, j, h;
1630 | if (f >= i && f >= e) {
1631 | j = c[0];
1632 | a = c[1];
1633 | h = c[2]
1634 | } else {
1635 | if (e >= f && e >= i) {
1636 | j = c[1];
1637 | a = c[0];
1638 | h = c[2]
1639 | } else {
1640 | j = c[2];
1641 | a = c[0];
1642 | h = c[1]
1643 | }
1644 | }
1645 | if (d(a, j, h) < 0) {
1646 | var g = a;
1647 | a = h;
1648 | h = g
1649 | }
1650 | c[0] = a;
1651 | c[1] = j;
1652 | c[2] = h
1653 | };
1654 |
1655 | function detectVerticalSquash(img) {
1656 | var iw = img.naturalWidth,
1657 | ih = img.naturalHeight;
1658 | var canvas = document.createElement('canvas');
1659 | canvas.width = 1;
1660 | canvas.height = ih;
1661 | var ctx = canvas.getContext('2d');
1662 | ctx.drawImage(img, 0, 0);
1663 | var data = ctx.getImageData(0, 0, 1, ih).data;
1664 | // search image edge pixel position in case it is squashed vertically.
1665 | var sy = 0;
1666 | var ey = ih;
1667 | var py = ih;
1668 | while (py > sy) {
1669 | var alpha = data[(py - 1) * 4 + 3];
1670 | if (alpha === 0) {
1671 | ey = py;
1672 | } else {
1673 | sy = py;
1674 | }
1675 | py = (ey + sy) >> 1;
1676 | }
1677 | var ratio = (py / ih);
1678 | return (ratio === 0) ? 1 : ratio;
1679 | }
1680 |
1681 | /**
1682 | * A replacement for context.drawImage
1683 | * (args are for source and destination).
1684 | */
1685 | function drawImageIOSFix(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {
1686 | var vertSquashRatio = detectVerticalSquash(img);
1687 | // Works only if whole image is displayed:
1688 | // ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);
1689 | // The following works correct also when only a part of the image is displayed:
1690 | ctx.drawImage(img, sx * vertSquashRatio, sy * vertSquashRatio,
1691 | sw * vertSquashRatio, sh * vertSquashRatio,
1692 | dx, dy, dw, dh);
1693 | }
1694 |
1695 | function _cz(c, a, b) {
1696 | this.x = c;
1697 | this.y = a;
1698 | this.count = 1;
1699 | this._aj = b;
1700 | this.__defineGetter__("_ei",
1701 | function() {
1702 | return this._aj
1703 | });
1704 | this.__defineGetter__("Count",
1705 | function() {
1706 | return this.count
1707 | });
1708 | this.__defineGetter__("X",
1709 | function() {
1710 | return this.x
1711 | });
1712 | this.__defineGetter__("Y",
1713 | function() {
1714 | return this.y
1715 | });
1716 | this._ek = function() {
1717 | this.count++
1718 | };
1719 | this._ev = function(f, e, d) {
1720 | if (Math.abs(e - this.y) <= f && Math.abs(d - this.x) <= f) {
1721 | var g = Math.abs(f - this._aj);
1722 | return g <= 1 || g / this._aj <= 1
1723 | }
1724 | return false
1725 | }
1726 | }
1727 |
1728 | function _es(a) {
1729 | this._go = a[0];
1730 | this._gu = a[1];
1731 | this._gr = a[2];
1732 | this.__defineGetter__("_gp",
1733 | function() {
1734 | return this._go
1735 | });
1736 | this.__defineGetter__("_gq",
1737 | function() {
1738 | return this._gu
1739 | });
1740 | this.__defineGetter__("_gs",
1741 | function() {
1742 | return this._gr
1743 | })
1744 | }
1745 |
1746 | function _cc() {
1747 | this.image = null;
1748 | this._cv = [];
1749 | this._ge = false;
1750 | this._al = new Array(0, 0, 0, 0, 0);
1751 | this._am = null;
1752 | this.__defineGetter__("_da",
1753 | function() {
1754 | this._al[0] = 0;
1755 | this._al[1] = 0;
1756 | this._al[2] = 0;
1757 | this._al[3] = 0;
1758 | this._al[4] = 0;
1759 | return this._al
1760 | });
1761 | this._ao = function(f) {
1762 | var b = 0;
1763 | for (var d = 0; d < 5; d++) {
1764 | var e = f[d];
1765 | if (e == 0) {
1766 | return false
1767 | }
1768 | b += e
1769 | }
1770 | if (b < 7) {
1771 | return false
1772 | }
1773 | var c = Math.floor((b << _el) / 7);
1774 | var a = Math.floor(c / 2);
1775 | return Math.abs(c - (f[0] << _el)) < a && Math.abs(c - (f[1] << _el)) < a && Math.abs(3 * c - (f[2] << _el)) < 3 * a && Math.abs(c - (f[3] << _el)) < a && Math.abs(c - (f[4] << _el)) < a
1776 | };
1777 | this._an = function(b, a) {
1778 | return (a - b[4] - b[3]) - b[2] / 2
1779 | };
1780 | this._ap = function(a, j, d, g) {
1781 | var c = this.image;
1782 | var h = qrcode.height;
1783 | var b = this._da;
1784 | var f = a;
1785 | while (f >= 0 && c[j + f * qrcode.width]) {
1786 | b[2]++;
1787 | f--
1788 | }
1789 | if (f < 0) {
1790 | return NaN
1791 | }
1792 | while (f >= 0 && !c[j + f * qrcode.width] && b[1] <= d) {
1793 | b[1]++;
1794 | f--
1795 | }
1796 | if (f < 0 || b[1] > d) {
1797 | return NaN
1798 | }
1799 | while (f >= 0 && c[j + f * qrcode.width] && b[0] <= d) {
1800 | b[0]++;
1801 | f--
1802 | }
1803 | if (b[0] > d) {
1804 | return NaN
1805 | }
1806 | f = a + 1;
1807 | while (f < h && c[j + f * qrcode.width]) {
1808 | b[2]++;
1809 | f++
1810 | }
1811 | if (f == h) {
1812 | return NaN
1813 | }
1814 | while (f < h && !c[j + f * qrcode.width] && b[3] < d) {
1815 | b[3]++;
1816 | f++
1817 | }
1818 | if (f == h || b[3] >= d) {
1819 | return NaN
1820 | }
1821 | while (f < h && c[j + f * qrcode.width] && b[4] < d) {
1822 | b[4]++;
1823 | f++
1824 | }
1825 | if (b[4] >= d) {
1826 | return NaN
1827 | }
1828 | var e = b[0] + b[1] + b[2] + b[3] + b[4];
1829 | if (5 * Math.abs(e - g) >= 2 * g) {
1830 | return NaN
1831 | }
1832 | return this._ao(b) ? this._an(b, f) : NaN
1833 | };
1834 | this._ej = function(b, a, e, h) {
1835 | var d = this.image;
1836 | var i = qrcode.width;
1837 | var c = this._da;
1838 | var g = b;
1839 | while (g >= 0 && d[g + a * qrcode.width]) {
1840 | c[2]++;
1841 | g--
1842 | }
1843 | if (g < 0) {
1844 | return NaN
1845 | }
1846 | while (g >= 0 && !d[g + a * qrcode.width] && c[1] <= e) {
1847 | c[1]++;
1848 | g--
1849 | }
1850 | if (g < 0 || c[1] > e) {
1851 | return NaN
1852 | }
1853 | while (g >= 0 && d[g + a * qrcode.width] && c[0] <= e) {
1854 | c[0]++;
1855 | g--
1856 | }
1857 | if (c[0] > e) {
1858 | return NaN
1859 | }
1860 | g = b + 1;
1861 | while (g < i && d[g + a * qrcode.width]) {
1862 | c[2]++;
1863 | g++
1864 | }
1865 | if (g == i) {
1866 | return NaN
1867 | }
1868 | while (g < i && !d[g + a * qrcode.width] && c[3] < e) {
1869 | c[3]++;
1870 | g++
1871 | }
1872 | if (g == i || c[3] >= e) {
1873 | return NaN
1874 | }
1875 | while (g < i && d[g + a * qrcode.width] && c[4] < e) {
1876 | c[4]++;
1877 | g++
1878 | }
1879 | if (c[4] >= e) {
1880 | return NaN
1881 | }
1882 | var f = c[0] + c[1] + c[2] + c[3] + c[4];
1883 | if (5 * Math.abs(f - h) >= h) {
1884 | return NaN
1885 | }
1886 | return this._ao(c) ? this._an(c, g) : NaN
1887 | };
1888 | this._cu = function(c, f, e) {
1889 | var d = c[0] + c[1] + c[2] + c[3] + c[4];
1890 | var n = this._an(c, e);
1891 | var b = this._ap(f, Math.floor(n), c[2], d);
1892 | if (!isNaN(b)) {
1893 | n = this._ej(Math.floor(n), Math.floor(b), c[2], d);
1894 | if (!isNaN(n)) {
1895 | var l = d / 7;
1896 | var m = false;
1897 | var h = this._cv.length;
1898 | for (var g = 0; g < h; g++) {
1899 | var a = this._cv[g];
1900 | if (a._ev(l, b, n)) {
1901 | a._ek();
1902 | m = true;
1903 | break
1904 | }
1905 | }
1906 | if (!m) {
1907 | var k = new _cz(n, b, l);
1908 | this._cv.push(k);
1909 | if (this._am != null) {
1910 | this._am._ep(k)
1911 | }
1912 | }
1913 | return true
1914 | }
1915 | }
1916 | return false
1917 | };
1918 | this._ee = function() {
1919 | var h = this._cv.length;
1920 | if (h < 3) {
1921 | throw "Couldn't find enough finder patterns"
1922 | }
1923 | if (h > 3) {
1924 | var b = 0;
1925 | var j = 0;
1926 | for (var d = 0; d < h; d++) {
1927 | var g = this._cv[d]._ei;
1928 | b += g;
1929 | j += (g * g)
1930 | }
1931 | var a = b / h;
1932 | this._cv.sort(function(m, l) {
1933 | var k = Math.abs(l._ei - a);
1934 | var i = Math.abs(m._ei - a);
1935 | if (k < i) {
1936 | return (-1)
1937 | } else {
1938 | if (k == i) {
1939 | return 0
1940 | } else {
1941 | return 1
1942 | }
1943 | }
1944 | });
1945 | var e = Math.sqrt(j / h - a * a);
1946 | var c = Math.max(0.2 * a, e);
1947 | for (var d = 0; d < this._cv.length && this._cv.length > 3; d++) {
1948 | var f = this._cv[d];
1949 | if (Math.abs(f._ei - a) > c) {
1950 | this._cv.remove(d);
1951 | d--
1952 | }
1953 | }
1954 | }
1955 | if (this._cv.length > 3) {
1956 | this._cv.sort(function(k, i) {
1957 | if (k.count > i.count) {
1958 | return -1
1959 | }
1960 | if (k.count < i.count) {
1961 | return 1
1962 | }
1963 | return 0
1964 | })
1965 | }
1966 | return new Array(this._cv[0], this._cv[1], this._cv[2])
1967 | };
1968 | this._eq = function() {
1969 | var b = this._cv.length;
1970 | if (b <= 1) {
1971 | return 0
1972 | }
1973 | var c = null;
1974 | for (var d = 0; d < b; d++) {
1975 | var a = this._cv[d];
1976 | if (a.Count >= _eg) {
1977 | if (c == null) {
1978 | c = a
1979 | } else {
1980 | this._ge = true;
1981 | return Math.floor((Math.abs(c.X - a.X) - Math.abs(c.Y - a.Y)) / 2)
1982 | }
1983 | }
1984 | }
1985 | return 0
1986 | };
1987 | this._cx = function() {
1988 | var g = 0;
1989 | var c = 0;
1990 | var a = this._cv.length;
1991 | for (var d = 0; d < a; d++) {
1992 | var f = this._cv[d];
1993 | if (f.Count >= _eg) {
1994 | g++;
1995 | c += f._ei
1996 | }
1997 | }
1998 | if (g < 3) {
1999 | return false
2000 | }
2001 | var e = c / a;
2002 | var b = 0;
2003 | for (var d = 0; d < a; d++) {
2004 | f = this._cv[d];
2005 | b += Math.abs(f._ei - e)
2006 | }
2007 | return b <= 0.05 * c
2008 | };
2009 | this._ce = function(e) {
2010 | var o = false;
2011 | this.image = e;
2012 | var n = qrcode.height;
2013 | var k = qrcode.width;
2014 | var a = Math.floor((3 * n) / (4 * _eh));
2015 | if (a < _gf || o) {
2016 | a = _gf
2017 | }
2018 | var g = false;
2019 | var d = new Array(5);
2020 | for (var h = a - 1; h < n && !g; h += a) {
2021 | d[0] = 0;
2022 | d[1] = 0;
2023 | d[2] = 0;
2024 | d[3] = 0;
2025 | d[4] = 0;
2026 | var b = 0;
2027 | for (var f = 0; f < k; f++) {
2028 | if (e[f + h * qrcode.width]) {
2029 | if ((b & 1) == 1) {
2030 | b++
2031 | }
2032 | d[b]++
2033 | } else {
2034 | if ((b & 1) == 0) {
2035 | if (b == 4) {
2036 | if (this._ao(d)) {
2037 | var c = this._cu(d, h, f);
2038 | if (c) {
2039 | a = 2;
2040 | if (this._ge) {
2041 | g = this._cx()
2042 | } else {
2043 | var m = this._eq();
2044 | if (m > d[2]) {
2045 | h += m - d[2] - a;
2046 | f = k - 1
2047 | }
2048 | }
2049 | } else {
2050 | do {
2051 | f++
2052 | } while (f < k && !e[f + h * qrcode.width]);
2053 | f--
2054 | }
2055 | b = 0;
2056 | d[0] = 0;
2057 | d[1] = 0;
2058 | d[2] = 0;
2059 | d[3] = 0;
2060 | d[4] = 0
2061 | } else {
2062 | d[0] = d[2];
2063 | d[1] = d[3];
2064 | d[2] = d[4];
2065 | d[3] = 1;
2066 | d[4] = 0;
2067 | b = 3
2068 | }
2069 | } else {
2070 | d[++b]++
2071 | }
2072 | } else {
2073 | d[b]++
2074 | }
2075 | }
2076 | }
2077 | if (this._ao(d)) {
2078 | var c = this._cu(d, h, k);
2079 | if (c) {
2080 | a = d[0];
2081 | if (this._ge) {
2082 | g = _cx()
2083 | }
2084 | }
2085 | }
2086 | }
2087 | var l = this._ee();
2088 | qrcode._er(l);
2089 | return new _es(l)
2090 | }
2091 | }
2092 |
2093 | function _ai(c, a, b) {
2094 | this.x = c;
2095 | this.y = a;
2096 | this.count = 1;
2097 | this._aj = b;
2098 | this.__defineGetter__("_ei",
2099 | function() {
2100 | return this._aj
2101 | });
2102 | this.__defineGetter__("Count",
2103 | function() {
2104 | return this.count
2105 | });
2106 | this.__defineGetter__("X",
2107 | function() {
2108 | return Math.floor(this.x)
2109 | });
2110 | this.__defineGetter__("Y",
2111 | function() {
2112 | return Math.floor(this.y)
2113 | });
2114 | this._ek = function() {
2115 | this.count++
2116 | };
2117 | this._ev = function(f, e, d) {
2118 | if (Math.abs(e - this.y) <= f && Math.abs(d - this.x) <= f) {
2119 | var g = Math.abs(f - this._aj);
2120 | return g <= 1 || g / this._aj <= 1
2121 | }
2122 | return false
2123 | }
2124 | }
2125 |
2126 | function _ak(g, c, b, f, a, e, d) {
2127 | this.image = g;
2128 | this._cv = new Array();
2129 | this.startX = c;
2130 | this.startY = b;
2131 | this.width = f;
2132 | this.height = a;
2133 | this._ef = e;
2134 | this._al = new Array(0, 0, 0);
2135 | this._am = d;
2136 | this._an = function(i, h) {
2137 | return (h - i[2]) - i[1] / 2
2138 | };
2139 | this._ao = function(l) {
2140 | var k = this._ef;
2141 | var h = k / 2;
2142 | for (var j = 0; j < 3; j++) {
2143 | if (Math.abs(k - l[j]) >= h) {
2144 | return false
2145 | }
2146 | }
2147 | return true
2148 | };
2149 | this._ap = function(h, r, l, o) {
2150 | var k = this.image;
2151 | var q = qrcode.height;
2152 | var j = this._al;
2153 | j[0] = 0;
2154 | j[1] = 0;
2155 | j[2] = 0;
2156 | var n = h;
2157 | while (n >= 0 && k[r + n * qrcode.width] && j[1] <= l) {
2158 | j[1]++;
2159 | n--
2160 | }
2161 | if (n < 0 || j[1] > l) {
2162 | return NaN
2163 | }
2164 | while (n >= 0 && !k[r + n * qrcode.width] && j[0] <= l) {
2165 | j[0]++;
2166 | n--
2167 | }
2168 | if (j[0] > l) {
2169 | return NaN
2170 | }
2171 | n = h + 1;
2172 | while (n < q && k[r + n * qrcode.width] && j[1] <= l) {
2173 | j[1]++;
2174 | n++
2175 | }
2176 | if (n == q || j[1] > l) {
2177 | return NaN
2178 | }
2179 | while (n < q && !k[r + n * qrcode.width] && j[2] <= l) {
2180 | j[2]++;
2181 | n++
2182 | }
2183 | if (j[2] > l) {
2184 | return NaN
2185 | }
2186 | var m = j[0] + j[1] + j[2];
2187 | if (5 * Math.abs(m - o) >= 2 * o) {
2188 | return NaN
2189 | }
2190 | return this._ao(j) ? this._an(j, n) : NaN
2191 | };
2192 | this._cu = function(l, o, n) {
2193 | var m = l[0] + l[1] + l[2];
2194 | var u = this._an(l, n);
2195 | var k = this._ap(o, Math.floor(u), 2 * l[1], m);
2196 | if (!isNaN(k)) {
2197 | var t = (l[0] + l[1] + l[2]) / 3;
2198 | var r = this._cv.length;
2199 | for (var q = 0; q < r; q++) {
2200 | var h = this._cv[q];
2201 | if (h._ev(t, k, u)) {
2202 | return new _ai(u, k, t)
2203 | }
2204 | }
2205 | var s = new _ai(u, k, t);
2206 | this._cv.push(s);
2207 | if (this._am != null) {
2208 | this._am._ep(s)
2209 | }
2210 | }
2211 | return null
2212 | };
2213 | this.find = function() {
2214 | var q = this.startX;
2215 | var t = this.height;
2216 | var r = q + f;
2217 | var s = b + (t >> 1);
2218 | var m = new Array(0, 0, 0);
2219 | for (var k = 0; k < t; k++) {
2220 | var o = s + ((k & 1) == 0 ? ((k + 1) >> 1) : -((k + 1) >> 1));
2221 | m[0] = 0;
2222 | m[1] = 0;
2223 | m[2] = 0;
2224 | var n = q;
2225 | while (n < r && !g[n + qrcode.width * o]) {
2226 | n++
2227 | }
2228 | var h = 0;
2229 | while (n < r) {
2230 | if (g[n + o * qrcode.width]) {
2231 | if (h == 1) {
2232 | m[h]++
2233 | } else {
2234 | if (h == 2) {
2235 | if (this._ao(m)) {
2236 | var l = this._cu(m, o, n);
2237 | if (l != null) {
2238 | return l
2239 | }
2240 | }
2241 | m[0] = m[2];
2242 | m[1] = 1;
2243 | m[2] = 0;
2244 | h = 1
2245 | } else {
2246 | m[++h]++
2247 | }
2248 | }
2249 | } else {
2250 | if (h == 1) {
2251 | h++
2252 | }
2253 | m[h]++
2254 | }
2255 | n++
2256 | }
2257 | if (this._ao(m)) {
2258 | var l = this._cu(m, o, r);
2259 | if (l != null) {
2260 | return l
2261 | }
2262 | }
2263 | }
2264 | if (!(this._cv.length == 0)) {
2265 | return this._cv[0]
2266 | }
2267 | throw "Couldn't find enough alignment patterns"
2268 | }
2269 | }
2270 |
2271 | function QRCodeDataBlockReader(c, a, b) {
2272 | this._ed = 0;
2273 | this._cw = 7;
2274 | this.dataLength = 0;
2275 | this.blocks = c;
2276 | this._en = b;
2277 | if (a <= 9) {
2278 | this.dataLengthMode = 0
2279 | } else {
2280 | if (a >= 10 && a <= 26) {
2281 | this.dataLengthMode = 1
2282 | } else {
2283 | if (a >= 27 && a <= 40) {
2284 | this.dataLengthMode = 2
2285 | }
2286 | }
2287 | }
2288 | this._gd = function(f) {
2289 | var k = 0;
2290 | if (f < this._cw + 1) {
2291 | var m = 0;
2292 | for (var e = 0; e < f; e++) {
2293 | m += (1 << e)
2294 | }
2295 | m <<= (this._cw - f + 1);
2296 | k = (this.blocks[this._ed] & m) >> (this._cw - f + 1);
2297 | this._cw -= f;
2298 | return k
2299 | } else {
2300 | if (f < this._cw + 1 + 8) {
2301 | var j = 0;
2302 | for (var e = 0; e < this._cw + 1; e++) {
2303 | j += (1 << e)
2304 | }
2305 | k = (this.blocks[this._ed] & j) << (f - (this._cw + 1));
2306 | this._ed++;
2307 | k += ((this.blocks[this._ed]) >> (8 - (f - (this._cw + 1))));
2308 | this._cw = this._cw - f % 8;
2309 | if (this._cw < 0) {
2310 | this._cw = 8 + this._cw
2311 | }
2312 | return k
2313 | } else {
2314 | if (f < this._cw + 1 + 16) {
2315 | var j = 0;
2316 | var h = 0;
2317 | for (var e = 0; e < this._cw + 1; e++) {
2318 | j += (1 << e)
2319 | }
2320 | var g = (this.blocks[this._ed] & j) << (f - (this._cw + 1));
2321 | this._ed++;
2322 | var d = this.blocks[this._ed] << (f - (this._cw + 1 + 8));
2323 | this._ed++;
2324 | for (var e = 0; e < f - (this._cw + 1 + 8); e++) {
2325 | h += (1 << e)
2326 | }
2327 | h <<= 8 - (f - (this._cw + 1 + 8));
2328 | var l = (this.blocks[this._ed] & h) >> (8 - (f - (this._cw + 1 + 8)));
2329 | k = g + d + l;
2330 | this._cw = this._cw - (f - 8) % 8;
2331 | if (this._cw < 0) {
2332 | this._cw = 8 + this._cw
2333 | }
2334 | return k
2335 | } else {
2336 | return 0
2337 | }
2338 | }
2339 | }
2340 | };
2341 | this.NextMode = function() {
2342 | if ((this._ed > this.blocks.length - this._en - 2)) {
2343 | return 0
2344 | } else {
2345 | return this._gd(4)
2346 | }
2347 | };
2348 | this.getDataLength = function(d) {
2349 | var e = 0;
2350 | while (true) {
2351 | if ((d >> e) == 1) {
2352 | break
2353 | }
2354 | e++
2355 | }
2356 | return this._gd(qrcode._eo[this.dataLengthMode][e])
2357 | };
2358 | this.getRomanAndFigureString = function(h) {
2359 | var f = h;
2360 | var g = 0;
2361 | var j = "";
2362 | var d = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", " ", "$", "%", "*", "+", "-", ".", "/", ":");
2363 | do {
2364 | if (f > 1) {
2365 | g = this._gd(11);
2366 | var i = Math.floor(g / 45);
2367 | var e = g % 45;
2368 | j += d[i];
2369 | j += d[e];
2370 | f -= 2
2371 | } else {
2372 | if (f == 1) {
2373 | g = this._gd(6);
2374 | j += d[g];
2375 | f -= 1
2376 | }
2377 | }
2378 | } while (f > 0);
2379 | return j
2380 | };
2381 | this.getFigureString = function(f) {
2382 | var d = f;
2383 | var e = 0;
2384 | var g = "";
2385 | do {
2386 | if (d >= 3) {
2387 | e = this._gd(10);
2388 | if (e < 100) {
2389 | g += "0"
2390 | }
2391 | if (e < 10) {
2392 | g += "0"
2393 | }
2394 | d -= 3
2395 | } else {
2396 | if (d == 2) {
2397 | e = this._gd(7);
2398 | if (e < 10) {
2399 | g += "0"
2400 | }
2401 | d -= 2
2402 | } else {
2403 | if (d == 1) {
2404 | e = this._gd(4);
2405 | d -= 1
2406 | }
2407 | }
2408 | }
2409 | g += e
2410 | } while (d > 0);
2411 | return g
2412 | };
2413 | this.get8bitByteArray = function(g) {
2414 | var e = g;
2415 | var f = 0;
2416 | var d = new Array();
2417 | do {
2418 | f = this._gd(8);
2419 | d.push(f);
2420 | e--
2421 | } while (e > 0);
2422 | return d
2423 | };
2424 | this.getKanjiString = function(j) {
2425 | var g = j;
2426 | var i = 0;
2427 | var h = "";
2428 | do {
2429 | i = _gd(13);
2430 | var e = i % 192;
2431 | var f = i / 192;
2432 | var k = (f << 8) + e;
2433 | var d = 0;
2434 | if (k + 33088 <= 40956) {
2435 | d = k + 33088
2436 | } else {
2437 | d = k + 49472
2438 | }
2439 | h += String.fromCharCode(d);
2440 | g--
2441 | } while (g > 0);
2442 | return h
2443 | };
2444 | this.__defineGetter__("DataByte",
2445 | function() {
2446 | var g = new Array();
2447 | var e = 1;
2448 | var f = 2;
2449 | var d = 4;
2450 | var n = 8;
2451 | do {
2452 | var k = this.NextMode();
2453 | if (k == 0) {
2454 | if (g.length > 0) {
2455 | break
2456 | } else {
2457 | throw "Empty data block"
2458 | }
2459 | }
2460 | if (k != e && k != f && k != d && k != n) {
2461 | throw "Invalid mode: " + k + " in (block:" + this._ed + " bit:" + this._cw + ")"
2462 | }
2463 | var dataLength = this.getDataLength(k);
2464 | if (dataLength < 1) {
2465 | throw "Invalid data length: " + dataLength
2466 | }
2467 | switch (k) {
2468 | case e:
2469 | var l = this.getFigureString(dataLength);
2470 | var i = new Array(l.length);
2471 | for (var h = 0; h < l.length; h++) {
2472 | i[h] = l.charCodeAt(h)
2473 | }
2474 | g.push(i);
2475 | break;
2476 | case f:
2477 | var l = this.getRomanAndFigureString(dataLength);
2478 | var i = new Array(l.length);
2479 | for (var h = 0; h < l.length; h++) {
2480 | i[h] = l.charCodeAt(h)
2481 | }
2482 | g.push(i);
2483 | break;
2484 | case d:
2485 | var m = this.get8bitByteArray(dataLength);
2486 | g.push(m);
2487 | break;
2488 | case n:
2489 | var l = this.getKanjiString(dataLength);
2490 | g.push(l);
2491 | break
2492 | }
2493 | } while (true);
2494 | return g
2495 | })
2496 | };
2497 |
--------------------------------------------------------------------------------