├── front-vue
├── static
│ └── .gitkeep
├── .eslintignore
├── config
│ ├── prod.env.js
│ ├── dev.env.js
│ └── index.js
├── favicon.ico
├── src
│ ├── assets
│ │ ├── logo.png
│ │ ├── image
│ │ │ ├── arrow-open.png
│ │ │ ├── icon-add.png
│ │ │ ├── icon-share.png
│ │ │ └── arrow-close.png
│ │ └── CodeMirror
│ │ │ ├── lib
│ │ │ ├── codemirror.js
│ │ │ ├── edit
│ │ │ │ ├── utils.js
│ │ │ │ ├── deleteNearSelection.js
│ │ │ │ ├── global_events.js
│ │ │ │ ├── fromTextArea.js
│ │ │ │ ├── main.js
│ │ │ │ └── legacy.js
│ │ │ ├── line
│ │ │ │ ├── saw_special_spans.js
│ │ │ │ ├── pos.js
│ │ │ │ └── utils_line.js
│ │ │ ├── display
│ │ │ │ ├── mode_state.js
│ │ │ │ ├── gutters.js
│ │ │ │ ├── focus.js
│ │ │ │ ├── line_numbers.js
│ │ │ │ ├── highlight_worker.js
│ │ │ │ └── update_lines.js
│ │ │ ├── input
│ │ │ │ ├── keynames.js
│ │ │ │ └── indent.js
│ │ │ ├── measurement
│ │ │ │ └── widgets.js
│ │ │ ├── util
│ │ │ │ ├── browser.js
│ │ │ │ ├── operation_group.js
│ │ │ │ ├── StringStream.js
│ │ │ │ ├── feature_detection.js
│ │ │ │ ├── dom.js
│ │ │ │ └── event.js
│ │ │ ├── model
│ │ │ │ ├── change_measurement.js
│ │ │ │ ├── selection.js
│ │ │ │ ├── line_widget.js
│ │ │ │ └── document_data.js
│ │ │ └── modes.js
│ │ │ ├── addon
│ │ │ ├── display
│ │ │ │ ├── fullscreen.css
│ │ │ │ ├── fullscreen.js
│ │ │ │ ├── autorefresh.js
│ │ │ │ ├── rulers.js
│ │ │ │ ├── placeholder.js
│ │ │ │ └── panel.js
│ │ │ ├── search
│ │ │ │ ├── matchesonscrollbar.css
│ │ │ │ ├── jump-to-line.js
│ │ │ │ └── matchesonscrollbar.js
│ │ │ ├── fold
│ │ │ │ ├── foldgutter.css
│ │ │ │ ├── markdown-fold.js
│ │ │ │ ├── indent-fold.js
│ │ │ │ ├── comment-fold.js
│ │ │ │ └── brace-fold.js
│ │ │ ├── dialog
│ │ │ │ └── dialog.css
│ │ │ ├── hint
│ │ │ │ ├── show-hint.css
│ │ │ │ ├── anyword-hint.js
│ │ │ │ └── css-hint.js
│ │ │ ├── mode
│ │ │ │ ├── multiplex_test.js
│ │ │ │ ├── loadmode.js
│ │ │ │ └── overlay.js
│ │ │ ├── lint
│ │ │ │ ├── json-lint.js
│ │ │ │ ├── yaml-lint.js
│ │ │ │ ├── css-lint.js
│ │ │ │ ├── coffeescript-lint.js
│ │ │ │ ├── html-lint.js
│ │ │ │ └── lint.css
│ │ │ ├── edit
│ │ │ │ ├── trailingspace.js
│ │ │ │ ├── continuelist.js
│ │ │ │ └── matchtags.js
│ │ │ ├── tern
│ │ │ │ ├── worker.js
│ │ │ │ └── tern.css
│ │ │ ├── runmode
│ │ │ │ ├── colorize.js
│ │ │ │ └── runmode.js
│ │ │ ├── scroll
│ │ │ │ ├── simplescrollbars.css
│ │ │ │ └── scrollpastend.js
│ │ │ ├── selection
│ │ │ │ ├── active-line.js
│ │ │ │ ├── selection-pointer.js
│ │ │ │ └── mark-selection.js
│ │ │ ├── comment
│ │ │ │ └── continuecomment.js
│ │ │ └── merge
│ │ │ │ └── merge.css
│ │ │ └── theme
│ │ │ ├── blackboard.css
│ │ │ └── erlang-dark.css
│ ├── router
│ │ └── index.js
│ ├── store
│ │ ├── index.js
│ │ ├── api.js
│ │ └── fetch.js
│ ├── App.vue
│ ├── main.js
│ ├── plugin
│ │ └── CommonUtil.js
│ └── components
│ │ ├── popWindow.vue
│ │ ├── popAlert.vue
│ │ └── popShare.vue
├── .gitignore
├── .editorconfig
├── .postcssrc.js
├── index.html
├── .babelrc
├── build
│ ├── dev-client.js
│ ├── vue-loader.conf.js
│ ├── build.js
│ ├── webpack.dev.conf.js
│ ├── check-versions.js
│ ├── webpack.base.conf.js
│ ├── utils.js
│ ├── dev-server.js
│ └── webpack.prod.conf.js
├── README.md
├── .eslintrc.js
└── package.json
├── image
├── 1.png
├── 2.png
└── 3.png
├── JsBox
├── file
│ └── code
│ │ └── javascript
│ │ ├── temp
│ │ └── 11111111111111111
│ │ └── online
│ │ ├── 11111111111111111
│ │ └── 11111111111
├── views
│ ├── index.jade
│ ├── error.jade
│ └── layout.jade
├── routes
│ ├── users.js
│ └── index.js
├── public
│ ├── index.html
│ └── static
│ │ └── js
│ │ ├── manifest.67d95f4f2bac744a9e68.js
│ │ └── manifest.fe0b79a8fde277e7b4cf.js
├── package.json
├── app.js
├── bin
│ └── www
├── service
│ └── verifyCode.js
└── npm-debug.log
└── README.md
/front-vue/static/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/image/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wobudapai/JsBox/HEAD/image/1.png
--------------------------------------------------------------------------------
/image/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wobudapai/JsBox/HEAD/image/2.png
--------------------------------------------------------------------------------
/image/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wobudapai/JsBox/HEAD/image/3.png
--------------------------------------------------------------------------------
/JsBox/file/code/javascript/temp/11111111111111111:
--------------------------------------------------------------------------------
1 | function test (a) {var sss = a}
2 |
--------------------------------------------------------------------------------
/front-vue/.eslintignore:
--------------------------------------------------------------------------------
1 | build/*.js
2 | config/*.js
3 | src/assets/*
4 | src/store/*
5 |
--------------------------------------------------------------------------------
/front-vue/config/prod.env.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NODE_ENV: '"production"'
3 | }
4 |
--------------------------------------------------------------------------------
/front-vue/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wobudapai/JsBox/HEAD/front-vue/favicon.ico
--------------------------------------------------------------------------------
/JsBox/file/code/javascript/online/11111111111111111:
--------------------------------------------------------------------------------
1 | function test (a) {
2 | var sss = a
3 | }
4 |
--------------------------------------------------------------------------------
/JsBox/views/index.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= title
5 | p Welcome to #{title}
6 |
--------------------------------------------------------------------------------
/front-vue/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wobudapai/JsBox/HEAD/front-vue/src/assets/logo.png
--------------------------------------------------------------------------------
/front-vue/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | dist/
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
--------------------------------------------------------------------------------
/JsBox/views/error.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= message
5 | h2= error.status
6 | pre #{error.stack}
7 |
--------------------------------------------------------------------------------
/front-vue/src/assets/image/arrow-open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wobudapai/JsBox/HEAD/front-vue/src/assets/image/arrow-open.png
--------------------------------------------------------------------------------
/front-vue/src/assets/image/icon-add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wobudapai/JsBox/HEAD/front-vue/src/assets/image/icon-add.png
--------------------------------------------------------------------------------
/front-vue/src/assets/image/icon-share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wobudapai/JsBox/HEAD/front-vue/src/assets/image/icon-share.png
--------------------------------------------------------------------------------
/JsBox/file/code/javascript/online/11111111111:
--------------------------------------------------------------------------------
1 | function test (a) {
2 | var sss = a
3 | console.log(sss)
4 | }
5 | console.log('ssss')
--------------------------------------------------------------------------------
/front-vue/src/assets/image/arrow-close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wobudapai/JsBox/HEAD/front-vue/src/assets/image/arrow-close.png
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/codemirror.js:
--------------------------------------------------------------------------------
1 | import { CodeMirror } from "./edit/main"
2 |
3 | global.CodeMirror = CodeMirror
4 |
5 | export default CodeMirror
6 |
--------------------------------------------------------------------------------
/JsBox/views/layout.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | title= title
5 | link(rel='stylesheet', href='/stylesheets/style.css')
6 | body
7 | block content
8 |
--------------------------------------------------------------------------------
/front-vue/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 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/display/fullscreen.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-fullscreen {
2 | position: fixed;
3 | top: 0; left: 0; right: 0; bottom: 0;
4 | height: auto;
5 | z-index: 9;
6 | }
7 |
--------------------------------------------------------------------------------
/front-vue/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/front-vue/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | // to edit target browsers: use "browserlist" field in package.json
6 | "autoprefixer": {}
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/JsBox/routes/users.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | /* GET users listing. */
5 | router.get('/', function(req, res, next) {
6 | res.send('respond with a resource');
7 | });
8 |
9 | module.exports = router;
10 |
--------------------------------------------------------------------------------
/front-vue/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JsBox
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/search/matchesonscrollbar.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-search-match {
2 | background: gold;
3 | border-top: 1px solid orange;
4 | border-bottom: 1px solid orange;
5 | -moz-box-sizing: border-box;
6 | box-sizing: border-box;
7 | opacity: .5;
8 | }
9 |
--------------------------------------------------------------------------------
/front-vue/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", { "modules": false }],
4 | "stage-2"
5 | ],
6 | "plugins": ["transform-runtime"],
7 | "comments": false,
8 | "env": {
9 | "test": {
10 | "presets": ["env", "stage-2"],
11 | "plugins": [ "istanbul" ]
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/front-vue/build/dev-client.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | require('eventsource-polyfill')
3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4 |
5 | hotClient.subscribe(function (event) {
6 | if (event.action === 'reload') {
7 | window.location.reload()
8 | }
9 | })
10 |
--------------------------------------------------------------------------------
/front-vue/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import Home from '@/components/Home'
4 |
5 | Vue.use(Router)
6 |
7 | export default new Router({
8 | routes: [
9 | {
10 | path: '/',
11 | name: 'Home',
12 | component: Home
13 | }
14 | ]
15 | })
16 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/edit/utils.js:
--------------------------------------------------------------------------------
1 | import { clearCaches } from "../measurement/position_measurement"
2 |
3 | export function themeChanged(cm) {
4 | cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
5 | cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-")
6 | clearCaches(cm)
7 | }
8 |
--------------------------------------------------------------------------------
/front-vue/src/store/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by zy on 2016/12/15.
3 | */
4 | import Vuex from 'vuex'
5 | import Vue from 'vue'
6 |
7 | import api from './api'
8 |
9 | Vue.use(Vuex)
10 |
11 | export default new Vuex.Store({
12 | strict: process.env.NODE_ENV !== 'production',
13 | modules: {
14 | api
15 | }
16 | })
17 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/line/saw_special_spans.js:
--------------------------------------------------------------------------------
1 | // Optimize some code when these features are not used.
2 | export let sawReadOnlySpans = false, sawCollapsedSpans = false
3 |
4 | export function seeReadOnlySpans() {
5 | sawReadOnlySpans = true
6 | }
7 |
8 | export function seeCollapsedSpans() {
9 | sawCollapsedSpans = true
10 | }
11 |
--------------------------------------------------------------------------------
/front-vue/build/vue-loader.conf.js:
--------------------------------------------------------------------------------
1 | var utils = require('./utils')
2 | var config = require('../config/index')
3 | var isProduction = process.env.NODE_ENV === 'production'
4 |
5 | module.exports = {
6 | loaders: utils.cssLoaders({
7 | sourceMap: isProduction
8 | ? config.build.productionSourceMap
9 | : config.dev.cssSourceMap,
10 | extract: isProduction
11 | })
12 | }
13 |
--------------------------------------------------------------------------------
/JsBox/public/index.html:
--------------------------------------------------------------------------------
1 | JsBox
--------------------------------------------------------------------------------
/JsBox/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "code-editor",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "body-parser": "~1.15.2",
10 | "cookie-parser": "~1.4.3",
11 | "cors": "^2.8.3",
12 | "crypto": "0.0.3",
13 | "debug": "~2.2.0",
14 | "express": "~4.14.0",
15 | "fs": "0.0.1-security",
16 | "jade": "~1.11.0",
17 | "morgan": "~1.7.0",
18 | "path": "^0.12.7",
19 | "serve-favicon": "~2.3.0"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/front-vue/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
27 |
--------------------------------------------------------------------------------
/front-vue/README.md:
--------------------------------------------------------------------------------
1 | # vue-os
2 |
3 | > A Vue.js project
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 |
17 | # build for production and view the bundle analyzer report
18 | npm run build --report
19 | ```
20 |
21 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
22 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/fold/foldgutter.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-foldmarker {
2 | color: blue;
3 | text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
4 | font-family: arial;
5 | line-height: .3;
6 | cursor: pointer;
7 | }
8 | .CodeMirror-foldgutter {
9 | width: .7em;
10 | }
11 | .CodeMirror-foldgutter-open,
12 | .CodeMirror-foldgutter-folded {
13 | cursor: pointer;
14 | }
15 | .CodeMirror-foldgutter-open:after {
16 | content: "\25BE";
17 | }
18 | .CodeMirror-foldgutter-folded:after {
19 | content: "\25B8";
20 | }
21 |
--------------------------------------------------------------------------------
/front-vue/src/store/api.js:
--------------------------------------------------------------------------------
1 | import { post, get } from './fetch.js'
2 |
3 | const api = {
4 | add: '/add',
5 | codeList: '/codeList',
6 | codeDetail: '/codeDetail',
7 | getVerify: '/verify'
8 | }
9 |
10 | export default {
11 | actions: {
12 | add: ({ state }, data) => {
13 | return post(api.add, data)
14 | },
15 | codeList: ( ) => {
16 | return get(api.codeList)
17 | },
18 | codeDetail: ({ state }, id) => {
19 | return get(api.codeDetail, { id })
20 | },
21 | getVerify: ( ) => {
22 | return get(api.getVerify)
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/dialog/dialog.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-dialog {
2 | position: absolute;
3 | left: 0; right: 0;
4 | background: inherit;
5 | z-index: 15;
6 | padding: .1em .8em;
7 | overflow: hidden;
8 | color: inherit;
9 | }
10 |
11 | .CodeMirror-dialog-top {
12 | border-bottom: 1px solid #eee;
13 | top: 0;
14 | }
15 |
16 | .CodeMirror-dialog-bottom {
17 | border-top: 1px solid #eee;
18 | bottom: 0;
19 | }
20 |
21 | .CodeMirror-dialog input {
22 | border: none;
23 | outline: none;
24 | background: transparent;
25 | width: 20em;
26 | color: inherit;
27 | font-family: monospace;
28 | }
29 |
30 | .CodeMirror-dialog button {
31 | font-size: 70%;
32 | }
33 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/display/mode_state.js:
--------------------------------------------------------------------------------
1 | import { getMode } from "../modes"
2 |
3 | import { startWorker } from "./highlight_worker"
4 | import { regChange } from "./view_tracking"
5 |
6 | // Used to get the editor into a consistent state again when options change.
7 |
8 | export function loadMode(cm) {
9 | cm.doc.mode = getMode(cm.options, cm.doc.modeOption)
10 | resetModeState(cm)
11 | }
12 |
13 | export function resetModeState(cm) {
14 | cm.doc.iter(line => {
15 | if (line.stateAfter) line.stateAfter = null
16 | if (line.styles) line.styles = null
17 | })
18 | cm.doc.frontier = cm.doc.first
19 | startWorker(cm, 100)
20 | cm.state.modeGen++
21 | if (cm.curOp) regChange(cm)
22 | }
23 |
--------------------------------------------------------------------------------
/front-vue/src/main.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue'
4 | import App from './App'
5 | import router from './router'
6 | import store from './store/'
7 | import axios from 'axios'
8 | import CommUtil from './plugin/CommonUtil'
9 |
10 | Vue.config.productionTip = false
11 |
12 | Vue.use(CommUtil)
13 |
14 | global.axios = axios
15 | // axios.defaults.baseURL = 'http://code.smallcfj.club/api'
16 | axios.defaults.baseURL = 'http://localhost:3005/api'
17 |
18 | /* eslint-disable no-new */
19 | new Vue({
20 | el: '#app',
21 | router,
22 | store,
23 | template: '',
24 | components: { App }
25 | })
26 |
--------------------------------------------------------------------------------
/front-vue/.eslintrc.js:
--------------------------------------------------------------------------------
1 | // http://eslint.org/docs/user-guide/configuring
2 |
3 | module.exports = {
4 | root: true,
5 | parser: 'babel-eslint',
6 | parserOptions: {
7 | sourceType: 'module'
8 | },
9 | env: {
10 | browser: true,
11 | },
12 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
13 | extends: 'standard',
14 | // required to lint *.vue files
15 | plugins: [
16 | 'html'
17 | ],
18 | // add your custom rules here
19 | 'rules': {
20 | // allow paren-less arrow functions
21 | 'arrow-parens': 0,
22 | // allow async-await
23 | 'generator-star-spacing': 0,
24 | // allow debugger during development
25 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
26 | 'no-eval': 0
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/hint/show-hint.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-hints {
2 | position: absolute;
3 | z-index: 10;
4 | overflow: hidden;
5 | list-style: none;
6 |
7 | margin: 0;
8 | padding: 2px;
9 |
10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2);
13 | border-radius: 3px;
14 | border: 1px solid silver;
15 |
16 | background: white;
17 | font-size: 90%;
18 | font-family: monospace;
19 |
20 | max-height: 20em;
21 | overflow-y: auto;
22 | }
23 |
24 | .CodeMirror-hint {
25 | margin: 0;
26 | padding: 0 4px;
27 | border-radius: 2px;
28 | white-space: pre;
29 | color: black;
30 | cursor: pointer;
31 | }
32 |
33 | li.CodeMirror-hint-active {
34 | background: #08f;
35 | color: white;
36 | }
37 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # JsBox
2 | [点击预览](http://code.smallcfj.club)
3 |
4 | 采用Vue+nodejs实现的在线Js编辑器,前后台通过接口进行访问,可以在线编辑、保存、分享Js代码,实现了简单的响应式。
5 | 前台:vue
6 | 后台:nodejs、文件存储
7 | ## 界面预览
8 |
9 | 深色风格界面(装逼专用(〃'▽'〃))
10 |
11 | 
12 |
13 | 左边可以收起来,中间的横条可以上下拉动噢
14 |
15 | 
16 |
17 | 为了防止重复提交,搞了个简单的验证码--诗歌验证
18 |
19 | 
20 | ## 运行
21 | 下载项目到本地,里面有两个文件夹:
22 |
23 | front-vue:采用vue实现的简单单页应用,访问接口与后台通信
24 |
25 | JsBox:项目后台,主要采用文件的方式存储信息
26 |
27 | 1、进入JsBox文件夹
28 | ```javascript
29 |
30 | // 安装项目的依赖包
31 | npm install
32 |
33 | // 运行
34 | npm start
35 | ```
36 |
37 | 2、进入front-vue文件夹
38 | ```javascript
39 | // 安装项目的依赖包
40 | npm install
41 |
42 | // 运行
43 | npm run dev
44 | ```
45 | ## 发布
46 | 1、进入front-vue文件夹
47 | ```javascript
48 | // 编译(压缩)
49 | npm run build
50 | ```
51 | 2、将dist文件夹中生成的文件全部拷贝到JsBox/public文件夹中,然后发布该node项目即可
52 |
--------------------------------------------------------------------------------
/front-vue/src/plugin/CommonUtil.js:
--------------------------------------------------------------------------------
1 | export default {
2 | install: function (Vue) {
3 | Vue.prototype.$util = {
4 | parseDate: function (timp, fmt) {
5 | var date = new Date(timp * 1000)
6 | var o = {
7 | 'M+': date.getMonth() + 1, // 月份
8 | 'd+': date.getDate(), // 日
9 | 'h+': date.getHours(), // 小时
10 | 'm+': date.getMinutes(), // 分
11 | 's+': date.getSeconds(), // 秒
12 | 'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
13 | 'S': date.getMilliseconds() // 毫秒
14 | }
15 | if (/(y+)/.test(fmt)) {
16 | fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
17 | }
18 | for (var k in o) {
19 | if (new RegExp('(' + k + ')').test(fmt)) {
20 | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
21 | }
22 | }
23 | return fmt
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/mode/multiplex_test.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function() {
5 | CodeMirror.defineMode("markdown_with_stex", function(){
6 | var inner = CodeMirror.getMode({}, "stex");
7 | var outer = CodeMirror.getMode({}, "markdown");
8 |
9 | var innerOptions = {
10 | open: '$',
11 | close: '$',
12 | mode: inner,
13 | delimStyle: 'delim',
14 | innerStyle: 'inner'
15 | };
16 |
17 | return CodeMirror.multiplexingMode(outer, innerOptions);
18 | });
19 |
20 | var mode = CodeMirror.getMode({}, "markdown_with_stex");
21 |
22 | function MT(name) {
23 | test.mode(
24 | name,
25 | mode,
26 | Array.prototype.slice.call(arguments, 1),
27 | 'multiplexing');
28 | }
29 |
30 | MT(
31 | "stexInsideMarkdown",
32 | "[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]");
33 | })();
34 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/input/keynames.js:
--------------------------------------------------------------------------------
1 | export let keyNames = {
2 | 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
3 | 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
4 | 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
5 | 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
6 | 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
7 | 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
8 | 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
9 | 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
10 | }
11 |
12 | // Number keys
13 | for (let i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i)
14 | // Alphabetic keys
15 | for (let i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i)
16 | // Function keys
17 | for (let i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i
18 |
--------------------------------------------------------------------------------
/front-vue/build/build.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 |
3 | process.env.NODE_ENV = 'production'
4 |
5 | var ora = require('ora')
6 | var rm = require('rimraf')
7 | var path = require('path')
8 | var chalk = require('chalk')
9 | var webpack = require('webpack')
10 | var config = require('../config/index')
11 | var webpackConfig = require('./webpack.prod.conf')
12 |
13 | var spinner = ora('building for production...')
14 | spinner.start()
15 |
16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
17 | if (err) throw err
18 | webpack(webpackConfig, function (err, stats) {
19 | spinner.stop()
20 | if (err) throw err
21 | process.stdout.write(stats.toString({
22 | colors: true,
23 | modules: false,
24 | children: false,
25 | chunks: false,
26 | chunkModules: false
27 | }) + '\n\n')
28 |
29 | console.log(chalk.cyan(' Build complete.\n'))
30 | console.log(chalk.yellow(
31 | ' Tip: built files are meant to be served over an HTTP server.\n' +
32 | ' Opening index.html over file:// won\'t work.\n'
33 | ))
34 | })
35 | })
36 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/lint/json-lint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Depends on jsonlint.js from https://github.com/zaach/jsonlint
5 |
6 | // declare global: jsonlint
7 |
8 | (function(mod) {
9 | if (typeof exports == "object" && typeof module == "object") // CommonJS
10 | mod(require("../../lib/codemirror"));
11 | else if (typeof define == "function" && define.amd) // AMD
12 | define(["../../lib/codemirror"], mod);
13 | else // Plain browser env
14 | mod(CodeMirror);
15 | })(function(CodeMirror) {
16 | "use strict";
17 |
18 | CodeMirror.registerHelper("lint", "json", function(text) {
19 | var found = [];
20 | jsonlint.parseError = function(str, hash) {
21 | var loc = hash.loc;
22 | found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
23 | to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
24 | message: str});
25 | };
26 | try { jsonlint.parse(text); }
27 | catch(e) {}
28 | return found;
29 | });
30 |
31 | });
32 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/edit/trailingspace.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) {
13 | if (prev == CodeMirror.Init) prev = false;
14 | if (prev && !val)
15 | cm.removeOverlay("trailingspace");
16 | else if (!prev && val)
17 | cm.addOverlay({
18 | token: function(stream) {
19 | for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {}
20 | if (i > stream.pos) { stream.pos = i; return null; }
21 | stream.pos = l;
22 | return "trailingspace";
23 | },
24 | name: "trailingspace"
25 | });
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/measurement/widgets.js:
--------------------------------------------------------------------------------
1 | import { contains, elt, removeChildrenAndAdd } from "../util/dom"
2 | import { e_target } from "../util/event"
3 |
4 | export function widgetHeight(widget) {
5 | if (widget.height != null) return widget.height
6 | let cm = widget.doc.cm
7 | if (!cm) return 0
8 | if (!contains(document.body, widget.node)) {
9 | let parentStyle = "position: relative;"
10 | if (widget.coverGutter)
11 | parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"
12 | if (widget.noHScroll)
13 | parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"
14 | removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle))
15 | }
16 | return widget.height = widget.node.parentNode.offsetHeight
17 | }
18 |
19 | // Return true when the given mouse event happened in a widget
20 | export function eventInWidget(display, e) {
21 | for (let n = e_target(e); n != display.wrapper; n = n.parentNode) {
22 | if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
23 | (n.parentNode == display.sizer && n != display.mover))
24 | return true
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/front-vue/src/components/popWindow.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
25 |
26 |
55 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/edit/deleteNearSelection.js:
--------------------------------------------------------------------------------
1 | import { runInOp } from "../display/operations"
2 | import { ensureCursorVisible } from "../display/scrolling"
3 | import { cmp } from "../line/pos"
4 | import { replaceRange } from "../model/changes"
5 | import { lst } from "../util/misc"
6 |
7 | // Helper for deleting text near the selection(s), used to implement
8 | // backspace, delete, and similar functionality.
9 | export function deleteNearSelection(cm, compute) {
10 | let ranges = cm.doc.sel.ranges, kill = []
11 | // Build up a set of ranges to kill first, merging overlapping
12 | // ranges.
13 | for (let i = 0; i < ranges.length; i++) {
14 | let toKill = compute(ranges[i])
15 | while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
16 | let replaced = kill.pop()
17 | if (cmp(replaced.from, toKill.from) < 0) {
18 | toKill.from = replaced.from
19 | break
20 | }
21 | }
22 | kill.push(toKill)
23 | }
24 | // Next, remove those actual ranges.
25 | runInOp(cm, () => {
26 | for (let i = kill.length - 1; i >= 0; i--)
27 | replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete")
28 | ensureCursorVisible(cm)
29 | })
30 | }
31 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/lint/yaml-lint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | // Depends on js-yaml.js from https://github.com/nodeca/js-yaml
15 |
16 | // declare global: jsyaml
17 |
18 | CodeMirror.registerHelper("lint", "yaml", function(text) {
19 | var found = [];
20 | try { jsyaml.load(text); }
21 | catch(e) {
22 | var loc = e.mark,
23 | // js-yaml YAMLException doesn't always provide an accurate lineno
24 | // e.g., when there are multiple yaml docs
25 | // ---
26 | // ---
27 | // foo:bar
28 | from = loc ? CodeMirror.Pos(loc.line, loc.column) : CodeMirror.Pos(0, 0),
29 | to = from;
30 | found.push({ from: from, to: to, message: e.message });
31 | }
32 | return found;
33 | });
34 |
35 | });
36 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/lint/css-lint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Depends on csslint.js from https://github.com/stubbornella/csslint
5 |
6 | // declare global: CSSLint
7 |
8 | (function(mod) {
9 | if (typeof exports == "object" && typeof module == "object") // CommonJS
10 | mod(require("../../lib/codemirror"));
11 | else if (typeof define == "function" && define.amd) // AMD
12 | define(["../../lib/codemirror"], mod);
13 | else // Plain browser env
14 | mod(CodeMirror);
15 | })(function(CodeMirror) {
16 | "use strict";
17 |
18 | CodeMirror.registerHelper("lint", "css", function(text) {
19 | var found = [];
20 | if (!window.CSSLint) return found;
21 | var results = CSSLint.verify(text), messages = results.messages, message = null;
22 | for ( var i = 0; i < messages.length; i++) {
23 | message = messages[i];
24 | var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col;
25 | found.push({
26 | from: CodeMirror.Pos(startLine, startCol),
27 | to: CodeMirror.Pos(endLine, endCol),
28 | message: message.message,
29 | severity : message.type
30 | });
31 | }
32 | return found;
33 | });
34 |
35 | });
36 |
--------------------------------------------------------------------------------
/front-vue/src/components/popAlert.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
29 |
30 |
58 |
--------------------------------------------------------------------------------
/front-vue/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | var utils = require('./utils')
2 | var webpack = require('webpack')
3 | var config = require('../config/index')
4 | var merge = require('webpack-merge')
5 | var baseWebpackConfig = require('./webpack.base.conf')
6 | var HtmlWebpackPlugin = require('html-webpack-plugin')
7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
8 |
9 | // add hot-reload related code to entry chunks
10 | Object.keys(baseWebpackConfig.entry).forEach(function (name) {
11 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
12 | })
13 |
14 | module.exports = merge(baseWebpackConfig, {
15 | module: {
16 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
17 | },
18 | // cheap-module-eval-source-map is faster for development
19 | devtool: '#cheap-module-eval-source-map',
20 | plugins: [
21 | new webpack.DefinePlugin({
22 | 'process.env': config.dev.env
23 | }),
24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
25 | new webpack.HotModuleReplacementPlugin(),
26 | new webpack.NoEmitOnErrorsPlugin(),
27 | // https://github.com/ampedandwired/html-webpack-plugin
28 | new HtmlWebpackPlugin({
29 | filename: 'index.html',
30 | template: 'index.html',
31 | inject: true
32 | }),
33 | new FriendlyErrorsPlugin()
34 | ]
35 | })
36 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/tern/worker.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // declare global: tern, server
5 |
6 | var server;
7 |
8 | this.onmessage = function(e) {
9 | var data = e.data;
10 | switch (data.type) {
11 | case "init": return startServer(data.defs, data.plugins, data.scripts);
12 | case "add": return server.addFile(data.name, data.text);
13 | case "del": return server.delFile(data.name);
14 | case "req": return server.request(data.body, function(err, reqData) {
15 | postMessage({id: data.id, body: reqData, err: err && String(err)});
16 | });
17 | case "getFile":
18 | var c = pending[data.id];
19 | delete pending[data.id];
20 | return c(data.err, data.text);
21 | default: throw new Error("Unknown message type: " + data.type);
22 | }
23 | };
24 |
25 | var nextId = 0, pending = {};
26 | function getFile(file, c) {
27 | postMessage({type: "getFile", name: file, id: ++nextId});
28 | pending[nextId] = c;
29 | }
30 |
31 | function startServer(defs, plugins, scripts) {
32 | if (scripts) importScripts.apply(null, scripts);
33 |
34 | server = new tern.Server({
35 | getFile: getFile,
36 | async: true,
37 | defs: defs,
38 | plugins: plugins
39 | });
40 | }
41 |
42 | this.console = {
43 | log: function(v) { postMessage({type: "debug", message: v}); }
44 | };
45 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/display/gutters.js:
--------------------------------------------------------------------------------
1 | import { elt, removeChildren } from "../util/dom"
2 | import { indexOf } from "../util/misc"
3 |
4 | import { updateGutterSpace } from "./update_display"
5 |
6 | // Rebuild the gutter elements, ensure the margin to the left of the
7 | // code matches their width.
8 | export function updateGutters(cm) {
9 | let gutters = cm.display.gutters, specs = cm.options.gutters
10 | removeChildren(gutters)
11 | let i = 0
12 | for (; i < specs.length; ++i) {
13 | let gutterClass = specs[i]
14 | let gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass))
15 | if (gutterClass == "CodeMirror-linenumbers") {
16 | cm.display.lineGutter = gElt
17 | gElt.style.width = (cm.display.lineNumWidth || 1) + "px"
18 | }
19 | }
20 | gutters.style.display = i ? "" : "none"
21 | updateGutterSpace(cm)
22 | }
23 |
24 | // Make sure the gutters options contains the element
25 | // "CodeMirror-linenumbers" when the lineNumbers option is true.
26 | export function setGuttersForLineNumbers(options) {
27 | let found = indexOf(options.gutters, "CodeMirror-linenumbers")
28 | if (found == -1 && options.lineNumbers) {
29 | options.gutters = options.gutters.concat(["CodeMirror-linenumbers"])
30 | } else if (found > -1 && !options.lineNumbers) {
31 | options.gutters = options.gutters.slice(0)
32 | options.gutters.splice(found, 1)
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/JsBox/public/static/js/manifest.67d95f4f2bac744a9e68.js:
--------------------------------------------------------------------------------
1 | !function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var i,u,f,s=0,l=[];s {
5 | axios.post(url, form).then(response => {
6 | if (response.status === 200) {
7 | resolve(response.data)
8 | } else {
9 | reject(response.data.message)
10 | }
11 | }).catch(e => {
12 | reject(e)
13 | })
14 | })
15 | }
16 |
17 | export function get (url, form = {}, cache = false) {
18 | if (cache) {
19 | const key = url + form.toString()
20 | const sessionData = window.sessionStorage.getItem(key)
21 | return new Promise((resolve, reject) => {
22 | if (sessionData) {
23 | resolve(JSON.parse(sessionData))
24 | } else {
25 | getFromServer(url, form).then(data => {
26 | window.sessionStorage.setItem(key, JSON.stringify(data))
27 | resolve(data)
28 | }).catch(e => {
29 | reject(e)
30 | })
31 | }
32 | })
33 | } else {
34 | return getFromServer(url, form)
35 | }
36 | }
37 |
38 | function getFromServer (url, params) {
39 | return new Promise(function (resolve, reject) {
40 | if (Object.getOwnPropertyNames(params).length > 0) {
41 | url += '?'
42 | for (const f in params) {
43 | url += f + '=' + params[f] + '&'
44 | }
45 | url = url.substring(0, url.length - 1)
46 | }
47 | axios.get(url).then(response => {
48 | if (response.status === 200) {
49 | resolve(response.data)
50 | } else {
51 | reject(response.data.message)
52 | }
53 | }).catch(e => {
54 | reject(e)
55 | })
56 | })
57 | }
58 |
--------------------------------------------------------------------------------
/front-vue/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: 'static',
10 | assetsPublicPath: '/',
11 | productionSourceMap: false,
12 | // Gzip off by default as many popular static hosts such as
13 | // Surge or Netlify already gzip all static assets for you.
14 | // Before setting to `true`, make sure to:
15 | // npm install --save-dev compression-webpack-plugin
16 | productionGzip: false,
17 | productionGzipExtensions: ['js', 'css'],
18 | // Run the build command with an extra argument to
19 | // View the bundle analyzer report after build finishes:
20 | // `npm run build --report`
21 | // Set to `true` or `false` to always turn it on or off
22 | bundleAnalyzerReport: process.env.npm_config_report
23 | },
24 | dev: {
25 | env: require('./dev.env'),
26 | port: 3000,
27 | autoOpenBrowser: true,
28 | assetsSubDirectory: 'static',
29 | assetsPublicPath: '/',
30 | proxyTable: {},
31 | // CSS Sourcemaps off by default because relative paths are "buggy"
32 | // with this option, according to the CSS-Loader README
33 | // (https://github.com/webpack/css-loader#sourcemaps)
34 | // In our experience, they generally work as expected,
35 | // just be aware of this issue when enabling this option.
36 | cssSourceMap: false
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/edit/global_events.js:
--------------------------------------------------------------------------------
1 | import { onBlur } from "../display/focus"
2 | import { on } from "../util/event"
3 |
4 | // These must be handled carefully, because naively registering a
5 | // handler for each editor will cause the editors to never be
6 | // garbage collected.
7 |
8 | function forEachCodeMirror(f) {
9 | if (!document.body.getElementsByClassName) return
10 | let byClass = document.body.getElementsByClassName("CodeMirror")
11 | for (let i = 0; i < byClass.length; i++) {
12 | let cm = byClass[i].CodeMirror
13 | if (cm) f(cm)
14 | }
15 | }
16 |
17 | let globalsRegistered = false
18 | export function ensureGlobalHandlers() {
19 | if (globalsRegistered) return
20 | registerGlobalHandlers()
21 | globalsRegistered = true
22 | }
23 | function registerGlobalHandlers() {
24 | // When the window resizes, we need to refresh active editors.
25 | let resizeTimer
26 | on(window, "resize", () => {
27 | if (resizeTimer == null) resizeTimer = setTimeout(() => {
28 | resizeTimer = null
29 | forEachCodeMirror(onResize)
30 | }, 100)
31 | })
32 | // When the window loses focus, we want to show the editor as blurred
33 | on(window, "blur", () => forEachCodeMirror(onBlur))
34 | }
35 | // Called when the window resizes
36 | function onResize(cm) {
37 | let d = cm.display
38 | if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
39 | return
40 | // Might be a text scaling operation, clear size caches.
41 | d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
42 | d.scrollbarsClipped = false
43 | cm.setSize()
44 | }
45 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/scroll/simplescrollbars.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div {
2 | position: absolute;
3 | background: #ccc;
4 | -moz-box-sizing: border-box;
5 | box-sizing: border-box;
6 | border: 1px solid #bbb;
7 | border-radius: 2px;
8 | }
9 |
10 | .CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical {
11 | position: absolute;
12 | z-index: 6;
13 | background: #eee;
14 | }
15 |
16 | .CodeMirror-simplescroll-horizontal {
17 | bottom: 0; left: 0;
18 | height: 8px;
19 | }
20 | .CodeMirror-simplescroll-horizontal div {
21 | bottom: 0;
22 | height: 100%;
23 | }
24 |
25 | .CodeMirror-simplescroll-vertical {
26 | right: 0; top: 0;
27 | width: 8px;
28 | }
29 | .CodeMirror-simplescroll-vertical div {
30 | right: 0;
31 | width: 100%;
32 | }
33 |
34 |
35 | .CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler {
36 | display: none;
37 | }
38 |
39 | .CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div {
40 | position: absolute;
41 | background: #bcd;
42 | border-radius: 3px;
43 | }
44 |
45 | .CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical {
46 | position: absolute;
47 | z-index: 6;
48 | }
49 |
50 | .CodeMirror-overlayscroll-horizontal {
51 | bottom: 0; left: 0;
52 | height: 6px;
53 | }
54 | .CodeMirror-overlayscroll-horizontal div {
55 | bottom: 0;
56 | height: 100%;
57 | }
58 |
59 | .CodeMirror-overlayscroll-vertical {
60 | right: 0; top: 0;
61 | width: 6px;
62 | }
63 | .CodeMirror-overlayscroll-vertical div {
64 | right: 0;
65 | width: 100%;
66 | }
67 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/display/fullscreen.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.defineOption("fullScreen", false, function(cm, val, old) {
15 | if (old == CodeMirror.Init) old = false;
16 | if (!old == !val) return;
17 | if (val) setFullscreen(cm);
18 | else setNormal(cm);
19 | });
20 |
21 | function setFullscreen(cm) {
22 | var wrap = cm.getWrapperElement();
23 | cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,
24 | width: wrap.style.width, height: wrap.style.height};
25 | wrap.style.width = "";
26 | wrap.style.height = "auto";
27 | wrap.className += " CodeMirror-fullscreen";
28 | document.documentElement.style.overflow = "hidden";
29 | cm.refresh();
30 | }
31 |
32 | function setNormal(cm) {
33 | var wrap = cm.getWrapperElement();
34 | wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");
35 | document.documentElement.style.overflow = "";
36 | var info = cm.state.fullScreenRestore;
37 | wrap.style.width = info.width; wrap.style.height = info.height;
38 | window.scrollTo(info.scrollLeft, info.scrollTop);
39 | cm.refresh();
40 | }
41 | });
42 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/line/pos.js:
--------------------------------------------------------------------------------
1 | import { getLine } from "./utils_line"
2 |
3 | // A Pos instance represents a position within the text.
4 | export function Pos(line, ch, sticky = null) {
5 | if (!(this instanceof Pos)) return new Pos(line, ch, sticky)
6 | this.line = line
7 | this.ch = ch
8 | this.sticky = sticky
9 | }
10 |
11 | // Compare two positions, return 0 if they are the same, a negative
12 | // number when a is less, and a positive number otherwise.
13 | export function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
14 |
15 | export function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
16 |
17 | export function copyPos(x) {return Pos(x.line, x.ch)}
18 | export function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
19 | export function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
20 |
21 | // Most of the external API clips given positions to make sure they
22 | // actually exist within the document.
23 | export function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
24 | export function clipPos(doc, pos) {
25 | if (pos.line < doc.first) return Pos(doc.first, 0)
26 | let last = doc.first + doc.size - 1
27 | if (pos.line > last) return Pos(last, getLine(doc, last).text.length)
28 | return clipToLen(pos, getLine(doc, pos.line).text.length)
29 | }
30 | function clipToLen(pos, linelen) {
31 | let ch = pos.ch
32 | if (ch == null || ch > linelen) return Pos(pos.line, linelen)
33 | else if (ch < 0) return Pos(pos.line, 0)
34 | else return pos
35 | }
36 | export function clipPosArray(doc, array) {
37 | let out = []
38 | for (let i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i])
39 | return out
40 | }
41 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/display/focus.js:
--------------------------------------------------------------------------------
1 | import { restartBlink } from "./selection"
2 | import { webkit } from "../util/browser"
3 | import { addClass, rmClass } from "../util/dom"
4 | import { signal } from "../util/event"
5 |
6 | export function ensureFocus(cm) {
7 | if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) }
8 | }
9 |
10 | export function delayBlurEvent(cm) {
11 | cm.state.delayingBlurEvent = true
12 | setTimeout(() => { if (cm.state.delayingBlurEvent) {
13 | cm.state.delayingBlurEvent = false
14 | onBlur(cm)
15 | } }, 100)
16 | }
17 |
18 | export function onFocus(cm, e) {
19 | if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false
20 |
21 | if (cm.options.readOnly == "nocursor") return
22 | if (!cm.state.focused) {
23 | signal(cm, "focus", cm, e)
24 | cm.state.focused = true
25 | addClass(cm.display.wrapper, "CodeMirror-focused")
26 | // This test prevents this from firing when a context
27 | // menu is closed (since the input reset would kill the
28 | // select-all detection hack)
29 | if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
30 | cm.display.input.reset()
31 | if (webkit) setTimeout(() => cm.display.input.reset(true), 20) // Issue #1730
32 | }
33 | cm.display.input.receivedFocus()
34 | }
35 | restartBlink(cm)
36 | }
37 | export function onBlur(cm, e) {
38 | if (cm.state.delayingBlurEvent) return
39 |
40 | if (cm.state.focused) {
41 | signal(cm, "blur", cm, e)
42 | cm.state.focused = false
43 | rmClass(cm.display.wrapper, "CodeMirror-focused")
44 | }
45 | clearInterval(cm.display.blinker)
46 | setTimeout(() => { if (!cm.state.focused) cm.display.shift = false }, 150)
47 | }
48 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/lint/html-lint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js
5 |
6 | // declare global: HTMLHint
7 |
8 | (function(mod) {
9 | if (typeof exports == "object" && typeof module == "object") // CommonJS
10 | mod(require("../../lib/codemirror"), require("htmlhint"));
11 | else if (typeof define == "function" && define.amd) // AMD
12 | define(["../../lib/codemirror", "htmlhint"], mod);
13 | else // Plain browser env
14 | mod(CodeMirror);
15 | })(function(CodeMirror) {
16 | "use strict";
17 |
18 | var defaultRules = {
19 | "tagname-lowercase": true,
20 | "attr-lowercase": true,
21 | "attr-value-double-quotes": true,
22 | "doctype-first": false,
23 | "tag-pair": true,
24 | "spec-char-escape": true,
25 | "id-unique": true,
26 | "src-not-empty": true,
27 | "attr-no-duplication": true
28 | };
29 |
30 | CodeMirror.registerHelper("lint", "html", function(text, options) {
31 | var found = [];
32 | if (!window.HTMLHint) return found;
33 | var messages = HTMLHint.verify(text, options && options.rules || defaultRules);
34 | for (var i = 0; i < messages.length; i++) {
35 | var message = messages[i];
36 | var startLine = message.line - 1, endLine = message.line - 1, startCol = message.col - 1, endCol = message.col;
37 | found.push({
38 | from: CodeMirror.Pos(startLine, startCol),
39 | to: CodeMirror.Pos(endLine, endCol),
40 | message: message.message,
41 | severity : message.type
42 | });
43 | }
44 | return found;
45 | });
46 | });
47 |
--------------------------------------------------------------------------------
/JsBox/app.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var path = require('path');
3 | var favicon = require('serve-favicon');
4 | var logger = require('morgan');
5 | var cookieParser = require('cookie-parser');
6 | var bodyParser = require('body-parser');
7 | var cors = require('cors');
8 |
9 | var index = require('./routes/index');
10 | var users = require('./routes/users');
11 |
12 | var app = express();
13 |
14 | // view engine setup
15 | app.set('views', path.join(__dirname, 'views'));
16 | app.set('view engine', 'jade');
17 |
18 | // uncomment after placing your favicon in /public
19 | //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
20 | app.use(logger('dev'));
21 | app.use(bodyParser.json());
22 | app.use(bodyParser.urlencoded({ extended: false }));
23 | app.use(cookieParser());
24 | app.use(express.static(path.join(__dirname, 'public')));
25 | app.use(cors());
26 |
27 | //var corsOptions = {
28 | // origin: 'http://example.com',
29 | // optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
30 | //}
31 | //
32 | //app.use('/', corsOptions, index);
33 |
34 | app.use('/api', index);
35 | app.use('/users', users);
36 |
37 | // catch 404 and forward to error handler
38 | app.use(function(req, res, next) {
39 | var err = new Error('Not Found');
40 | err.status = 404;
41 | next(err);
42 | });
43 |
44 | // error handler
45 | app.use(function(err, req, res, next) {
46 | // set locals, only providing error in development
47 | res.locals.message = err.message;
48 | res.locals.error = req.app.get('env') === 'development' ? err : {};
49 |
50 | // render the error page
51 | res.status(err.status || 500);
52 | res.render('error');
53 | });
54 |
55 | module.exports = app;
56 |
57 |
58 | //https://github.com/expressjs/cors
59 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/display/autorefresh.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"))
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod)
9 | else // Plain browser env
10 | mod(CodeMirror)
11 | })(function(CodeMirror) {
12 | "use strict"
13 |
14 | CodeMirror.defineOption("autoRefresh", false, function(cm, val) {
15 | if (cm.state.autoRefresh) {
16 | stopListening(cm, cm.state.autoRefresh)
17 | cm.state.autoRefresh = null
18 | }
19 | if (val && cm.display.wrapper.offsetHeight == 0)
20 | startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250})
21 | })
22 |
23 | function startListening(cm, state) {
24 | function check() {
25 | if (cm.display.wrapper.offsetHeight) {
26 | stopListening(cm, state)
27 | if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight)
28 | cm.refresh()
29 | } else {
30 | state.timeout = setTimeout(check, state.delay)
31 | }
32 | }
33 | state.timeout = setTimeout(check, state.delay)
34 | state.hurry = function() {
35 | clearTimeout(state.timeout)
36 | state.timeout = setTimeout(check, 50)
37 | }
38 | CodeMirror.on(window, "mouseup", state.hurry)
39 | CodeMirror.on(window, "keyup", state.hurry)
40 | }
41 |
42 | function stopListening(_cm, state) {
43 | clearTimeout(state.timeout)
44 | CodeMirror.off(window, "mouseup", state.hurry)
45 | CodeMirror.off(window, "keyup", state.hurry)
46 | }
47 | });
48 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/scroll/scrollpastend.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) {
15 | if (old && old != CodeMirror.Init) {
16 | cm.off("change", onChange);
17 | cm.off("refresh", updateBottomMargin);
18 | cm.display.lineSpace.parentNode.style.paddingBottom = "";
19 | cm.state.scrollPastEndPadding = null;
20 | }
21 | if (val) {
22 | cm.on("change", onChange);
23 | cm.on("refresh", updateBottomMargin);
24 | updateBottomMargin(cm);
25 | }
26 | });
27 |
28 | function onChange(cm, change) {
29 | if (CodeMirror.changeEnd(change).line == cm.lastLine())
30 | updateBottomMargin(cm);
31 | }
32 |
33 | function updateBottomMargin(cm) {
34 | var padding = "";
35 | if (cm.lineCount() > 1) {
36 | var totalH = cm.display.scroller.clientHeight - 30,
37 | lastLineH = cm.getLineHandle(cm.lastLine()).height;
38 | padding = (totalH - lastLineH) + "px";
39 | }
40 | if (cm.state.scrollPastEndPadding != padding) {
41 | cm.state.scrollPastEndPadding = padding;
42 | cm.display.lineSpace.parentNode.style.paddingBottom = padding;
43 | cm.off("refresh", updateBottomMargin);
44 | cm.setSize();
45 | cm.on("refresh", updateBottomMargin);
46 | }
47 | }
48 | });
49 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/fold/markdown-fold.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.registerHelper("fold", "markdown", function(cm, start) {
15 | var maxDepth = 100;
16 |
17 | function isHeader(lineNo) {
18 | var tokentype = cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0));
19 | return tokentype && /\bheader\b/.test(tokentype);
20 | }
21 |
22 | function headerLevel(lineNo, line, nextLine) {
23 | var match = line && line.match(/^#+/);
24 | if (match && isHeader(lineNo)) return match[0].length;
25 | match = nextLine && nextLine.match(/^[=\-]+\s*$/);
26 | if (match && isHeader(lineNo + 1)) return nextLine[0] == "=" ? 1 : 2;
27 | return maxDepth;
28 | }
29 |
30 | var firstLine = cm.getLine(start.line), nextLine = cm.getLine(start.line + 1);
31 | var level = headerLevel(start.line, firstLine, nextLine);
32 | if (level === maxDepth) return undefined;
33 |
34 | var lastLineNo = cm.lastLine();
35 | var end = start.line, nextNextLine = cm.getLine(end + 2);
36 | while (end < lastLineNo) {
37 | if (headerLevel(end + 1, nextLine, nextNextLine) <= level) break;
38 | ++end;
39 | nextLine = nextNextLine;
40 | nextNextLine = cm.getLine(end + 2);
41 | }
42 |
43 | return {
44 | from: CodeMirror.Pos(start.line, firstLine.length),
45 | to: CodeMirror.Pos(end, cm.getLine(end).length)
46 | };
47 | });
48 |
49 | });
50 |
--------------------------------------------------------------------------------
/front-vue/build/webpack.base.conf.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var utils = require('./utils')
3 | var config = require('../config/index')
4 | var vueLoaderConfig = require('./vue-loader.conf')
5 |
6 | function resolve (dir) {
7 | return path.join(__dirname, '..', dir)
8 | }
9 |
10 | module.exports = {
11 | entry: {
12 | app: './src/main.js'
13 | },
14 | output: {
15 | path: config.build.assetsRoot,
16 | filename: '[name].js',
17 | publicPath: process.env.NODE_ENV === 'production'
18 | ? config.build.assetsPublicPath
19 | : config.dev.assetsPublicPath
20 | },
21 | resolve: {
22 | extensions: ['.js', '.vue', '.json'],
23 | alias: {
24 | 'vue$': 'vue/dist/vue.esm.js',
25 | '@': resolve('src')
26 | }
27 | },
28 | module: {
29 | rules: [
30 | {
31 | test: /\.(js|vue)$/,
32 | loader: 'eslint-loader',
33 | enforce: 'pre',
34 | include: [resolve('src'), resolve('test')],
35 | options: {
36 | formatter: require('eslint-friendly-formatter')
37 | }
38 | },
39 | {
40 | test: /\.vue$/,
41 | loader: 'vue-loader',
42 | options: vueLoaderConfig
43 | },
44 | {
45 | test: /\.js$/,
46 | loader: 'babel-loader',
47 | include: [resolve('src'), resolve('test')]
48 | },
49 | {
50 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
51 | loader: 'url-loader',
52 | options: {
53 | limit: 10000,
54 | name: utils.assetsPath('img/[name].[hash:7].[ext]')
55 | }
56 | },
57 | {
58 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
59 | loader: 'url-loader',
60 | options: {
61 | limit: 10000,
62 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
63 | }
64 | }
65 | ]
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/hint/anyword-hint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var WORD = /[\w$]+/, RANGE = 500;
15 |
16 | CodeMirror.registerHelper("hint", "anyword", function(editor, options) {
17 | var word = options && options.word || WORD;
18 | var range = options && options.range || RANGE;
19 | var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
20 | var end = cur.ch, start = end;
21 | while (start && word.test(curLine.charAt(start - 1))) --start;
22 | var curWord = start != end && curLine.slice(start, end);
23 |
24 | var list = options && options.list || [], seen = {};
25 | var re = new RegExp(word.source, "g");
26 | for (var dir = -1; dir <= 1; dir += 2) {
27 | var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;
28 | for (; line != endLine; line += dir) {
29 | var text = editor.getLine(line), m;
30 | while (m = re.exec(text)) {
31 | if (line == cur.line && m[0] === curWord) continue;
32 | if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) {
33 | seen[m[0]] = true;
34 | list.push(m[0]);
35 | }
36 | }
37 | }
38 | }
39 | return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};
40 | });
41 | });
42 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/fold/indent-fold.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | function lineIndent(cm, lineNo) {
15 | var text = cm.getLine(lineNo)
16 | var spaceTo = text.search(/\S/)
17 | if (spaceTo == -1 || /\bcomment\b/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, spaceTo + 1))))
18 | return -1
19 | return CodeMirror.countColumn(text, null, cm.getOption("tabSize"))
20 | }
21 | !
22 | CodeMirror.registerHelper("fold", "indent", function(cm, start) {
23 | var myIndent = lineIndent(cm, start.line)
24 | if (myIndent < 0) return
25 | var lastLineInFold = null
26 |
27 | // Go through lines until we find a line that definitely doesn't belong in
28 | // the block we're folding, or to the end.
29 | for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) {
30 | var indent = lineIndent(cm, i)
31 | if (indent == -1) {
32 | } else if (indent > myIndent) {
33 | // Lines with a greater indent are considered part of the block.
34 | lastLineInFold = i;
35 | } else {
36 | // If this line has non-space, non-comment content, and is
37 | // indented less or equal to the start line, it is the start of
38 | // another block.
39 | break;
40 | }
41 | }
42 | if (lastLineInFold) return {
43 | from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
44 | to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length)
45 | };
46 | });
47 |
48 | });
49 |
--------------------------------------------------------------------------------
/JsBox/bin/www:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /**
4 | * Module dependencies.
5 | */
6 |
7 | var app = require('../app');
8 | var debug = require('debug')('code-editor:server');
9 | var http = require('http');
10 |
11 | /**
12 | * Get port from environment and store in Express.
13 | */
14 |
15 | var port = normalizePort(process.env.PORT || '3005');
16 | app.set('port', port);
17 |
18 | /**
19 | * Create HTTP server.
20 | */
21 |
22 | var server = http.createServer(app);
23 |
24 | /**
25 | * Listen on provided port, on all network interfaces.
26 | */
27 |
28 | server.listen(port);
29 | server.on('error', onError);
30 | server.on('listening', onListening);
31 |
32 | /**
33 | * Normalize a port into a number, string, or false.
34 | */
35 |
36 | function normalizePort(val) {
37 | var port = parseInt(val, 10);
38 |
39 | if (isNaN(port)) {
40 | // named pipe
41 | return val;
42 | }
43 |
44 | if (port >= 0) {
45 | // port number
46 | return port;
47 | }
48 |
49 | return false;
50 | }
51 |
52 | /**
53 | * Event listener for HTTP server "error" event.
54 | */
55 |
56 | function onError(error) {
57 | if (error.syscall !== 'listen') {
58 | throw error;
59 | }
60 |
61 | var bind = typeof port === 'string'
62 | ? 'Pipe ' + port
63 | : 'Port ' + port;
64 |
65 | // handle specific listen errors with friendly messages
66 | switch (error.code) {
67 | case 'EACCES':
68 | console.error(bind + ' requires elevated privileges');
69 | process.exit(1);
70 | break;
71 | case 'EADDRINUSE':
72 | console.error(bind + ' is already in use');
73 | process.exit(1);
74 | break;
75 | default:
76 | throw error;
77 | }
78 | }
79 |
80 | /**
81 | * Event listener for HTTP server "listening" event.
82 | */
83 |
84 | function onListening() {
85 | var addr = server.address();
86 | var bind = typeof addr === 'string'
87 | ? 'pipe ' + addr
88 | : 'port ' + addr.port;
89 | debug('Listening on ' + bind);
90 | }
91 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/util/browser.js:
--------------------------------------------------------------------------------
1 | // Kludges for bugs and behavior differences that can't be feature
2 | // detected are enabled based on userAgent etc sniffing.
3 | let userAgent = navigator.userAgent
4 | let platform = navigator.platform
5 |
6 | export let gecko = /gecko\/\d/i.test(userAgent)
7 | let ie_upto10 = /MSIE \d/.test(userAgent)
8 | let ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent)
9 | let edge = /Edge\/(\d+)/.exec(userAgent)
10 | export let ie = ie_upto10 || ie_11up || edge
11 | export let ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1])
12 | export let webkit = !edge && /WebKit\//.test(userAgent)
13 | let qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent)
14 | export let chrome = !edge && /Chrome\//.test(userAgent)
15 | export let presto = /Opera\//.test(userAgent)
16 | export let safari = /Apple Computer/.test(navigator.vendor)
17 | export let mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent)
18 | export let phantom = /PhantomJS/.test(userAgent)
19 |
20 | export let ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent)
21 | export let android = /Android/.test(userAgent)
22 | // This is woefully incomplete. Suggestions for alternative methods welcome.
23 | export let mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)
24 | export let mac = ios || /Mac/.test(platform)
25 | export let chromeOS = /\bCrOS\b/.test(userAgent)
26 | export let windows = /win/i.test(platform)
27 |
28 | let presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/)
29 | if (presto_version) presto_version = Number(presto_version[1])
30 | if (presto_version && presto_version >= 15) { presto = false; webkit = true }
31 | // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
32 | export let flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11))
33 | export let captureRightClick = gecko || (ie && ie_version >= 9)
34 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/theme/blackboard.css:
--------------------------------------------------------------------------------
1 | /* Port of TextMate's Blackboard theme */
2 |
3 | .cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
4 | .cm-s-blackboard div.CodeMirror-selected { background: #253B76; }
5 | .cm-s-blackboard .CodeMirror-line::selection, .cm-s-blackboard .CodeMirror-line > span::selection, .cm-s-blackboard .CodeMirror-line > span > span::selection { background: rgba(37, 59, 118, .99); }
6 | .cm-s-blackboard .CodeMirror-line::-moz-selection, .cm-s-blackboard .CodeMirror-line > span::-moz-selection, .cm-s-blackboard .CodeMirror-line > span > span::-moz-selection { background: rgba(37, 59, 118, .99); }
7 | .cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
8 | .cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; }
9 | .cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; }
10 | .cm-s-blackboard .CodeMirror-linenumber { color: #888; }
11 | .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7; }
12 |
13 | .cm-s-blackboard .cm-keyword { color: #FBDE2D; }
14 | .cm-s-blackboard .cm-atom { color: #D8FA3C; }
15 | .cm-s-blackboard .cm-number { color: #D8FA3C; }
16 | .cm-s-blackboard .cm-def { color: #8DA6CE; }
17 | .cm-s-blackboard .cm-variable { color: #FF6400; }
18 | .cm-s-blackboard .cm-operator { color: #FBDE2D; }
19 | .cm-s-blackboard .cm-comment { color: #AEAEAE; }
20 | .cm-s-blackboard .cm-string { color: #61CE3C; }
21 | .cm-s-blackboard .cm-string-2 { color: #61CE3C; }
22 | .cm-s-blackboard .cm-meta { color: #D8FA3C; }
23 | .cm-s-blackboard .cm-builtin { color: #8DA6CE; }
24 | .cm-s-blackboard .cm-tag { color: #8DA6CE; }
25 | .cm-s-blackboard .cm-attribute { color: #8DA6CE; }
26 | .cm-s-blackboard .cm-header { color: #FF6400; }
27 | .cm-s-blackboard .cm-hr { color: #AEAEAE; }
28 | .cm-s-blackboard .cm-link { color: #8DA6CE; }
29 | .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
30 |
31 | .cm-s-blackboard .CodeMirror-activeline-background { background: #3C3636; }
32 | .cm-s-blackboard .CodeMirror-matchingbracket { outline:1px solid grey;color:white !important; }
33 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/edit/continuelist.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var listRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,
15 | emptyListRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,
16 | unorderedListRE = /[*+-]\s/;
17 |
18 | CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
19 | if (cm.getOption("disableInput")) return CodeMirror.Pass;
20 | var ranges = cm.listSelections(), replacements = [];
21 | for (var i = 0; i < ranges.length; i++) {
22 | var pos = ranges[i].head;
23 | var eolState = cm.getStateAfter(pos.line);
24 | var inList = eolState.list !== false;
25 | var inQuote = eolState.quote !== 0;
26 |
27 | var line = cm.getLine(pos.line), match = listRE.exec(line);
28 | if (!ranges[i].empty() || (!inList && !inQuote) || !match) {
29 | cm.execCommand("newlineAndIndent");
30 | return;
31 | }
32 | if (emptyListRE.test(line)) {
33 | if (!/>\s*$/.test(line)) cm.replaceRange("", {
34 | line: pos.line, ch: 0
35 | }, {
36 | line: pos.line, ch: pos.ch + 1
37 | });
38 | replacements[i] = "\n";
39 | } else {
40 | var indent = match[1], after = match[5];
41 | var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0
42 | ? match[2].replace("x", " ")
43 | : (parseInt(match[3], 10) + 1) + match[4];
44 |
45 | replacements[i] = "\n" + indent + bullet + after;
46 | }
47 | }
48 |
49 | cm.replaceSelections(replacements);
50 | };
51 | });
52 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/display/rulers.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.defineOption("rulers", false, function(cm, val) {
15 | if (cm.state.rulerDiv) {
16 | cm.state.rulerDiv.parentElement.removeChild(cm.state.rulerDiv)
17 | cm.state.rulerDiv = null
18 | cm.off("refresh", drawRulers)
19 | }
20 | if (val && val.length) {
21 | cm.state.rulerDiv = cm.display.lineSpace.parentElement.insertBefore(document.createElement("div"), cm.display.lineSpace)
22 | cm.state.rulerDiv.className = "CodeMirror-rulers"
23 | drawRulers(cm)
24 | cm.on("refresh", drawRulers)
25 | }
26 | });
27 |
28 | function drawRulers(cm) {
29 | cm.state.rulerDiv.textContent = ""
30 | var val = cm.getOption("rulers");
31 | var cw = cm.defaultCharWidth();
32 | var left = cm.charCoords(CodeMirror.Pos(cm.firstLine(), 0), "div").left;
33 | cm.state.rulerDiv.style.minHeight = (cm.display.scroller.offsetHeight + 30) + "px";
34 | for (var i = 0; i < val.length; i++) {
35 | var elt = document.createElement("div");
36 | elt.className = "CodeMirror-ruler";
37 | var col, conf = val[i];
38 | if (typeof conf == "number") {
39 | col = conf;
40 | } else {
41 | col = conf.column;
42 | if (conf.className) elt.className += " " + conf.className;
43 | if (conf.color) elt.style.borderColor = conf.color;
44 | if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;
45 | if (conf.width) elt.style.borderLeftWidth = conf.width;
46 | }
47 | elt.style.left = (left + col * cw) + "px";
48 | cm.state.rulerDiv.appendChild(elt)
49 | }
50 | }
51 | });
52 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/search/jump-to-line.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Defines jumpToLine command. Uses dialog.js if present.
5 |
6 | (function(mod) {
7 | if (typeof exports == "object" && typeof module == "object") // CommonJS
8 | mod(require("../../lib/codemirror"), require("../dialog/dialog"));
9 | else if (typeof define == "function" && define.amd) // AMD
10 | define(["../../lib/codemirror", "../dialog/dialog"], mod);
11 | else // Plain browser env
12 | mod(CodeMirror);
13 | })(function(CodeMirror) {
14 | "use strict";
15 |
16 | function dialog(cm, text, shortText, deflt, f) {
17 | if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
18 | else f(prompt(shortText, deflt));
19 | }
20 |
21 | var jumpDialog =
22 | 'Jump to line: (Use line:column or scroll% syntax)';
23 |
24 | function interpretLine(cm, string) {
25 | var num = Number(string)
26 | if (/^[-+]/.test(string)) return cm.getCursor().line + num
27 | else return num - 1
28 | }
29 |
30 | CodeMirror.commands.jumpToLine = function(cm) {
31 | var cur = cm.getCursor();
32 | dialog(cm, jumpDialog, "Jump to line:", (cur.line + 1) + ":" + cur.ch, function(posStr) {
33 | if (!posStr) return;
34 |
35 | var match;
36 | if (match = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(posStr)) {
37 | cm.setCursor(interpretLine(cm, match[1]), Number(match[2]))
38 | } else if (match = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(posStr)) {
39 | var line = Math.round(cm.lineCount() * Number(match[1]) / 100);
40 | if (/^[-+]/.test(match[1])) line = cur.line + line + 1;
41 | cm.setCursor(line - 1, cur.ch);
42 | } else if (match = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(posStr)) {
43 | cm.setCursor(interpretLine(cm, match[1]), cur.ch);
44 | }
45 | });
46 | };
47 |
48 | CodeMirror.keyMap["default"]["Alt-G"] = "jumpToLine";
49 | });
50 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/edit/fromTextArea.js:
--------------------------------------------------------------------------------
1 | import { CodeMirror } from "./CodeMirror"
2 | import { activeElt } from "../util/dom"
3 | import { off, on } from "../util/event"
4 | import { copyObj } from "../util/misc"
5 |
6 | export function fromTextArea(textarea, options) {
7 | options = options ? copyObj(options) : {}
8 | options.value = textarea.value
9 | if (!options.tabindex && textarea.tabIndex)
10 | options.tabindex = textarea.tabIndex
11 | if (!options.placeholder && textarea.placeholder)
12 | options.placeholder = textarea.placeholder
13 | // Set autofocus to true if this textarea is focused, or if it has
14 | // autofocus and no other element is focused.
15 | if (options.autofocus == null) {
16 | let hasFocus = activeElt()
17 | options.autofocus = hasFocus == textarea ||
18 | textarea.getAttribute("autofocus") != null && hasFocus == document.body
19 | }
20 |
21 | function save() {textarea.value = cm.getValue()}
22 |
23 | let realSubmit
24 | if (textarea.form) {
25 | on(textarea.form, "submit", save)
26 | // Deplorable hack to make the submit method do the right thing.
27 | if (!options.leaveSubmitMethodAlone) {
28 | let form = textarea.form
29 | realSubmit = form.submit
30 | try {
31 | let wrappedSubmit = form.submit = () => {
32 | save()
33 | form.submit = realSubmit
34 | form.submit()
35 | form.submit = wrappedSubmit
36 | }
37 | } catch(e) {}
38 | }
39 | }
40 |
41 | options.finishInit = cm => {
42 | cm.save = save
43 | cm.getTextArea = () => textarea
44 | cm.toTextArea = () => {
45 | cm.toTextArea = isNaN // Prevent this from being ran twice
46 | save()
47 | textarea.parentNode.removeChild(cm.getWrapperElement())
48 | textarea.style.display = ""
49 | if (textarea.form) {
50 | off(textarea.form, "submit", save)
51 | if (typeof textarea.form.submit == "function")
52 | textarea.form.submit = realSubmit
53 | }
54 | }
55 | }
56 |
57 | textarea.style.display = "none"
58 | let cm = CodeMirror(node => textarea.parentNode.insertBefore(node, textarea.nextSibling),
59 | options)
60 | return cm
61 | }
62 |
--------------------------------------------------------------------------------
/front-vue/build/utils.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var config = require('../config/index')
3 | var ExtractTextPlugin = require('extract-text-webpack-plugin')
4 |
5 | exports.assetsPath = function (_path) {
6 | var assetsSubDirectory = process.env.NODE_ENV === 'production'
7 | ? config.build.assetsSubDirectory
8 | : config.dev.assetsSubDirectory
9 | return path.posix.join(assetsSubDirectory, _path)
10 | }
11 |
12 | exports.cssLoaders = function (options) {
13 | options = options || {}
14 |
15 | var cssLoader = {
16 | loader: 'css-loader',
17 | options: {
18 | minimize: process.env.NODE_ENV === 'production',
19 | sourceMap: options.sourceMap
20 | }
21 | }
22 |
23 | // generate loader string to be used with extract text plugin
24 | function generateLoaders (loader, loaderOptions) {
25 | var loaders = [cssLoader]
26 | if (loader) {
27 | loaders.push({
28 | loader: loader + '-loader',
29 | options: Object.assign({}, loaderOptions, {
30 | sourceMap: options.sourceMap
31 | })
32 | })
33 | }
34 |
35 | // Extract CSS when that option is specified
36 | // (which is the case during production build)
37 | if (options.extract) {
38 | return ExtractTextPlugin.extract({
39 | use: loaders,
40 | fallback: 'vue-style-loader'
41 | })
42 | } else {
43 | return ['vue-style-loader'].concat(loaders)
44 | }
45 | }
46 |
47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html
48 | return {
49 | css: generateLoaders(),
50 | postcss: generateLoaders(),
51 | less: generateLoaders('less'),
52 | sass: generateLoaders('sass', { indentedSyntax: true }),
53 | scss: generateLoaders('sass'),
54 | stylus: generateLoaders('stylus'),
55 | styl: generateLoaders('stylus')
56 | }
57 | }
58 |
59 | // Generate loaders for standalone style files (outside of .vue)
60 | exports.styleLoaders = function (options) {
61 | var output = []
62 | var loaders = exports.cssLoaders(options)
63 | for (var extension in loaders) {
64 | var loader = loaders[extension]
65 | output.push({
66 | test: new RegExp('\\.' + extension + '$'),
67 | use: loader
68 | })
69 | }
70 | return output
71 | }
72 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/tern/tern.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-Tern-completion {
2 | padding-left: 22px;
3 | position: relative;
4 | line-height: 1.5;
5 | }
6 | .CodeMirror-Tern-completion:before {
7 | position: absolute;
8 | left: 2px;
9 | bottom: 2px;
10 | border-radius: 50%;
11 | font-size: 12px;
12 | font-weight: bold;
13 | height: 15px;
14 | width: 15px;
15 | line-height: 16px;
16 | text-align: center;
17 | color: white;
18 | -moz-box-sizing: border-box;
19 | box-sizing: border-box;
20 | }
21 | .CodeMirror-Tern-completion-unknown:before {
22 | content: "?";
23 | background: #4bb;
24 | }
25 | .CodeMirror-Tern-completion-object:before {
26 | content: "O";
27 | background: #77c;
28 | }
29 | .CodeMirror-Tern-completion-fn:before {
30 | content: "F";
31 | background: #7c7;
32 | }
33 | .CodeMirror-Tern-completion-array:before {
34 | content: "A";
35 | background: #c66;
36 | }
37 | .CodeMirror-Tern-completion-number:before {
38 | content: "1";
39 | background: #999;
40 | }
41 | .CodeMirror-Tern-completion-string:before {
42 | content: "S";
43 | background: #999;
44 | }
45 | .CodeMirror-Tern-completion-bool:before {
46 | content: "B";
47 | background: #999;
48 | }
49 |
50 | .CodeMirror-Tern-completion-guess {
51 | color: #999;
52 | }
53 |
54 | .CodeMirror-Tern-tooltip {
55 | border: 1px solid silver;
56 | border-radius: 3px;
57 | color: #444;
58 | padding: 2px 5px;
59 | font-size: 90%;
60 | font-family: monospace;
61 | background-color: white;
62 | white-space: pre-wrap;
63 |
64 | max-width: 40em;
65 | position: absolute;
66 | z-index: 10;
67 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
68 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
69 | box-shadow: 2px 3px 5px rgba(0,0,0,.2);
70 |
71 | transition: opacity 1s;
72 | -moz-transition: opacity 1s;
73 | -webkit-transition: opacity 1s;
74 | -o-transition: opacity 1s;
75 | -ms-transition: opacity 1s;
76 | }
77 |
78 | .CodeMirror-Tern-hint-doc {
79 | max-width: 25em;
80 | margin-top: -3px;
81 | }
82 |
83 | .CodeMirror-Tern-fname { color: black; }
84 | .CodeMirror-Tern-farg { color: #70a; }
85 | .CodeMirror-Tern-farg-current { text-decoration: underline; }
86 | .CodeMirror-Tern-type { color: #07c; }
87 | .CodeMirror-Tern-fhint-guess { opacity: .7; }
88 |
--------------------------------------------------------------------------------
/front-vue/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-os",
3 | "version": "1.0.0",
4 | "description": "A Vue.js project",
5 | "author": "qwer <676080017@qq.com>",
6 | "private": true,
7 | "scripts": {
8 | "dev": "node build/dev-server.js",
9 | "start": "node build/dev-server.js",
10 | "build": "node build/build.js",
11 | "lint": "eslint --ext .js,.vue src"
12 | },
13 | "dependencies": {
14 | "axios": "^0.16.1",
15 | "vue": "^2.2.6",
16 | "vue-router": "^2.3.1",
17 | "vuex": "^2.3.1"
18 | },
19 | "devDependencies": {
20 | "autoprefixer": "^6.7.2",
21 | "babel-core": "^6.22.1",
22 | "babel-eslint": "^7.1.1",
23 | "babel-loader": "^6.2.10",
24 | "babel-plugin-transform-runtime": "^6.22.0",
25 | "babel-preset-env": "^1.3.2",
26 | "babel-preset-stage-2": "^6.22.0",
27 | "babel-register": "^6.22.0",
28 | "chalk": "^1.1.3",
29 | "connect-history-api-fallback": "^1.3.0",
30 | "copy-webpack-plugin": "^4.0.1",
31 | "css-loader": "^0.28.0",
32 | "eslint": "^3.19.0",
33 | "eslint-config-standard": "^6.2.1",
34 | "eslint-friendly-formatter": "^2.0.7",
35 | "eslint-loader": "^1.7.1",
36 | "eslint-plugin-html": "^2.0.0",
37 | "eslint-plugin-promise": "^3.4.0",
38 | "eslint-plugin-standard": "^2.0.1",
39 | "eventsource-polyfill": "^0.9.6",
40 | "express": "^4.14.1",
41 | "extract-text-webpack-plugin": "^2.0.0",
42 | "file-loader": "^0.11.1",
43 | "friendly-errors-webpack-plugin": "^1.1.3",
44 | "html-webpack-plugin": "^2.28.0",
45 | "http-proxy-middleware": "^0.17.3",
46 | "opn": "^4.0.2",
47 | "optimize-css-assets-webpack-plugin": "^1.3.0",
48 | "ora": "^1.2.0",
49 | "rimraf": "^2.6.0",
50 | "semver": "^5.3.0",
51 | "shelljs": "^0.7.6",
52 | "url-loader": "^0.5.8",
53 | "vue-loader": "^11.3.4",
54 | "vue-style-loader": "^2.0.5",
55 | "vue-template-compiler": "^2.2.6",
56 | "webpack": "^2.3.3",
57 | "webpack-bundle-analyzer": "^2.2.1",
58 | "webpack-dev-middleware": "^1.10.0",
59 | "webpack-hot-middleware": "^2.18.0",
60 | "webpack-merge": "^4.1.0"
61 | },
62 | "engines": {
63 | "node": ">= 4.0.0",
64 | "npm": ">= 3.0.0"
65 | },
66 | "browserslist": [
67 | "> 1%",
68 | "last 2 versions",
69 | "not ie <= 8"
70 | ]
71 | }
72 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/edit/main.js:
--------------------------------------------------------------------------------
1 | // EDITOR CONSTRUCTOR
2 |
3 | import { CodeMirror } from "./CodeMirror"
4 | export { CodeMirror } from "./CodeMirror"
5 |
6 | import { eventMixin } from "../util/event"
7 | import { indexOf } from "../util/misc"
8 |
9 | import { defineOptions } from "./options"
10 |
11 | defineOptions(CodeMirror)
12 |
13 | import addEditorMethods from "./methods"
14 |
15 | addEditorMethods(CodeMirror)
16 |
17 | import Doc from "../model/Doc"
18 |
19 | // Set up methods on CodeMirror's prototype to redirect to the editor's document.
20 | let dontDelegate = "iter insert remove copy getEditor constructor".split(" ")
21 | for (let prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
22 | CodeMirror.prototype[prop] = (function(method) {
23 | return function() {return method.apply(this.doc, arguments)}
24 | })(Doc.prototype[prop])
25 |
26 | eventMixin(Doc)
27 |
28 | // INPUT HANDLING
29 |
30 | import ContentEditableInput from "../input/ContentEditableInput"
31 | import TextareaInput from "../input/TextareaInput"
32 | CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput}
33 |
34 | // MODE DEFINITION AND QUERYING
35 |
36 | import { defineMIME, defineMode } from "../modes"
37 |
38 | // Extra arguments are stored as the mode's dependencies, which is
39 | // used by (legacy) mechanisms like loadmode.js to automatically
40 | // load a mode. (Preferred mechanism is the require/define calls.)
41 | CodeMirror.defineMode = function(name/*, mode, …*/) {
42 | if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name
43 | defineMode.apply(this, arguments)
44 | }
45 |
46 | CodeMirror.defineMIME = defineMIME
47 |
48 | // Minimal default mode.
49 | CodeMirror.defineMode("null", () => ({token: stream => stream.skipToEnd()}))
50 | CodeMirror.defineMIME("text/plain", "null")
51 |
52 | // EXTENSIONS
53 |
54 | CodeMirror.defineExtension = (name, func) => {
55 | CodeMirror.prototype[name] = func
56 | }
57 | CodeMirror.defineDocExtension = (name, func) => {
58 | Doc.prototype[name] = func
59 | }
60 |
61 | import { fromTextArea } from "./fromTextArea"
62 |
63 | CodeMirror.fromTextArea = fromTextArea
64 |
65 | import { addLegacyProps } from "./legacy"
66 |
67 | addLegacyProps(CodeMirror)
68 |
69 | CodeMirror.version = "5.25.3"
70 |
--------------------------------------------------------------------------------
/JsBox/service/verifyCode.js:
--------------------------------------------------------------------------------
1 | var verifyCode = {
2 | getCode: function () {
3 | var result = {}
4 | var poemLength = poems.length
5 | var curIndex = Math.round(Math.random() * (poemLength - 1))
6 | var confuseIndexs = []
7 | while (confuseIndexs.length < 3) {
8 | var tempIndex = Math.round(Math.random() * (poemLength - 1))
9 | if (curIndex !== tempIndex) {
10 | var hasEqual = false
11 | confuseIndexs.forEach(function (i) {
12 | if (i === tempIndex) {
13 | hasEqual = true
14 | }
15 | })
16 | if (!hasEqual) {
17 | confuseIndexs.push(tempIndex)
18 | }
19 | }
20 | }
21 |
22 | var currentPoem = poems[curIndex]
23 | var curRandom = Math.round(Math.random() * (currentPoem.length - 2))
24 | result.poem = currentPoem[curRandom]
25 | result.answer = currentPoem[curRandom + 1]
26 | result.options = []
27 | var optionRandom = Math.round(Math.random() * (confuseIndexs.length - 1))
28 | confuseIndexs.forEach(function (index) {
29 | if (index === confuseIndexs[optionRandom]) {
30 | result.options.push(currentPoem[curRandom + 1])
31 | }
32 | var cPoem = poems[index]
33 | var cRandom = Math.round(Math.random() * (cPoem.length - 1))
34 | result.options.push(cPoem[cRandom])
35 | })
36 | return result
37 | }
38 | }
39 |
40 | module.exports = verifyCode
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | var poems = [[
64 | '慈母手中线', '游子身上衣','临行密密缝','意恐迟迟归','谁言寸草心','报得三春晖'
65 | ], [
66 | '千山鸟飞绝', '万径人踪灭', '孤舟蓑笠翁', '独钓寒江雪'
67 | ], [
68 | '松下问童子', '言师采药去', '只在此山中', '云深不知处'
69 | ], [
70 | '月落乌啼霜满天', '江枫渔火对愁眠', '姑苏城外寒山寺', '夜半钟声到客船'
71 | ], [
72 | '湖光秋月两相和', '潭面无风镜未磨', '遥望洞庭山水翠', '白银盘里一青螺'
73 | ], [
74 | '锄禾日当午', '汗滴禾下土', '谁知盘中餐', '粒粒皆辛苦'
75 | ], [
76 | '清明时节雨纷纷', '路上行人欲断魂', '借问酒家何处有', '牧童遥指杏花村'
77 | ], [
78 | '千里莺啼绿映红', '水村山郭酒旗风', '南朝四百八十寺', '多少楼台烟雨中'
79 | ], [
80 | '爆竹声中一岁除', '春风送暖入屠苏', '千门万户曈曈日', '总把新桃换旧符'
81 | ], [
82 | '竹外桃花三两枝', '春江水暖鸭先知', '蒌蒿满地芦芽短', '正是河豚欲上时'
83 | ], [
84 | '生当作人杰', '死亦为鬼雄', '至今思项羽', '不肯过江东'
85 | ], [
86 | '毕竟西湖六月中', '风光不与四时同', '接天莲叶无穷碧', '映日荷花别样红'
87 | ], [
88 | '草长莺飞二月天', '拂堤杨柳醉春烟', '儿童散学归来早', '忙趁东风放纸鸢'
89 | ], [
90 | '两个黄鹂鸣翠柳', '一行白鹭上青天', '窗含西岭千秋雪', '门泊东吴万里船'
91 | ]]
92 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/display/line_numbers.js:
--------------------------------------------------------------------------------
1 | import { lineNumberFor } from "../line/utils_line"
2 | import { compensateForHScroll } from "../measurement/position_measurement"
3 | import { elt } from "../util/dom"
4 |
5 | import { updateGutterSpace } from "./update_display"
6 |
7 | // Re-align line numbers and gutter marks to compensate for
8 | // horizontal scrolling.
9 | export function alignHorizontally(cm) {
10 | let display = cm.display, view = display.view
11 | if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return
12 | let comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft
13 | let gutterW = display.gutters.offsetWidth, left = comp + "px"
14 | for (let i = 0; i < view.length; i++) if (!view[i].hidden) {
15 | if (cm.options.fixedGutter) {
16 | if (view[i].gutter)
17 | view[i].gutter.style.left = left
18 | if (view[i].gutterBackground)
19 | view[i].gutterBackground.style.left = left
20 | }
21 | let align = view[i].alignable
22 | if (align) for (let j = 0; j < align.length; j++)
23 | align[j].style.left = left
24 | }
25 | if (cm.options.fixedGutter)
26 | display.gutters.style.left = (comp + gutterW) + "px"
27 | }
28 |
29 | // Used to ensure that the line number gutter is still the right
30 | // size for the current document size. Returns true when an update
31 | // is needed.
32 | export function maybeUpdateLineNumberWidth(cm) {
33 | if (!cm.options.lineNumbers) return false
34 | let doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display
35 | if (last.length != display.lineNumChars) {
36 | let test = display.measure.appendChild(elt("div", [elt("div", last)],
37 | "CodeMirror-linenumber CodeMirror-gutter-elt"))
38 | let innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW
39 | display.lineGutter.style.width = ""
40 | display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1
41 | display.lineNumWidth = display.lineNumInnerWidth + padding
42 | display.lineNumChars = display.lineNumInnerWidth ? last.length : -1
43 | display.lineGutter.style.width = display.lineNumWidth + "px"
44 | updateGutterSpace(cm)
45 | return true
46 | }
47 | return false
48 | }
49 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/theme/erlang-dark.css:
--------------------------------------------------------------------------------
1 | .cm-s-erlang-dark.CodeMirror { background: #002240; color: white; }
2 | .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539; }
3 | .cm-s-erlang-dark .CodeMirror-line::selection, .cm-s-erlang-dark .CodeMirror-line > span::selection, .cm-s-erlang-dark .CodeMirror-line > span > span::selection { background: rgba(179, 101, 57, .99); }
4 | .cm-s-erlang-dark .CodeMirror-line::-moz-selection, .cm-s-erlang-dark .CodeMirror-line > span::-moz-selection, .cm-s-erlang-dark .CodeMirror-line > span > span::-moz-selection { background: rgba(179, 101, 57, .99); }
5 | .cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
6 | .cm-s-erlang-dark .CodeMirror-guttermarker { color: white; }
7 | .cm-s-erlang-dark .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
8 | .cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; }
9 | .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white; }
10 |
11 | .cm-s-erlang-dark span.cm-quote { color: #ccc; }
12 | .cm-s-erlang-dark span.cm-atom { color: #f133f1; }
13 | .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
14 | .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
15 | .cm-s-erlang-dark span.cm-builtin { color: #eaa; }
16 | .cm-s-erlang-dark span.cm-comment { color: #77f; }
17 | .cm-s-erlang-dark span.cm-def { color: #e7a; }
18 | .cm-s-erlang-dark span.cm-keyword { color: #ffee80; }
19 | .cm-s-erlang-dark span.cm-meta { color: #50fefe; }
20 | .cm-s-erlang-dark span.cm-number { color: #ffd0d0; }
21 | .cm-s-erlang-dark span.cm-operator { color: #d55; }
22 | .cm-s-erlang-dark span.cm-property { color: #ccc; }
23 | .cm-s-erlang-dark span.cm-qualifier { color: #ccc; }
24 | .cm-s-erlang-dark span.cm-special { color: #ffbbbb; }
25 | .cm-s-erlang-dark span.cm-string { color: #3ad900; }
26 | .cm-s-erlang-dark span.cm-string-2 { color: #ccc; }
27 | .cm-s-erlang-dark span.cm-tag { color: #9effff; }
28 | .cm-s-erlang-dark span.cm-variable { color: #50fe50; }
29 | .cm-s-erlang-dark span.cm-variable-2 { color: #e0e; }
30 | .cm-s-erlang-dark span.cm-variable-3 { color: #ccc; }
31 | .cm-s-erlang-dark span.cm-error { color: #9d1e15; }
32 |
33 | .cm-s-erlang-dark .CodeMirror-activeline-background { background: #013461; }
34 | .cm-s-erlang-dark .CodeMirror-matchingbracket { outline:1px solid grey; color:white !important; }
35 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/display/highlight_worker.js:
--------------------------------------------------------------------------------
1 | import { getStateBefore, highlightLine, processLine } from "../line/highlight"
2 | import { copyState } from "../modes"
3 | import { bind } from "../util/misc"
4 |
5 | import { runInOp } from "./operations"
6 | import { regLineChange } from "./view_tracking"
7 |
8 | // HIGHLIGHT WORKER
9 |
10 | export function startWorker(cm, time) {
11 | if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
12 | cm.state.highlight.set(time, bind(highlightWorker, cm))
13 | }
14 |
15 | function highlightWorker(cm) {
16 | let doc = cm.doc
17 | if (doc.frontier < doc.first) doc.frontier = doc.first
18 | if (doc.frontier >= cm.display.viewTo) return
19 | let end = +new Date + cm.options.workTime
20 | let state = copyState(doc.mode, getStateBefore(cm, doc.frontier))
21 | let changedLines = []
22 |
23 | doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), line => {
24 | if (doc.frontier >= cm.display.viewFrom) { // Visible
25 | let oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength
26 | let highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true)
27 | line.styles = highlighted.styles
28 | let oldCls = line.styleClasses, newCls = highlighted.classes
29 | if (newCls) line.styleClasses = newCls
30 | else if (oldCls) line.styleClasses = null
31 | let ischange = !oldStyles || oldStyles.length != line.styles.length ||
32 | oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass)
33 | for (let i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i]
34 | if (ischange) changedLines.push(doc.frontier)
35 | line.stateAfter = tooLong ? state : copyState(doc.mode, state)
36 | } else {
37 | if (line.text.length <= cm.options.maxHighlightLength)
38 | processLine(cm, line.text, state)
39 | line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null
40 | }
41 | ++doc.frontier
42 | if (+new Date > end) {
43 | startWorker(cm, cm.options.workDelay)
44 | return true
45 | }
46 | })
47 | if (changedLines.length) runInOp(cm, () => {
48 | for (let i = 0; i < changedLines.length; i++)
49 | regLineChange(cm, changedLines[i], "text")
50 | })
51 | }
52 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/display/placeholder.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | CodeMirror.defineOption("placeholder", "", function(cm, val, old) {
13 | var prev = old && old != CodeMirror.Init;
14 | if (val && !prev) {
15 | cm.on("blur", onBlur);
16 | cm.on("change", onChange);
17 | cm.on("swapDoc", onChange);
18 | onChange(cm);
19 | } else if (!val && prev) {
20 | cm.off("blur", onBlur);
21 | cm.off("change", onChange);
22 | cm.off("swapDoc", onChange);
23 | clearPlaceholder(cm);
24 | var wrapper = cm.getWrapperElement();
25 | wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
26 | }
27 |
28 | if (val && !cm.hasFocus()) onBlur(cm);
29 | });
30 |
31 | function clearPlaceholder(cm) {
32 | if (cm.state.placeholder) {
33 | cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
34 | cm.state.placeholder = null;
35 | }
36 | }
37 | function setPlaceholder(cm) {
38 | clearPlaceholder(cm);
39 | var elt = cm.state.placeholder = document.createElement("pre");
40 | elt.style.cssText = "height: 0; overflow: visible";
41 | elt.className = "CodeMirror-placeholder";
42 | var placeHolder = cm.getOption("placeholder")
43 | if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
44 | elt.appendChild(placeHolder)
45 | cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
46 | }
47 |
48 | function onBlur(cm) {
49 | if (isEmpty(cm)) setPlaceholder(cm);
50 | }
51 | function onChange(cm) {
52 | var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
53 | wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
54 |
55 | if (empty) setPlaceholder(cm);
56 | else clearPlaceholder(cm);
57 | }
58 |
59 | function isEmpty(cm) {
60 | return (cm.lineCount() === 1) && (cm.getLine(0) === "");
61 | }
62 | });
63 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/fold/comment-fold.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {
15 | return mode.blockCommentStart && mode.blockCommentEnd;
16 | }, function(cm, start) {
17 | var mode = cm.getModeAt(start), startToken = mode.blockCommentStart, endToken = mode.blockCommentEnd;
18 | if (!startToken || !endToken) return;
19 | var line = start.line, lineText = cm.getLine(line);
20 |
21 | var startCh;
22 | for (var at = start.ch, pass = 0;;) {
23 | var found = at <= 0 ? -1 : lineText.lastIndexOf(startToken, at - 1);
24 | if (found == -1) {
25 | if (pass == 1) return;
26 | pass = 1;
27 | at = lineText.length;
28 | continue;
29 | }
30 | if (pass == 1 && found < start.ch) return;
31 | if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) &&
32 | (found == 0 || lineText.slice(found - endToken.length, found) == endToken ||
33 | !/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) {
34 | startCh = found + startToken.length;
35 | break;
36 | }
37 | at = found - 1;
38 | }
39 |
40 | var depth = 1, lastLine = cm.lastLine(), end, endCh;
41 | outer: for (var i = line; i <= lastLine; ++i) {
42 | var text = cm.getLine(i), pos = i == line ? startCh : 0;
43 | for (;;) {
44 | var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
45 | if (nextOpen < 0) nextOpen = text.length;
46 | if (nextClose < 0) nextClose = text.length;
47 | pos = Math.min(nextOpen, nextClose);
48 | if (pos == text.length) break;
49 | if (pos == nextOpen) ++depth;
50 | else if (!--depth) { end = i; endCh = pos; break outer; }
51 | ++pos;
52 | }
53 | }
54 | if (end == null || line == end && endCh == startCh) return;
55 | return {from: CodeMirror.Pos(line, startCh),
56 | to: CodeMirror.Pos(end, endCh)};
57 | });
58 |
59 | });
60 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/hint/css-hint.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"), require("../../mode/css/css"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror", "../../mode/css/css"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var pseudoClasses = {link: 1, visited: 1, active: 1, hover: 1, focus: 1,
15 | "first-letter": 1, "first-line": 1, "first-child": 1,
16 | before: 1, after: 1, lang: 1};
17 |
18 | CodeMirror.registerHelper("hint", "css", function(cm) {
19 | var cur = cm.getCursor(), token = cm.getTokenAt(cur);
20 | var inner = CodeMirror.innerMode(cm.getMode(), token.state);
21 | if (inner.mode.name != "css") return;
22 |
23 | if (token.type == "keyword" && "!important".indexOf(token.string) == 0)
24 | return {list: ["!important"], from: CodeMirror.Pos(cur.line, token.start),
25 | to: CodeMirror.Pos(cur.line, token.end)};
26 |
27 | var start = token.start, end = cur.ch, word = token.string.slice(0, end - start);
28 | if (/[^\w$_-]/.test(word)) {
29 | word = ""; start = end = cur.ch;
30 | }
31 |
32 | var spec = CodeMirror.resolveMode("text/css");
33 |
34 | var result = [];
35 | function add(keywords) {
36 | for (var name in keywords)
37 | if (!word || name.lastIndexOf(word, 0) == 0)
38 | result.push(name);
39 | }
40 |
41 | var st = inner.state.state;
42 | if (st == "pseudo" || token.type == "variable-3") {
43 | add(pseudoClasses);
44 | } else if (st == "block" || st == "maybeprop") {
45 | add(spec.propertyKeywords);
46 | } else if (st == "prop" || st == "parens" || st == "at" || st == "params") {
47 | add(spec.valueKeywords);
48 | add(spec.colorKeywords);
49 | } else if (st == "media" || st == "media_parens") {
50 | add(spec.mediaTypes);
51 | add(spec.mediaFeatures);
52 | }
53 |
54 | if (result.length) return {
55 | list: result,
56 | from: CodeMirror.Pos(cur.line, start),
57 | to: CodeMirror.Pos(cur.line, end)
58 | };
59 | });
60 | });
61 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/util/operation_group.js:
--------------------------------------------------------------------------------
1 | import { getHandlers } from "./event"
2 |
3 | let operationGroup = null
4 |
5 | export function pushOperation(op) {
6 | if (operationGroup) {
7 | operationGroup.ops.push(op)
8 | } else {
9 | op.ownsGroup = operationGroup = {
10 | ops: [op],
11 | delayedCallbacks: []
12 | }
13 | }
14 | }
15 |
16 | function fireCallbacksForOps(group) {
17 | // Calls delayed callbacks and cursorActivity handlers until no
18 | // new ones appear
19 | let callbacks = group.delayedCallbacks, i = 0
20 | do {
21 | for (; i < callbacks.length; i++)
22 | callbacks[i].call(null)
23 | for (let j = 0; j < group.ops.length; j++) {
24 | let op = group.ops[j]
25 | if (op.cursorActivityHandlers)
26 | while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
27 | op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm)
28 | }
29 | } while (i < callbacks.length)
30 | }
31 |
32 | export function finishOperation(op, endCb) {
33 | let group = op.ownsGroup
34 | if (!group) return
35 |
36 | try { fireCallbacksForOps(group) }
37 | finally {
38 | operationGroup = null
39 | endCb(group)
40 | }
41 | }
42 |
43 | let orphanDelayedCallbacks = null
44 |
45 | // Often, we want to signal events at a point where we are in the
46 | // middle of some work, but don't want the handler to start calling
47 | // other methods on the editor, which might be in an inconsistent
48 | // state or simply not expect any other events to happen.
49 | // signalLater looks whether there are any handlers, and schedules
50 | // them to be executed when the last operation ends, or, if no
51 | // operation is active, when a timeout fires.
52 | export function signalLater(emitter, type /*, values...*/) {
53 | let arr = getHandlers(emitter, type)
54 | if (!arr.length) return
55 | let args = Array.prototype.slice.call(arguments, 2), list
56 | if (operationGroup) {
57 | list = operationGroup.delayedCallbacks
58 | } else if (orphanDelayedCallbacks) {
59 | list = orphanDelayedCallbacks
60 | } else {
61 | list = orphanDelayedCallbacks = []
62 | setTimeout(fireOrphanDelayed, 0)
63 | }
64 | for (let i = 0; i < arr.length; ++i)
65 | list.push(() => arr[i].apply(null, args))
66 | }
67 |
68 | function fireOrphanDelayed() {
69 | let delayed = orphanDelayedCallbacks
70 | orphanDelayedCallbacks = null
71 | for (let i = 0; i < delayed.length; ++i) delayed[i]()
72 | }
73 |
--------------------------------------------------------------------------------
/front-vue/src/components/popShare.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
请复制下面代码粘贴到需要的地方
5 |
7 |
复制好了\(^o^)/~
8 |
9 |
10 |
11 |
12 |
13 |
54 |
55 |
99 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/model/change_measurement.js:
--------------------------------------------------------------------------------
1 | import { cmp, Pos } from "../line/pos"
2 | import { lst } from "../util/misc"
3 |
4 | import { normalizeSelection, Range, Selection } from "./selection"
5 |
6 | // Compute the position of the end of a change (its 'to' property
7 | // refers to the pre-change end).
8 | export function changeEnd(change) {
9 | if (!change.text) return change.to
10 | return Pos(change.from.line + change.text.length - 1,
11 | lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
12 | }
13 |
14 | // Adjust a position to refer to the post-change position of the
15 | // same text, or the end of the change if the change covers it.
16 | function adjustForChange(pos, change) {
17 | if (cmp(pos, change.from) < 0) return pos
18 | if (cmp(pos, change.to) <= 0) return changeEnd(change)
19 |
20 | let line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch
21 | if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch
22 | return Pos(line, ch)
23 | }
24 |
25 | export function computeSelAfterChange(doc, change) {
26 | let out = []
27 | for (let i = 0; i < doc.sel.ranges.length; i++) {
28 | let range = doc.sel.ranges[i]
29 | out.push(new Range(adjustForChange(range.anchor, change),
30 | adjustForChange(range.head, change)))
31 | }
32 | return normalizeSelection(out, doc.sel.primIndex)
33 | }
34 |
35 | function offsetPos(pos, old, nw) {
36 | if (pos.line == old.line)
37 | return Pos(nw.line, pos.ch - old.ch + nw.ch)
38 | else
39 | return Pos(nw.line + (pos.line - old.line), pos.ch)
40 | }
41 |
42 | // Used by replaceSelections to allow moving the selection to the
43 | // start or around the replaced test. Hint may be "start" or "around".
44 | export function computeReplacedSel(doc, changes, hint) {
45 | let out = []
46 | let oldPrev = Pos(doc.first, 0), newPrev = oldPrev
47 | for (let i = 0; i < changes.length; i++) {
48 | let change = changes[i]
49 | let from = offsetPos(change.from, oldPrev, newPrev)
50 | let to = offsetPos(changeEnd(change), oldPrev, newPrev)
51 | oldPrev = change.to
52 | newPrev = to
53 | if (hint == "around") {
54 | let range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0
55 | out[i] = new Range(inv ? to : from, inv ? from : to)
56 | } else {
57 | out[i] = new Range(from, from)
58 | }
59 | }
60 | return new Selection(out, doc.sel.primIndex)
61 | }
62 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/mode/loadmode.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"), "cjs");
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], function(CM) { mod(CM, "amd"); });
9 | else // Plain browser env
10 | mod(CodeMirror, "plain");
11 | })(function(CodeMirror, env) {
12 | if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
13 |
14 | var loading = {};
15 | function splitCallback(cont, n) {
16 | var countDown = n;
17 | return function() { if (--countDown == 0) cont(); };
18 | }
19 | function ensureDeps(mode, cont) {
20 | var deps = CodeMirror.modes[mode].dependencies;
21 | if (!deps) return cont();
22 | var missing = [];
23 | for (var i = 0; i < deps.length; ++i) {
24 | if (!CodeMirror.modes.hasOwnProperty(deps[i]))
25 | missing.push(deps[i]);
26 | }
27 | if (!missing.length) return cont();
28 | var split = splitCallback(cont, missing.length);
29 | for (var i = 0; i < missing.length; ++i)
30 | CodeMirror.requireMode(missing[i], split);
31 | }
32 |
33 | CodeMirror.requireMode = function(mode, cont) {
34 | if (typeof mode != "string") mode = mode.name;
35 | if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
36 | if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
37 |
38 | var file = CodeMirror.modeURL.replace(/%N/g, mode);
39 | if (env == "plain") {
40 | var script = document.createElement("script");
41 | script.src = file;
42 | var others = document.getElementsByTagName("script")[0];
43 | var list = loading[mode] = [cont];
44 | CodeMirror.on(script, "load", function() {
45 | ensureDeps(mode, function() {
46 | for (var i = 0; i < list.length; ++i) list[i]();
47 | });
48 | });
49 | others.parentNode.insertBefore(script, others);
50 | } else if (env == "cjs") {
51 | require(file);
52 | cont();
53 | } else if (env == "amd") {
54 | requirejs([file], cont);
55 | }
56 | };
57 |
58 | CodeMirror.autoLoadMode = function(instance, mode) {
59 | if (!CodeMirror.modes.hasOwnProperty(mode))
60 | CodeMirror.requireMode(mode, function() {
61 | instance.setOption("mode", instance.getOption("mode"));
62 | });
63 | };
64 | });
65 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/edit/matchtags.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror", "../fold/xml-fold"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.defineOption("matchTags", false, function(cm, val, old) {
15 | if (old && old != CodeMirror.Init) {
16 | cm.off("cursorActivity", doMatchTags);
17 | cm.off("viewportChange", maybeUpdateMatch);
18 | clear(cm);
19 | }
20 | if (val) {
21 | cm.state.matchBothTags = typeof val == "object" && val.bothTags;
22 | cm.on("cursorActivity", doMatchTags);
23 | cm.on("viewportChange", maybeUpdateMatch);
24 | doMatchTags(cm);
25 | }
26 | });
27 |
28 | function clear(cm) {
29 | if (cm.state.tagHit) cm.state.tagHit.clear();
30 | if (cm.state.tagOther) cm.state.tagOther.clear();
31 | cm.state.tagHit = cm.state.tagOther = null;
32 | }
33 |
34 | function doMatchTags(cm) {
35 | cm.state.failedTagMatch = false;
36 | cm.operation(function() {
37 | clear(cm);
38 | if (cm.somethingSelected()) return;
39 | var cur = cm.getCursor(), range = cm.getViewport();
40 | range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);
41 | var match = CodeMirror.findMatchingTag(cm, cur, range);
42 | if (!match) return;
43 | if (cm.state.matchBothTags) {
44 | var hit = match.at == "open" ? match.open : match.close;
45 | if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
46 | }
47 | var other = match.at == "close" ? match.open : match.close;
48 | if (other)
49 | cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
50 | else
51 | cm.state.failedTagMatch = true;
52 | });
53 | }
54 |
55 | function maybeUpdateMatch(cm) {
56 | if (cm.state.failedTagMatch) doMatchTags(cm);
57 | }
58 |
59 | CodeMirror.commands.toMatchingTag = function(cm) {
60 | var found = CodeMirror.findMatchingTag(cm, cm.getCursor());
61 | if (found) {
62 | var other = found.at == "close" ? found.open : found.close;
63 | if (other) cm.extendSelection(other.to, other.from);
64 | }
65 | };
66 | });
67 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/edit/legacy.js:
--------------------------------------------------------------------------------
1 | import { scrollbarModel } from "../display/scrollbars"
2 | import { wheelEventPixels } from "../display/scroll_events"
3 | import { keyMap, keyName, isModifierKey, lookupKey, normalizeKeyMap } from "../input/keymap"
4 | import { keyNames } from "../input/keynames"
5 | import { Line } from "../line/line_data"
6 | import { cmp, Pos } from "../line/pos"
7 | import { changeEnd } from "../model/change_measurement"
8 | import Doc from "../model/Doc"
9 | import { LineWidget } from "../model/line_widget"
10 | import { SharedTextMarker, TextMarker } from "../model/mark_text"
11 | import { copyState, extendMode, getMode, innerMode, mimeModes, modeExtensions, modes, resolveMode, startState } from "../modes"
12 | import { addClass, contains, rmClass } from "../util/dom"
13 | import { e_preventDefault, e_stop, e_stopPropagation, off, on, signal } from "../util/event"
14 | import { splitLinesAuto } from "../util/feature_detection"
15 | import { countColumn, findColumn, isWordCharBasic, Pass } from "../util/misc"
16 | import StringStream from "../util/StringStream"
17 |
18 | import { commands } from "./commands"
19 |
20 | export function addLegacyProps(CodeMirror) {
21 | CodeMirror.off = off
22 | CodeMirror.on = on
23 | CodeMirror.wheelEventPixels = wheelEventPixels
24 | CodeMirror.Doc = Doc
25 | CodeMirror.splitLines = splitLinesAuto
26 | CodeMirror.countColumn = countColumn
27 | CodeMirror.findColumn = findColumn
28 | CodeMirror.isWordChar = isWordCharBasic
29 | CodeMirror.Pass = Pass
30 | CodeMirror.signal = signal
31 | CodeMirror.Line = Line
32 | CodeMirror.changeEnd = changeEnd
33 | CodeMirror.scrollbarModel = scrollbarModel
34 | CodeMirror.Pos = Pos
35 | CodeMirror.cmpPos = cmp
36 | CodeMirror.modes = modes
37 | CodeMirror.mimeModes = mimeModes
38 | CodeMirror.resolveMode = resolveMode
39 | CodeMirror.getMode = getMode
40 | CodeMirror.modeExtensions = modeExtensions
41 | CodeMirror.extendMode = extendMode
42 | CodeMirror.copyState = copyState
43 | CodeMirror.startState = startState
44 | CodeMirror.innerMode = innerMode
45 | CodeMirror.commands = commands
46 | CodeMirror.keyMap = keyMap
47 | CodeMirror.keyName = keyName
48 | CodeMirror.isModifierKey = isModifierKey
49 | CodeMirror.lookupKey = lookupKey
50 | CodeMirror.normalizeKeyMap = normalizeKeyMap
51 | CodeMirror.StringStream = StringStream
52 | CodeMirror.SharedTextMarker = SharedTextMarker
53 | CodeMirror.TextMarker = TextMarker
54 | CodeMirror.LineWidget = LineWidget
55 | CodeMirror.e_preventDefault = e_preventDefault
56 | CodeMirror.e_stopPropagation = e_stopPropagation
57 | CodeMirror.e_stop = e_stop
58 | CodeMirror.addClass = addClass
59 | CodeMirror.contains = contains
60 | CodeMirror.rmClass = rmClass
61 | CodeMirror.keyNames = keyNames
62 | }
63 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/runmode/runmode.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.runMode = function(string, modespec, callback, options) {
15 | var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
16 | var ie = /MSIE \d/.test(navigator.userAgent);
17 | var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
18 |
19 | if (callback.appendChild) {
20 | var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
21 | var node = callback, col = 0;
22 | node.innerHTML = "";
23 | callback = function(text, style) {
24 | if (text == "\n") {
25 | // Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
26 | // Emitting a carriage return makes everything ok.
27 | node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
28 | col = 0;
29 | return;
30 | }
31 | var content = "";
32 | // replace tabs
33 | for (var pos = 0;;) {
34 | var idx = text.indexOf("\t", pos);
35 | if (idx == -1) {
36 | content += text.slice(pos);
37 | col += text.length - pos;
38 | break;
39 | } else {
40 | col += idx - pos;
41 | content += text.slice(pos, idx);
42 | var size = tabSize - col % tabSize;
43 | col += size;
44 | for (var i = 0; i < size; ++i) content += " ";
45 | pos = idx + 1;
46 | }
47 | }
48 |
49 | if (style) {
50 | var sp = node.appendChild(document.createElement("span"));
51 | sp.className = "cm-" + style.replace(/ +/g, " cm-");
52 | sp.appendChild(document.createTextNode(content));
53 | } else {
54 | node.appendChild(document.createTextNode(content));
55 | }
56 | };
57 | }
58 |
59 | var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
60 | for (var i = 0, e = lines.length; i < e; ++i) {
61 | if (i) callback("\n");
62 | var stream = new CodeMirror.StringStream(lines[i]);
63 | if (!stream.string && mode.blankLine) mode.blankLine(state);
64 | while (!stream.eol()) {
65 | var style = mode.token(stream, state);
66 | callback(stream.current(), style, i, stream.start, state);
67 | stream.start = stream.pos;
68 | }
69 | }
70 | };
71 |
72 | });
73 |
--------------------------------------------------------------------------------
/front-vue/build/dev-server.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 |
3 | var config = require('../config/index')
4 | if (!process.env.NODE_ENV) {
5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
6 | }
7 |
8 | var opn = require('opn')
9 | var path = require('path')
10 | var express = require('express')
11 | var webpack = require('webpack')
12 | var proxyMiddleware = require('http-proxy-middleware')
13 | var webpackConfig = require('./webpack.dev.conf')
14 |
15 | // default port where dev server listens for incoming traffic
16 | var port = process.env.PORT || config.dev.port
17 | // automatically open browser, if not set will be false
18 | var autoOpenBrowser = !!config.dev.autoOpenBrowser
19 | // Define HTTP proxies to your custom API backend
20 | // https://github.com/chimurai/http-proxy-middleware
21 | var proxyTable = config.dev.proxyTable
22 |
23 | var app = express()
24 | var compiler = webpack(webpackConfig)
25 |
26 | var devMiddleware = require('webpack-dev-middleware')(compiler, {
27 | publicPath: webpackConfig.output.publicPath,
28 | quiet: true
29 | })
30 |
31 | var hotMiddleware = require('webpack-hot-middleware')(compiler, {
32 | log: () => {}
33 | })
34 | // force page reload when html-webpack-plugin template changes
35 | compiler.plugin('compilation', function (compilation) {
36 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
37 | hotMiddleware.publish({ action: 'reload' })
38 | cb()
39 | })
40 | })
41 |
42 | // proxy api requests
43 | Object.keys(proxyTable).forEach(function (context) {
44 | var options = proxyTable[context]
45 | if (typeof options === 'string') {
46 | options = { target: options }
47 | }
48 | app.use(proxyMiddleware(options.filter || context, options))
49 | })
50 |
51 | // handle fallback for HTML5 history API
52 | app.use(require('connect-history-api-fallback')())
53 |
54 | // serve webpack bundle output
55 | app.use(devMiddleware)
56 |
57 | // enable hot-reload and state-preserving
58 | // compilation error display
59 | app.use(hotMiddleware)
60 |
61 | // serve pure static assets
62 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
63 | app.use(staticPath, express.static('./static'))
64 |
65 | var uri = 'http://localhost:' + port
66 |
67 | var _resolve
68 | var readyPromise = new Promise(resolve => {
69 | _resolve = resolve
70 | })
71 |
72 | console.log('> Starting dev server...')
73 | devMiddleware.waitUntilValid(() => {
74 | console.log('> Listening at ' + uri + '\n')
75 | // when env is testing, don't need open it
76 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
77 | opn(uri)
78 | }
79 | _resolve()
80 | })
81 |
82 | var server = app.listen(port)
83 |
84 | module.exports = {
85 | ready: readyPromise,
86 | close: () => {
87 | server.close()
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/selection/active-line.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 | var WRAP_CLASS = "CodeMirror-activeline";
14 | var BACK_CLASS = "CodeMirror-activeline-background";
15 | var GUTT_CLASS = "CodeMirror-activeline-gutter";
16 |
17 | CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
18 | var prev = old == CodeMirror.Init ? false : old;
19 | if (val == prev) return
20 | if (prev) {
21 | cm.off("beforeSelectionChange", selectionChange);
22 | clearActiveLines(cm);
23 | delete cm.state.activeLines;
24 | }
25 | if (val) {
26 | cm.state.activeLines = [];
27 | updateActiveLines(cm, cm.listSelections());
28 | cm.on("beforeSelectionChange", selectionChange);
29 | }
30 | });
31 |
32 | function clearActiveLines(cm) {
33 | for (var i = 0; i < cm.state.activeLines.length; i++) {
34 | cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS);
35 | cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS);
36 | cm.removeLineClass(cm.state.activeLines[i], "gutter", GUTT_CLASS);
37 | }
38 | }
39 |
40 | function sameArray(a, b) {
41 | if (a.length != b.length) return false;
42 | for (var i = 0; i < a.length; i++)
43 | if (a[i] != b[i]) return false;
44 | return true;
45 | }
46 |
47 | function updateActiveLines(cm, ranges) {
48 | var active = [];
49 | for (var i = 0; i < ranges.length; i++) {
50 | var range = ranges[i];
51 | var option = cm.getOption("styleActiveLine");
52 | if (typeof option == "object" && option.nonEmpty ? range.anchor.line != range.head.line : !range.empty())
53 | continue
54 | var line = cm.getLineHandleVisualStart(range.head.line);
55 | if (active[active.length - 1] != line) active.push(line);
56 | }
57 | if (sameArray(cm.state.activeLines, active)) return;
58 | cm.operation(function() {
59 | clearActiveLines(cm);
60 | for (var i = 0; i < active.length; i++) {
61 | cm.addLineClass(active[i], "wrap", WRAP_CLASS);
62 | cm.addLineClass(active[i], "background", BACK_CLASS);
63 | cm.addLineClass(active[i], "gutter", GUTT_CLASS);
64 | }
65 | cm.state.activeLines = active;
66 | });
67 | }
68 |
69 | function selectionChange(cm, sel) {
70 | updateActiveLines(cm, sel.ranges);
71 | }
72 | });
73 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/display/update_lines.js:
--------------------------------------------------------------------------------
1 | import { heightAtLine } from "../line/spans"
2 | import { getLine, lineAtHeight, updateLineHeight } from "../line/utils_line"
3 | import { paddingTop, textHeight } from "../measurement/position_measurement"
4 | import { ie, ie_version } from "../util/browser"
5 |
6 | // Read the actual heights of the rendered lines, and update their
7 | // stored heights to match.
8 | export function updateHeightsInViewport(cm) {
9 | let display = cm.display
10 | let prevBottom = display.lineDiv.offsetTop
11 | for (let i = 0; i < display.view.length; i++) {
12 | let cur = display.view[i], height
13 | if (cur.hidden) continue
14 | if (ie && ie_version < 8) {
15 | let bot = cur.node.offsetTop + cur.node.offsetHeight
16 | height = bot - prevBottom
17 | prevBottom = bot
18 | } else {
19 | let box = cur.node.getBoundingClientRect()
20 | height = box.bottom - box.top
21 | }
22 | let diff = cur.line.height - height
23 | if (height < 2) height = textHeight(display)
24 | if (diff > .001 || diff < -.001) {
25 | updateLineHeight(cur.line, height)
26 | updateWidgetHeight(cur.line)
27 | if (cur.rest) for (let j = 0; j < cur.rest.length; j++)
28 | updateWidgetHeight(cur.rest[j])
29 | }
30 | }
31 | }
32 |
33 | // Read and store the height of line widgets associated with the
34 | // given line.
35 | function updateWidgetHeight(line) {
36 | if (line.widgets) for (let i = 0; i < line.widgets.length; ++i)
37 | line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight
38 | }
39 |
40 | // Compute the lines that are visible in a given viewport (defaults
41 | // the the current scroll position). viewport may contain top,
42 | // height, and ensure (see op.scrollToPos) properties.
43 | export function visibleLines(display, doc, viewport) {
44 | let top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop
45 | top = Math.floor(top - paddingTop(display))
46 | let bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight
47 |
48 | let from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)
49 | // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
50 | // forces those lines into the viewport (if possible).
51 | if (viewport && viewport.ensure) {
52 | let ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line
53 | if (ensureFrom < from) {
54 | from = ensureFrom
55 | to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)
56 | } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
57 | from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)
58 | to = ensureTo
59 | }
60 | }
61 | return {from: from, to: Math.max(to, from + 1)}
62 | }
63 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/util/StringStream.js:
--------------------------------------------------------------------------------
1 | import { countColumn } from "./misc"
2 |
3 | // STRING STREAM
4 |
5 | // Fed to the mode parsers, provides helper functions to make
6 | // parsers more succinct.
7 |
8 | class StringStream {
9 | constructor(string, tabSize) {
10 | this.pos = this.start = 0
11 | this.string = string
12 | this.tabSize = tabSize || 8
13 | this.lastColumnPos = this.lastColumnValue = 0
14 | this.lineStart = 0
15 | }
16 |
17 | eol() {return this.pos >= this.string.length}
18 | sol() {return this.pos == this.lineStart}
19 | peek() {return this.string.charAt(this.pos) || undefined}
20 | next() {
21 | if (this.pos < this.string.length)
22 | return this.string.charAt(this.pos++)
23 | }
24 | eat(match) {
25 | let ch = this.string.charAt(this.pos)
26 | let ok
27 | if (typeof match == "string") ok = ch == match
28 | else ok = ch && (match.test ? match.test(ch) : match(ch))
29 | if (ok) {++this.pos; return ch}
30 | }
31 | eatWhile(match) {
32 | let start = this.pos
33 | while (this.eat(match)){}
34 | return this.pos > start
35 | }
36 | eatSpace() {
37 | let start = this.pos
38 | while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos
39 | return this.pos > start
40 | }
41 | skipToEnd() {this.pos = this.string.length}
42 | skipTo(ch) {
43 | let found = this.string.indexOf(ch, this.pos)
44 | if (found > -1) {this.pos = found; return true}
45 | }
46 | backUp(n) {this.pos -= n}
47 | column() {
48 | if (this.lastColumnPos < this.start) {
49 | this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue)
50 | this.lastColumnPos = this.start
51 | }
52 | return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
53 | }
54 | indentation() {
55 | return countColumn(this.string, null, this.tabSize) -
56 | (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
57 | }
58 | match(pattern, consume, caseInsensitive) {
59 | if (typeof pattern == "string") {
60 | let cased = str => caseInsensitive ? str.toLowerCase() : str
61 | let substr = this.string.substr(this.pos, pattern.length)
62 | if (cased(substr) == cased(pattern)) {
63 | if (consume !== false) this.pos += pattern.length
64 | return true
65 | }
66 | } else {
67 | let match = this.string.slice(this.pos).match(pattern)
68 | if (match && match.index > 0) return null
69 | if (match && consume !== false) this.pos += match[0].length
70 | return match
71 | }
72 | }
73 | current(){return this.string.slice(this.start, this.pos)}
74 | hideFirstChars(n, inner) {
75 | this.lineStart += n
76 | try { return inner() }
77 | finally { this.lineStart -= n }
78 | }
79 | }
80 |
81 | export default StringStream
82 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/line/utils_line.js:
--------------------------------------------------------------------------------
1 | import { indexOf } from "../util/misc"
2 |
3 | // Find the line object corresponding to the given line number.
4 | export function getLine(doc, n) {
5 | n -= doc.first
6 | if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document.")
7 | let chunk = doc
8 | while (!chunk.lines) {
9 | for (let i = 0;; ++i) {
10 | let child = chunk.children[i], sz = child.chunkSize()
11 | if (n < sz) { chunk = child; break }
12 | n -= sz
13 | }
14 | }
15 | return chunk.lines[n]
16 | }
17 |
18 | // Get the part of a document between two positions, as an array of
19 | // strings.
20 | export function getBetween(doc, start, end) {
21 | let out = [], n = start.line
22 | doc.iter(start.line, end.line + 1, line => {
23 | let text = line.text
24 | if (n == end.line) text = text.slice(0, end.ch)
25 | if (n == start.line) text = text.slice(start.ch)
26 | out.push(text)
27 | ++n
28 | })
29 | return out
30 | }
31 | // Get the lines between from and to, as array of strings.
32 | export function getLines(doc, from, to) {
33 | let out = []
34 | doc.iter(from, to, line => { out.push(line.text) }) // iter aborts when callback returns truthy value
35 | return out
36 | }
37 |
38 | // Update the height of a line, propagating the height change
39 | // upwards to parent nodes.
40 | export function updateLineHeight(line, height) {
41 | let diff = height - line.height
42 | if (diff) for (let n = line; n; n = n.parent) n.height += diff
43 | }
44 |
45 | // Given a line object, find its line number by walking up through
46 | // its parent links.
47 | export function lineNo(line) {
48 | if (line.parent == null) return null
49 | let cur = line.parent, no = indexOf(cur.lines, line)
50 | for (let chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
51 | for (let i = 0;; ++i) {
52 | if (chunk.children[i] == cur) break
53 | no += chunk.children[i].chunkSize()
54 | }
55 | }
56 | return no + cur.first
57 | }
58 |
59 | // Find the line at the given vertical position, using the height
60 | // information in the document tree.
61 | export function lineAtHeight(chunk, h) {
62 | let n = chunk.first
63 | outer: do {
64 | for (let i = 0; i < chunk.children.length; ++i) {
65 | let child = chunk.children[i], ch = child.height
66 | if (h < ch) { chunk = child; continue outer }
67 | h -= ch
68 | n += child.chunkSize()
69 | }
70 | return n
71 | } while (!chunk.lines)
72 | let i = 0
73 | for (; i < chunk.lines.length; ++i) {
74 | let line = chunk.lines[i], lh = line.height
75 | if (h < lh) break
76 | h -= lh
77 | }
78 | return n + i
79 | }
80 |
81 | export function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
82 |
83 | export function lineNumberFor(options, i) {
84 | return String(options.lineNumberFormatter(i + options.firstLineNumber))
85 | }
86 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/input/indent.js:
--------------------------------------------------------------------------------
1 | import { getStateBefore } from "../line/highlight"
2 | import { Pos } from "../line/pos"
3 | import { getLine } from "../line/utils_line"
4 | import { replaceRange } from "../model/changes"
5 | import { Range } from "../model/selection"
6 | import { replaceOneSelection } from "../model/selection_updates"
7 | import { countColumn, Pass, spaceStr } from "../util/misc"
8 |
9 | // Indent the given line. The how parameter can be "smart",
10 | // "add"/null, "subtract", or "prev". When aggressive is false
11 | // (typically set to true for forced single-line indents), empty
12 | // lines are not indented, and places where the mode returns Pass
13 | // are left alone.
14 | export function indentLine(cm, n, how, aggressive) {
15 | let doc = cm.doc, state
16 | if (how == null) how = "add"
17 | if (how == "smart") {
18 | // Fall back to "prev" when the mode doesn't have an indentation
19 | // method.
20 | if (!doc.mode.indent) how = "prev"
21 | else state = getStateBefore(cm, n)
22 | }
23 |
24 | let tabSize = cm.options.tabSize
25 | let line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize)
26 | if (line.stateAfter) line.stateAfter = null
27 | let curSpaceString = line.text.match(/^\s*/)[0], indentation
28 | if (!aggressive && !/\S/.test(line.text)) {
29 | indentation = 0
30 | how = "not"
31 | } else if (how == "smart") {
32 | indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text)
33 | if (indentation == Pass || indentation > 150) {
34 | if (!aggressive) return
35 | how = "prev"
36 | }
37 | }
38 | if (how == "prev") {
39 | if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize)
40 | else indentation = 0
41 | } else if (how == "add") {
42 | indentation = curSpace + cm.options.indentUnit
43 | } else if (how == "subtract") {
44 | indentation = curSpace - cm.options.indentUnit
45 | } else if (typeof how == "number") {
46 | indentation = curSpace + how
47 | }
48 | indentation = Math.max(0, indentation)
49 |
50 | let indentString = "", pos = 0
51 | if (cm.options.indentWithTabs)
52 | for (let i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t"}
53 | if (pos < indentation) indentString += spaceStr(indentation - pos)
54 |
55 | if (indentString != curSpaceString) {
56 | replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input")
57 | line.stateAfter = null
58 | return true
59 | } else {
60 | // Ensure that, if the cursor was in the whitespace at the start
61 | // of the line, it is moved to the end of that space.
62 | for (let i = 0; i < doc.sel.ranges.length; i++) {
63 | let range = doc.sel.ranges[i]
64 | if (range.head.line == n && range.head.ch < curSpaceString.length) {
65 | let pos = Pos(n, curSpaceString.length)
66 | replaceOneSelection(doc, i, new Range(pos, pos))
67 | break
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/model/selection.js:
--------------------------------------------------------------------------------
1 | import { cmp, copyPos, equalCursorPos, maxPos, minPos } from "../line/pos"
2 | import { indexOf } from "../util/misc"
3 |
4 | // Selection objects are immutable. A new one is created every time
5 | // the selection changes. A selection is one or more non-overlapping
6 | // (and non-touching) ranges, sorted, and an integer that indicates
7 | // which one is the primary selection (the one that's scrolled into
8 | // view, that getCursor returns, etc).
9 | export class Selection {
10 | constructor(ranges, primIndex) {
11 | this.ranges = ranges
12 | this.primIndex = primIndex
13 | }
14 |
15 | primary() { return this.ranges[this.primIndex] }
16 |
17 | equals(other) {
18 | if (other == this) return true
19 | if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false
20 | for (let i = 0; i < this.ranges.length; i++) {
21 | let here = this.ranges[i], there = other.ranges[i]
22 | if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) return false
23 | }
24 | return true
25 | }
26 |
27 | deepCopy() {
28 | let out = []
29 | for (let i = 0; i < this.ranges.length; i++)
30 | out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head))
31 | return new Selection(out, this.primIndex)
32 | }
33 |
34 | somethingSelected() {
35 | for (let i = 0; i < this.ranges.length; i++)
36 | if (!this.ranges[i].empty()) return true
37 | return false
38 | }
39 |
40 | contains(pos, end) {
41 | if (!end) end = pos
42 | for (let i = 0; i < this.ranges.length; i++) {
43 | let range = this.ranges[i]
44 | if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
45 | return i
46 | }
47 | return -1
48 | }
49 | }
50 |
51 | export class Range {
52 | constructor(anchor, head) {
53 | this.anchor = anchor; this.head = head
54 | }
55 |
56 | from() { return minPos(this.anchor, this.head) }
57 | to() { return maxPos(this.anchor, this.head) }
58 | empty() { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch }
59 | }
60 |
61 | // Take an unsorted, potentially overlapping set of ranges, and
62 | // build a selection out of it. 'Consumes' ranges array (modifying
63 | // it).
64 | export function normalizeSelection(ranges, primIndex) {
65 | let prim = ranges[primIndex]
66 | ranges.sort((a, b) => cmp(a.from(), b.from()))
67 | primIndex = indexOf(ranges, prim)
68 | for (let i = 1; i < ranges.length; i++) {
69 | let cur = ranges[i], prev = ranges[i - 1]
70 | if (cmp(prev.to(), cur.from()) >= 0) {
71 | let from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())
72 | let inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head
73 | if (i <= primIndex) --primIndex
74 | ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))
75 | }
76 | }
77 | return new Selection(ranges, primIndex)
78 | }
79 |
80 | export function simpleSelection(anchor, head) {
81 | return new Selection([new Range(anchor, head || anchor)], 0)
82 | }
83 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/model/line_widget.js:
--------------------------------------------------------------------------------
1 | import { runInOp } from "../display/operations"
2 | import { addToScrollPos } from "../display/scrolling"
3 | import { regLineChange } from "../display/view_tracking"
4 | import { heightAtLine, lineIsHidden } from "../line/spans"
5 | import { lineNo, updateLineHeight } from "../line/utils_line"
6 | import { widgetHeight } from "../measurement/widgets"
7 | import { changeLine } from "./changes"
8 | import { eventMixin } from "../util/event"
9 | import { signalLater } from "../util/operation_group"
10 |
11 | // Line widgets are block elements displayed above or below a line.
12 |
13 | export class LineWidget {
14 | constructor(doc, node, options) {
15 | if (options) for (let opt in options) if (options.hasOwnProperty(opt))
16 | this[opt] = options[opt]
17 | this.doc = doc
18 | this.node = node
19 | }
20 |
21 | clear() {
22 | let cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line)
23 | if (no == null || !ws) return
24 | for (let i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1)
25 | if (!ws.length) line.widgets = null
26 | let height = widgetHeight(this)
27 | updateLineHeight(line, Math.max(0, line.height - height))
28 | if (cm) {
29 | runInOp(cm, () => {
30 | adjustScrollWhenAboveVisible(cm, line, -height)
31 | regLineChange(cm, no, "widget")
32 | })
33 | signalLater(cm, "lineWidgetCleared", cm, this, no)
34 | }
35 | }
36 |
37 | changed() {
38 | let oldH = this.height, cm = this.doc.cm, line = this.line
39 | this.height = null
40 | let diff = widgetHeight(this) - oldH
41 | if (!diff) return
42 | updateLineHeight(line, line.height + diff)
43 | if (cm) {
44 | runInOp(cm, () => {
45 | cm.curOp.forceUpdate = true
46 | adjustScrollWhenAboveVisible(cm, line, diff)
47 | signalLater(cm, "lineWidgetChanged", cm, this, lineNo(line))
48 | })
49 | }
50 | }
51 | }
52 | eventMixin(LineWidget)
53 |
54 | function adjustScrollWhenAboveVisible(cm, line, diff) {
55 | if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
56 | addToScrollPos(cm, null, diff)
57 | }
58 |
59 | export function addLineWidget(doc, handle, node, options) {
60 | let widget = new LineWidget(doc, node, options)
61 | let cm = doc.cm
62 | if (cm && widget.noHScroll) cm.display.alignWidgets = true
63 | changeLine(doc, handle, "widget", line => {
64 | let widgets = line.widgets || (line.widgets = [])
65 | if (widget.insertAt == null) widgets.push(widget)
66 | else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget)
67 | widget.line = line
68 | if (cm && !lineIsHidden(doc, line)) {
69 | let aboveVisible = heightAtLine(line) < doc.scrollTop
70 | updateLineHeight(line, line.height + widgetHeight(widget))
71 | if (aboveVisible) addToScrollPos(cm, null, widget.height)
72 | cm.curOp.forceUpdate = true
73 | }
74 | return true
75 | })
76 | signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle))
77 | return widget
78 | }
79 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/lint/lint.css:
--------------------------------------------------------------------------------
1 | /* The lint marker gutter */
2 | .CodeMirror-lint-markers {
3 | width: 16px;
4 | }
5 |
6 | .CodeMirror-lint-tooltip {
7 | background-color: #ffd;
8 | border: 1px solid black;
9 | border-radius: 4px 4px 4px 4px;
10 | color: black;
11 | font-family: monospace;
12 | font-size: 10pt;
13 | overflow: hidden;
14 | padding: 2px 5px;
15 | position: fixed;
16 | white-space: pre;
17 | white-space: pre-wrap;
18 | z-index: 100;
19 | max-width: 600px;
20 | opacity: 0;
21 | transition: opacity .4s;
22 | -moz-transition: opacity .4s;
23 | -webkit-transition: opacity .4s;
24 | -o-transition: opacity .4s;
25 | -ms-transition: opacity .4s;
26 | }
27 |
28 | .CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning {
29 | background-position: left bottom;
30 | background-repeat: repeat-x;
31 | }
32 |
33 | .CodeMirror-lint-mark-error {
34 | background-image:
35 | url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==")
36 | ;
37 | }
38 |
39 | .CodeMirror-lint-mark-warning {
40 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
41 | }
42 |
43 | .CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning {
44 | background-position: center center;
45 | background-repeat: no-repeat;
46 | cursor: pointer;
47 | display: inline-block;
48 | height: 16px;
49 | width: 16px;
50 | vertical-align: middle;
51 | position: relative;
52 | }
53 |
54 | .CodeMirror-lint-message-error, .CodeMirror-lint-message-warning {
55 | padding-left: 18px;
56 | background-position: top left;
57 | background-repeat: no-repeat;
58 | }
59 |
60 | .CodeMirror-lint-marker-error, .CodeMirror-lint-message-error {
61 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=");
62 | }
63 |
64 | .CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning {
65 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=");
66 | }
67 |
68 | .CodeMirror-lint-marker-multiple {
69 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC");
70 | background-repeat: no-repeat;
71 | background-position: right bottom;
72 | width: 100%; height: 100%;
73 | }
74 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/util/feature_detection.js:
--------------------------------------------------------------------------------
1 | import { elt, range, removeChildren, removeChildrenAndAdd } from "./dom"
2 | import { ie, ie_version } from "./browser"
3 |
4 | // Detect drag-and-drop
5 | export let dragAndDrop = function() {
6 | // There is *some* kind of drag-and-drop support in IE6-8, but I
7 | // couldn't get it to work yet.
8 | if (ie && ie_version < 9) return false
9 | let div = elt('div')
10 | return "draggable" in div || "dragDrop" in div
11 | }()
12 |
13 | let zwspSupported
14 | export function zeroWidthElement(measure) {
15 | if (zwspSupported == null) {
16 | let test = elt("span", "\u200b")
17 | removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]))
18 | if (measure.firstChild.offsetHeight != 0)
19 | zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8)
20 | }
21 | let node = zwspSupported ? elt("span", "\u200b") :
22 | elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px")
23 | node.setAttribute("cm-text", "")
24 | return node
25 | }
26 |
27 | // Feature-detect IE's crummy client rect reporting for bidi text
28 | let badBidiRects
29 | export function hasBadBidiRects(measure) {
30 | if (badBidiRects != null) return badBidiRects
31 | let txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"))
32 | let r0 = range(txt, 0, 1).getBoundingClientRect()
33 | let r1 = range(txt, 1, 2).getBoundingClientRect()
34 | removeChildren(measure)
35 | if (!r0 || r0.left == r0.right) return false // Safari returns null in some cases (#2780)
36 | return badBidiRects = (r1.right - r0.right < 3)
37 | }
38 |
39 | // See if "".split is the broken IE version, if so, provide an
40 | // alternative way to split lines.
41 | export let splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? string => {
42 | let pos = 0, result = [], l = string.length
43 | while (pos <= l) {
44 | let nl = string.indexOf("\n", pos)
45 | if (nl == -1) nl = string.length
46 | let line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl)
47 | let rt = line.indexOf("\r")
48 | if (rt != -1) {
49 | result.push(line.slice(0, rt))
50 | pos += rt + 1
51 | } else {
52 | result.push(line)
53 | pos = nl + 1
54 | }
55 | }
56 | return result
57 | } : string => string.split(/\r\n?|\n/)
58 |
59 | export let hasSelection = window.getSelection ? te => {
60 | try { return te.selectionStart != te.selectionEnd }
61 | catch(e) { return false }
62 | } : te => {
63 | let range
64 | try {range = te.ownerDocument.selection.createRange()}
65 | catch(e) {}
66 | if (!range || range.parentElement() != te) return false
67 | return range.compareEndPoints("StartToEnd", range) != 0
68 | }
69 |
70 | export let hasCopyEvent = (() => {
71 | let e = elt("div")
72 | if ("oncopy" in e) return true
73 | e.setAttribute("oncopy", "return;")
74 | return typeof e.oncopy == "function"
75 | })()
76 |
77 | let badZoomedRects = null
78 | export function hasBadZoomedRects(measure) {
79 | if (badZoomedRects != null) return badZoomedRects
80 | let node = removeChildrenAndAdd(measure, elt("span", "x"))
81 | let normal = node.getBoundingClientRect()
82 | let fromRange = range(node, 0, 1).getBoundingClientRect()
83 | return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
84 | }
85 |
--------------------------------------------------------------------------------
/JsBox/routes/index.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var fs = require('fs');
3 | var path = require('path');
4 | var crypto = require('crypto');
5 | var verifyCode = require('../service/verifyCode.js');
6 | var router = express.Router();
7 | var secret = 'menuPath';
8 |
9 | var onlinePath = path.join(__dirname, '../file/code/javascript/online')
10 | var tempPath = path.join(__dirname, '../file/code/javascript/temp')
11 |
12 | router.get('/verify', function (req, res, next) {
13 | var data = verifyCode.getCode()
14 | data.answer = encode(data.answer)
15 | res.json({
16 | success: true,
17 | data: data
18 | })
19 | })
20 |
21 | router.get('/codeList', function(req, res, next) {
22 | var list = []
23 | fs.readdirSync(onlinePath).forEach(function (fileName) {
24 | if(fs.statSync(path.join(onlinePath, fileName)).isFile()){
25 | list.push({
26 | title: fileName,
27 | id: encode(path.join(onlinePath,fileName))
28 | })
29 | }
30 | })
31 | res.json({
32 | success: true,
33 | list: list
34 | })
35 | });
36 |
37 | router.get('/codeDetail', function(req, res, next) {
38 | var filePath = decode(req.query.id)
39 | fs.readFile(filePath,'utf-8',function(err, data){
40 | if(err){
41 | res.json({
42 | success: false
43 | })
44 | }else{
45 | var dirs = filePath.split(path.sep)
46 | res.json({
47 | success: true,
48 | title: dirs[dirs.length - 1],
49 | content: data
50 | })
51 | }
52 | })
53 | });
54 |
55 | router.post('/add', function (req, res, next) {
56 | var token = req.body.token
57 | var title = req.body.title
58 | var content = req.body.content
59 | var answer = req.body.answer
60 | var option = req.body.option
61 | if (answer !== encode(option)) {
62 | res.json({ success: false, msg: '验证码错误' })
63 | return
64 | }
65 | var dirPath = null
66 | if (token && token === '123456') { // token正确
67 | if (createDir(onlinePath)) {
68 | dirPath = onlinePath
69 | } else {
70 | res.json({ success: false, msg: '添加失败' })
71 | }
72 | } else {
73 | if (createDir(tempPath)) {
74 | dirPath = tempPath
75 | } else {
76 | res.json({ success: false, msg: '添加失败' })
77 | }
78 | }
79 | var newFilePath = path.join(dirPath, title)
80 | fs.writeFile(newFilePath, content, function(err) {
81 | if(err) {
82 | res.json({ success: false, msg: '添加失败' })
83 | }
84 | })
85 | res.json({ success: true })
86 | })
87 |
88 | function createDir (path) {
89 | if (!fs.existsSync(path)) {
90 | if (fs.mkdirSync(path)) {
91 | return false
92 | }
93 | }
94 | return true
95 | }
96 |
97 | /**
98 | * 路径编码
99 | * @param path
100 | * @returns {*}
101 | */
102 | function encode (path) {
103 | var cipher = crypto.createCipher('aes192', secret);
104 | var enc = cipher.update(path, 'utf8', 'hex');//编码方式从utf-8转为hex;
105 | enc += cipher.final('hex');//编码方式从转为hex;
106 | return enc
107 | }
108 |
109 | /**
110 | * 路径解码
111 | * @param path
112 | * @returns {*}
113 | */
114 | function decode (path) {
115 | var decipher = crypto.createDecipher('aes192', secret);
116 | var dec = decipher.update(path, 'hex', 'utf8');//编码方式从hex转为utf-8;
117 | dec += decipher.final('utf8');//编码方式从utf-8;
118 | return dec
119 | }
120 |
121 | module.exports = router;
122 |
--------------------------------------------------------------------------------
/JsBox/npm-debug.log:
--------------------------------------------------------------------------------
1 | 0 info it worked if it ends with ok
2 | 1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
3 | 1 verbose cli 'D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
4 | 1 verbose cli 'start' ]
5 | 2 info using npm@3.10.8
6 | 3 info using node@v6.8.1
7 | 4 verbose run-script [ 'prestart', 'start', 'poststart' ]
8 | 5 info lifecycle code-editor@0.0.0~prestart: code-editor@0.0.0
9 | 6 silly lifecycle code-editor@0.0.0~prestart: no script for prestart, continuing
10 | 7 info lifecycle code-editor@0.0.0~start: code-editor@0.0.0
11 | 8 verbose lifecycle code-editor@0.0.0~start: unsafe-perm in lifecycle true
12 | 9 verbose lifecycle code-editor@0.0.0~start: PATH: D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;E:\web_workspace\vue-os\code-editor\node_modules\.bin;C:\Python\Scripts;C:\Python;E:\sdk\sdk;D:\Program Files\gradle-2.4\bin;D:\Program Files\nodejs\node_global\;C:\Program Files\Java\jdk1.8.0_05\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\nodejs\;D:\Program Files\Git\cmd;D:\phpStudy\php\php-5.4.45;C:\ProgramData\ComposerSetup\bin;C:\Python\Lib\site-packages;C:\Python\Lib\site-packages\pytesser;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\AppData\Roaming\Composer\vendor\bin
13 | 10 verbose lifecycle code-editor@0.0.0~start: CWD: E:\web_workspace\vue-os\code-editor
14 | 11 silly lifecycle code-editor@0.0.0~start: Args: [ '/d /s /c', 'node ./bin/www' ]
15 | 12 silly lifecycle code-editor@0.0.0~start: Returned: code: 3221225786 signal: null
16 | 13 info lifecycle code-editor@0.0.0~start: Failed to exec start script
17 | 14 verbose stack Error: code-editor@0.0.0 start: `node ./bin/www`
18 | 14 verbose stack Exit status 3221225786
19 | 14 verbose stack at EventEmitter. (D:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
20 | 14 verbose stack at emitTwo (events.js:106:13)
21 | 14 verbose stack at EventEmitter.emit (events.js:191:7)
22 | 14 verbose stack at ChildProcess. (D:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
23 | 14 verbose stack at emitTwo (events.js:106:13)
24 | 14 verbose stack at ChildProcess.emit (events.js:191:7)
25 | 14 verbose stack at maybeClose (internal/child_process.js:877:16)
26 | 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
27 | 15 verbose pkgid code-editor@0.0.0
28 | 16 verbose cwd E:\web_workspace\vue-os\code-editor
29 | 17 error Windows_NT 6.1.7601
30 | 18 error argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
31 | 19 error node v6.8.1
32 | 20 error npm v3.10.8
33 | 21 error code ELIFECYCLE
34 | 22 error code-editor@0.0.0 start: `node ./bin/www`
35 | 22 error Exit status 3221225786
36 | 23 error Failed at the code-editor@0.0.0 start script 'node ./bin/www'.
37 | 23 error Make sure you have the latest version of node.js and npm installed.
38 | 23 error If you do, this is most likely a problem with the code-editor package,
39 | 23 error not with npm itself.
40 | 23 error Tell the author that this fails on your system:
41 | 23 error node ./bin/www
42 | 23 error You can get information on how to open an issue for this project with:
43 | 23 error npm bugs code-editor
44 | 23 error Or if that isn't available, you can get their info via:
45 | 23 error npm owner ls code-editor
46 | 23 error There is likely additional logging output above.
47 | 24 verbose exit [ 1, true ]
48 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/mode/overlay.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Utility function that allows modes to be combined. The mode given
5 | // as the base argument takes care of most of the normal mode
6 | // functionality, but a second (typically simple) mode is used, which
7 | // can override the style of text. Both modes get to parse all of the
8 | // text, but when both assign a non-null style to a piece of code, the
9 | // overlay wins, unless the combine argument was true and not overridden,
10 | // or state.overlay.combineTokens was true, in which case the styles are
11 | // combined.
12 |
13 | (function(mod) {
14 | if (typeof exports == "object" && typeof module == "object") // CommonJS
15 | mod(require("../../lib/codemirror"));
16 | else if (typeof define == "function" && define.amd) // AMD
17 | define(["../../lib/codemirror"], mod);
18 | else // Plain browser env
19 | mod(CodeMirror);
20 | })(function(CodeMirror) {
21 | "use strict";
22 |
23 | CodeMirror.overlayMode = function(base, overlay, combine) {
24 | return {
25 | startState: function() {
26 | return {
27 | base: CodeMirror.startState(base),
28 | overlay: CodeMirror.startState(overlay),
29 | basePos: 0, baseCur: null,
30 | overlayPos: 0, overlayCur: null,
31 | streamSeen: null
32 | };
33 | },
34 | copyState: function(state) {
35 | return {
36 | base: CodeMirror.copyState(base, state.base),
37 | overlay: CodeMirror.copyState(overlay, state.overlay),
38 | basePos: state.basePos, baseCur: null,
39 | overlayPos: state.overlayPos, overlayCur: null
40 | };
41 | },
42 |
43 | token: function(stream, state) {
44 | if (stream != state.streamSeen ||
45 | Math.min(state.basePos, state.overlayPos) < stream.start) {
46 | state.streamSeen = stream;
47 | state.basePos = state.overlayPos = stream.start;
48 | }
49 |
50 | if (stream.start == state.basePos) {
51 | state.baseCur = base.token(stream, state.base);
52 | state.basePos = stream.pos;
53 | }
54 | if (stream.start == state.overlayPos) {
55 | stream.pos = stream.start;
56 | state.overlayCur = overlay.token(stream, state.overlay);
57 | state.overlayPos = stream.pos;
58 | }
59 | stream.pos = Math.min(state.basePos, state.overlayPos);
60 |
61 | // state.overlay.combineTokens always takes precedence over combine,
62 | // unless set to null
63 | if (state.overlayCur == null) return state.baseCur;
64 | else if (state.baseCur != null &&
65 | state.overlay.combineTokens ||
66 | combine && state.overlay.combineTokens == null)
67 | return state.baseCur + " " + state.overlayCur;
68 | else return state.overlayCur;
69 | },
70 |
71 | indent: base.indent && function(state, textAfter) {
72 | return base.indent(state.base, textAfter);
73 | },
74 | electricChars: base.electricChars,
75 |
76 | innerMode: function(state) { return {state: state.base, mode: base}; },
77 |
78 | blankLine: function(state) {
79 | var baseToken, overlayToken;
80 | if (base.blankLine) baseToken = base.blankLine(state.base);
81 | if (overlay.blankLine) overlayToken = overlay.blankLine(state.overlay);
82 |
83 | return overlayToken == null ?
84 | baseToken :
85 | (combine && baseToken != null ? baseToken + " " + overlayToken : overlayToken);
86 | }
87 | };
88 | };
89 |
90 | });
91 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/modes.js:
--------------------------------------------------------------------------------
1 | import { copyObj, createObj } from "./util/misc"
2 |
3 | // Known modes, by name and by MIME
4 | export let modes = {}, mimeModes = {}
5 |
6 | // Extra arguments are stored as the mode's dependencies, which is
7 | // used by (legacy) mechanisms like loadmode.js to automatically
8 | // load a mode. (Preferred mechanism is the require/define calls.)
9 | export function defineMode(name, mode) {
10 | if (arguments.length > 2)
11 | mode.dependencies = Array.prototype.slice.call(arguments, 2)
12 | modes[name] = mode
13 | }
14 |
15 | export function defineMIME(mime, spec) {
16 | mimeModes[mime] = spec
17 | }
18 |
19 | // Given a MIME type, a {name, ...options} config object, or a name
20 | // string, return a mode config object.
21 | export function resolveMode(spec) {
22 | if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
23 | spec = mimeModes[spec]
24 | } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
25 | let found = mimeModes[spec.name]
26 | if (typeof found == "string") found = {name: found}
27 | spec = createObj(found, spec)
28 | spec.name = found.name
29 | } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
30 | return resolveMode("application/xml")
31 | } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
32 | return resolveMode("application/json")
33 | }
34 | if (typeof spec == "string") return {name: spec}
35 | else return spec || {name: "null"}
36 | }
37 |
38 | // Given a mode spec (anything that resolveMode accepts), find and
39 | // initialize an actual mode object.
40 | export function getMode(options, spec) {
41 | spec = resolveMode(spec)
42 | let mfactory = modes[spec.name]
43 | if (!mfactory) return getMode(options, "text/plain")
44 | let modeObj = mfactory(options, spec)
45 | if (modeExtensions.hasOwnProperty(spec.name)) {
46 | let exts = modeExtensions[spec.name]
47 | for (let prop in exts) {
48 | if (!exts.hasOwnProperty(prop)) continue
49 | if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop]
50 | modeObj[prop] = exts[prop]
51 | }
52 | }
53 | modeObj.name = spec.name
54 | if (spec.helperType) modeObj.helperType = spec.helperType
55 | if (spec.modeProps) for (let prop in spec.modeProps)
56 | modeObj[prop] = spec.modeProps[prop]
57 |
58 | return modeObj
59 | }
60 |
61 | // This can be used to attach properties to mode objects from
62 | // outside the actual mode definition.
63 | export let modeExtensions = {}
64 | export function extendMode(mode, properties) {
65 | let exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {})
66 | copyObj(properties, exts)
67 | }
68 |
69 | export function copyState(mode, state) {
70 | if (state === true) return state
71 | if (mode.copyState) return mode.copyState(state)
72 | let nstate = {}
73 | for (let n in state) {
74 | let val = state[n]
75 | if (val instanceof Array) val = val.concat([])
76 | nstate[n] = val
77 | }
78 | return nstate
79 | }
80 |
81 | // Given a mode and a state (for that mode), find the inner mode and
82 | // state at the position that the state refers to.
83 | export function innerMode(mode, state) {
84 | let info
85 | while (mode.innerMode) {
86 | info = mode.innerMode(state)
87 | if (!info || info.mode == mode) break
88 | state = info.state
89 | mode = info.mode
90 | }
91 | return info || {mode: mode, state: state}
92 | }
93 |
94 | export function startState(mode, a1, a2) {
95 | return mode.startState ? mode.startState(a1, a2) : true
96 | }
97 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/util/dom.js:
--------------------------------------------------------------------------------
1 | import { ie, ios } from "./browser"
2 |
3 | export function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
4 |
5 | export let rmClass = function(node, cls) {
6 | let current = node.className
7 | let match = classTest(cls).exec(current)
8 | if (match) {
9 | let after = current.slice(match.index + match[0].length)
10 | node.className = current.slice(0, match.index) + (after ? match[1] + after : "")
11 | }
12 | }
13 |
14 | export function removeChildren(e) {
15 | for (let count = e.childNodes.length; count > 0; --count)
16 | e.removeChild(e.firstChild)
17 | return e
18 | }
19 |
20 | export function removeChildrenAndAdd(parent, e) {
21 | return removeChildren(parent).appendChild(e)
22 | }
23 |
24 | export function elt(tag, content, className, style) {
25 | let e = document.createElement(tag)
26 | if (className) e.className = className
27 | if (style) e.style.cssText = style
28 | if (typeof content == "string") e.appendChild(document.createTextNode(content))
29 | else if (content) for (let i = 0; i < content.length; ++i) e.appendChild(content[i])
30 | return e
31 | }
32 | // wrapper for elt, which removes the elt from the accessibility tree
33 | export function eltP(tag, content, className, style) {
34 | let e = elt(tag, content, className, style)
35 | e.setAttribute("role", "presentation")
36 | return e
37 | }
38 |
39 | export let range
40 | if (document.createRange) range = function(node, start, end, endNode) {
41 | let r = document.createRange()
42 | r.setEnd(endNode || node, end)
43 | r.setStart(node, start)
44 | return r
45 | }
46 | else range = function(node, start, end) {
47 | let r = document.body.createTextRange()
48 | try { r.moveToElementText(node.parentNode) }
49 | catch(e) { return r }
50 | r.collapse(true)
51 | r.moveEnd("character", end)
52 | r.moveStart("character", start)
53 | return r
54 | }
55 |
56 | export function contains(parent, child) {
57 | if (child.nodeType == 3) // Android browser always returns false when child is a textnode
58 | child = child.parentNode
59 | if (parent.contains)
60 | return parent.contains(child)
61 | do {
62 | if (child.nodeType == 11) child = child.host
63 | if (child == parent) return true
64 | } while (child = child.parentNode)
65 | }
66 |
67 | export function activeElt() {
68 | // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
69 | // IE < 10 will throw when accessed while the page is loading or in an iframe.
70 | // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
71 | let activeElement
72 | try {
73 | activeElement = document.activeElement
74 | } catch(e) {
75 | activeElement = document.body || null
76 | }
77 | while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
78 | activeElement = activeElement.shadowRoot.activeElement
79 | return activeElement
80 | }
81 |
82 | export function addClass(node, cls) {
83 | let current = node.className
84 | if (!classTest(cls).test(current)) node.className += (current ? " " : "") + cls
85 | }
86 | export function joinClasses(a, b) {
87 | let as = a.split(" ")
88 | for (let i = 0; i < as.length; i++)
89 | if (as[i] && !classTest(as[i]).test(b)) b += " " + as[i]
90 | return b
91 | }
92 |
93 | export let selectInput = function(node) { node.select() }
94 | if (ios) // Mobile Safari apparently has a bug where select() is broken.
95 | selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length }
96 | else if (ie) // Suppress mysterious IE10 errors
97 | selectInput = function(node) { try { node.select() } catch(_e) {} }
98 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/selection/selection-pointer.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.defineOption("selectionPointer", false, function(cm, val) {
15 | var data = cm.state.selectionPointer;
16 | if (data) {
17 | CodeMirror.off(cm.getWrapperElement(), "mousemove", data.mousemove);
18 | CodeMirror.off(cm.getWrapperElement(), "mouseout", data.mouseout);
19 | CodeMirror.off(window, "scroll", data.windowScroll);
20 | cm.off("cursorActivity", reset);
21 | cm.off("scroll", reset);
22 | cm.state.selectionPointer = null;
23 | cm.display.lineDiv.style.cursor = "";
24 | }
25 | if (val) {
26 | data = cm.state.selectionPointer = {
27 | value: typeof val == "string" ? val : "default",
28 | mousemove: function(event) { mousemove(cm, event); },
29 | mouseout: function(event) { mouseout(cm, event); },
30 | windowScroll: function() { reset(cm); },
31 | rects: null,
32 | mouseX: null, mouseY: null,
33 | willUpdate: false
34 | };
35 | CodeMirror.on(cm.getWrapperElement(), "mousemove", data.mousemove);
36 | CodeMirror.on(cm.getWrapperElement(), "mouseout", data.mouseout);
37 | CodeMirror.on(window, "scroll", data.windowScroll);
38 | cm.on("cursorActivity", reset);
39 | cm.on("scroll", reset);
40 | }
41 | });
42 |
43 | function mousemove(cm, event) {
44 | var data = cm.state.selectionPointer;
45 | if (event.buttons == null ? event.which : event.buttons) {
46 | data.mouseX = data.mouseY = null;
47 | } else {
48 | data.mouseX = event.clientX;
49 | data.mouseY = event.clientY;
50 | }
51 | scheduleUpdate(cm);
52 | }
53 |
54 | function mouseout(cm, event) {
55 | if (!cm.getWrapperElement().contains(event.relatedTarget)) {
56 | var data = cm.state.selectionPointer;
57 | data.mouseX = data.mouseY = null;
58 | scheduleUpdate(cm);
59 | }
60 | }
61 |
62 | function reset(cm) {
63 | cm.state.selectionPointer.rects = null;
64 | scheduleUpdate(cm);
65 | }
66 |
67 | function scheduleUpdate(cm) {
68 | if (!cm.state.selectionPointer.willUpdate) {
69 | cm.state.selectionPointer.willUpdate = true;
70 | setTimeout(function() {
71 | update(cm);
72 | cm.state.selectionPointer.willUpdate = false;
73 | }, 50);
74 | }
75 | }
76 |
77 | function update(cm) {
78 | var data = cm.state.selectionPointer;
79 | if (!data) return;
80 | if (data.rects == null && data.mouseX != null) {
81 | data.rects = [];
82 | if (cm.somethingSelected()) {
83 | for (var sel = cm.display.selectionDiv.firstChild; sel; sel = sel.nextSibling)
84 | data.rects.push(sel.getBoundingClientRect());
85 | }
86 | }
87 | var inside = false;
88 | if (data.mouseX != null) for (var i = 0; i < data.rects.length; i++) {
89 | var rect = data.rects[i];
90 | if (rect.left <= data.mouseX && rect.right >= data.mouseX &&
91 | rect.top <= data.mouseY && rect.bottom >= data.mouseY)
92 | inside = true;
93 | }
94 | var cursor = inside ? data.value : "";
95 | if (cm.display.lineDiv.style.cursor != cursor)
96 | cm.display.lineDiv.style.cursor = cursor;
97 | }
98 | });
99 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/comment/continuecomment.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | var modes = ["clike", "css", "javascript"];
13 |
14 | for (var i = 0; i < modes.length; ++i)
15 | CodeMirror.extendMode(modes[i], {blockCommentContinue: " * "});
16 |
17 | function continueComment(cm) {
18 | if (cm.getOption("disableInput")) return CodeMirror.Pass;
19 | var ranges = cm.listSelections(), mode, inserts = [];
20 | for (var i = 0; i < ranges.length; i++) {
21 | var pos = ranges[i].head, token = cm.getTokenAt(pos);
22 | if (token.type != "comment") return CodeMirror.Pass;
23 | var modeHere = CodeMirror.innerMode(cm.getMode(), token.state).mode;
24 | if (!mode) mode = modeHere;
25 | else if (mode != modeHere) return CodeMirror.Pass;
26 |
27 | var insert = null;
28 | if (mode.blockCommentStart && mode.blockCommentContinue) {
29 | var end = token.string.indexOf(mode.blockCommentEnd);
30 | var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found;
31 | if (end != -1 && end == token.string.length - mode.blockCommentEnd.length && pos.ch >= end) {
32 | // Comment ended, don't continue it
33 | } else if (token.string.indexOf(mode.blockCommentStart) == 0) {
34 | insert = full.slice(0, token.start);
35 | if (!/^\s*$/.test(insert)) {
36 | insert = "";
37 | for (var j = 0; j < token.start; ++j) insert += " ";
38 | }
39 | } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 &&
40 | found + mode.blockCommentContinue.length > token.start &&
41 | /^\s*$/.test(full.slice(0, found))) {
42 | insert = full.slice(0, found);
43 | }
44 | if (insert != null) insert += mode.blockCommentContinue;
45 | }
46 | if (insert == null && mode.lineComment && continueLineCommentEnabled(cm)) {
47 | var line = cm.getLine(pos.line), found = line.indexOf(mode.lineComment);
48 | if (found > -1) {
49 | insert = line.slice(0, found);
50 | if (/\S/.test(insert)) insert = null;
51 | else insert += mode.lineComment + line.slice(found + mode.lineComment.length).match(/^\s*/)[0];
52 | }
53 | }
54 | if (insert == null) return CodeMirror.Pass;
55 | inserts[i] = "\n" + insert;
56 | }
57 |
58 | cm.operation(function() {
59 | for (var i = ranges.length - 1; i >= 0; i--)
60 | cm.replaceRange(inserts[i], ranges[i].from(), ranges[i].to(), "+insert");
61 | });
62 | }
63 |
64 | function continueLineCommentEnabled(cm) {
65 | var opt = cm.getOption("continueComments");
66 | if (opt && typeof opt == "object")
67 | return opt.continueLineComment !== false;
68 | return true;
69 | }
70 |
71 | CodeMirror.defineOption("continueComments", null, function(cm, val, prev) {
72 | if (prev && prev != CodeMirror.Init)
73 | cm.removeKeyMap("continueComment");
74 | if (val) {
75 | var key = "Enter";
76 | if (typeof val == "string")
77 | key = val;
78 | else if (typeof val == "object" && val.key)
79 | key = val.key;
80 | var map = {name: "continueComment"};
81 | map[key] = continueComment;
82 | cm.addKeyMap(map);
83 | }
84 | });
85 | });
86 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/util/event.js:
--------------------------------------------------------------------------------
1 | import { mac } from "./browser"
2 | import { indexOf } from "./misc"
3 |
4 | // EVENT HANDLING
5 |
6 | // Lightweight event framework. on/off also work on DOM nodes,
7 | // registering native DOM handlers.
8 |
9 | const noHandlers = []
10 |
11 | export let on = function(emitter, type, f) {
12 | if (emitter.addEventListener) {
13 | emitter.addEventListener(type, f, false)
14 | } else if (emitter.attachEvent) {
15 | emitter.attachEvent("on" + type, f)
16 | } else {
17 | let map = emitter._handlers || (emitter._handlers = {})
18 | map[type] = (map[type] || noHandlers).concat(f)
19 | }
20 | }
21 |
22 | export function getHandlers(emitter, type) {
23 | return emitter._handlers && emitter._handlers[type] || noHandlers
24 | }
25 |
26 | export function off(emitter, type, f) {
27 | if (emitter.removeEventListener) {
28 | emitter.removeEventListener(type, f, false)
29 | } else if (emitter.detachEvent) {
30 | emitter.detachEvent("on" + type, f)
31 | } else {
32 | let map = emitter._handlers, arr = map && map[type]
33 | if (arr) {
34 | let index = indexOf(arr, f)
35 | if (index > -1)
36 | map[type] = arr.slice(0, index).concat(arr.slice(index + 1))
37 | }
38 | }
39 | }
40 |
41 | export function signal(emitter, type /*, values...*/) {
42 | let handlers = getHandlers(emitter, type)
43 | if (!handlers.length) return
44 | let args = Array.prototype.slice.call(arguments, 2)
45 | for (let i = 0; i < handlers.length; ++i) handlers[i].apply(null, args)
46 | }
47 |
48 | // The DOM events that CodeMirror handles can be overridden by
49 | // registering a (non-DOM) handler on the editor for the event name,
50 | // and preventDefault-ing the event in that handler.
51 | export function signalDOMEvent(cm, e, override) {
52 | if (typeof e == "string")
53 | e = {type: e, preventDefault: function() { this.defaultPrevented = true }}
54 | signal(cm, override || e.type, cm, e)
55 | return e_defaultPrevented(e) || e.codemirrorIgnore
56 | }
57 |
58 | export function signalCursorActivity(cm) {
59 | let arr = cm._handlers && cm._handlers.cursorActivity
60 | if (!arr) return
61 | let set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = [])
62 | for (let i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1)
63 | set.push(arr[i])
64 | }
65 |
66 | export function hasHandler(emitter, type) {
67 | return getHandlers(emitter, type).length > 0
68 | }
69 |
70 | // Add on and off methods to a constructor's prototype, to make
71 | // registering events on such objects more convenient.
72 | export function eventMixin(ctor) {
73 | ctor.prototype.on = function(type, f) {on(this, type, f)}
74 | ctor.prototype.off = function(type, f) {off(this, type, f)}
75 | }
76 |
77 | // Due to the fact that we still support jurassic IE versions, some
78 | // compatibility wrappers are needed.
79 |
80 | export function e_preventDefault(e) {
81 | if (e.preventDefault) e.preventDefault()
82 | else e.returnValue = false
83 | }
84 | export function e_stopPropagation(e) {
85 | if (e.stopPropagation) e.stopPropagation()
86 | else e.cancelBubble = true
87 | }
88 | export function e_defaultPrevented(e) {
89 | return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
90 | }
91 | export function e_stop(e) {e_preventDefault(e); e_stopPropagation(e)}
92 |
93 | export function e_target(e) {return e.target || e.srcElement}
94 | export function e_button(e) {
95 | let b = e.which
96 | if (b == null) {
97 | if (e.button & 1) b = 1
98 | else if (e.button & 2) b = 3
99 | else if (e.button & 4) b = 2
100 | }
101 | if (mac && e.ctrlKey && b == 1) b = 3
102 | return b
103 | }
104 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/merge/merge.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-merge {
2 | position: relative;
3 | border: 1px solid #ddd;
4 | white-space: pre;
5 | }
6 |
7 | .CodeMirror-merge, .CodeMirror-merge .CodeMirror {
8 | height: 350px;
9 | }
10 |
11 | .CodeMirror-merge-2pane .CodeMirror-merge-pane { width: 47%; }
12 | .CodeMirror-merge-2pane .CodeMirror-merge-gap { width: 6%; }
13 | .CodeMirror-merge-3pane .CodeMirror-merge-pane { width: 31%; }
14 | .CodeMirror-merge-3pane .CodeMirror-merge-gap { width: 3.5%; }
15 |
16 | .CodeMirror-merge-pane {
17 | display: inline-block;
18 | white-space: normal;
19 | vertical-align: top;
20 | }
21 | .CodeMirror-merge-pane-rightmost {
22 | position: absolute;
23 | right: 0px;
24 | z-index: 1;
25 | }
26 |
27 | .CodeMirror-merge-gap {
28 | z-index: 2;
29 | display: inline-block;
30 | height: 100%;
31 | -moz-box-sizing: border-box;
32 | box-sizing: border-box;
33 | overflow: hidden;
34 | border-left: 1px solid #ddd;
35 | border-right: 1px solid #ddd;
36 | position: relative;
37 | background: #f8f8f8;
38 | }
39 |
40 | .CodeMirror-merge-scrolllock-wrap {
41 | position: absolute;
42 | bottom: 0; left: 50%;
43 | }
44 | .CodeMirror-merge-scrolllock {
45 | position: relative;
46 | left: -50%;
47 | cursor: pointer;
48 | color: #555;
49 | line-height: 1;
50 | }
51 |
52 | .CodeMirror-merge-copybuttons-left, .CodeMirror-merge-copybuttons-right {
53 | position: absolute;
54 | left: 0; top: 0;
55 | right: 0; bottom: 0;
56 | line-height: 1;
57 | }
58 |
59 | .CodeMirror-merge-copy {
60 | position: absolute;
61 | cursor: pointer;
62 | color: #44c;
63 | z-index: 3;
64 | }
65 |
66 | .CodeMirror-merge-copy-reverse {
67 | position: absolute;
68 | cursor: pointer;
69 | color: #44c;
70 | }
71 |
72 | .CodeMirror-merge-copybuttons-left .CodeMirror-merge-copy { left: 2px; }
73 | .CodeMirror-merge-copybuttons-right .CodeMirror-merge-copy { right: 2px; }
74 |
75 | .CodeMirror-merge-r-inserted, .CodeMirror-merge-l-inserted {
76 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12MwuCXy3+CWyH8GBgYGJgYkAABZbAQ9ELXurwAAAABJRU5ErkJggg==);
77 | background-position: bottom left;
78 | background-repeat: repeat-x;
79 | }
80 |
81 | .CodeMirror-merge-r-deleted, .CodeMirror-merge-l-deleted {
82 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12M4Kyb2/6yY2H8GBgYGJgYkAABURgPz6Ks7wQAAAABJRU5ErkJggg==);
83 | background-position: bottom left;
84 | background-repeat: repeat-x;
85 | }
86 |
87 | .CodeMirror-merge-r-chunk { background: #ffffe0; }
88 | .CodeMirror-merge-r-chunk-start { border-top: 1px solid #ee8; }
89 | .CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #ee8; }
90 | .CodeMirror-merge-r-connect { fill: #ffffe0; stroke: #ee8; stroke-width: 1px; }
91 |
92 | .CodeMirror-merge-l-chunk { background: #eef; }
93 | .CodeMirror-merge-l-chunk-start { border-top: 1px solid #88e; }
94 | .CodeMirror-merge-l-chunk-end { border-bottom: 1px solid #88e; }
95 | .CodeMirror-merge-l-connect { fill: #eef; stroke: #88e; stroke-width: 1px; }
96 |
97 | .CodeMirror-merge-l-chunk.CodeMirror-merge-r-chunk { background: #dfd; }
98 | .CodeMirror-merge-l-chunk-start.CodeMirror-merge-r-chunk-start { border-top: 1px solid #4e4; }
99 | .CodeMirror-merge-l-chunk-end.CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #4e4; }
100 |
101 | .CodeMirror-merge-collapsed-widget:before {
102 | content: "(...)";
103 | }
104 | .CodeMirror-merge-collapsed-widget {
105 | cursor: pointer;
106 | color: #88b;
107 | background: #eef;
108 | border: 1px solid #ddf;
109 | font-size: 90%;
110 | padding: 0 3px;
111 | border-radius: 4px;
112 | }
113 | .CodeMirror-merge-collapsed-line .CodeMirror-gutter-elt { display: none; }
114 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/search/matchesonscrollbar.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"), require("./searchcursor"), require("../scroll/annotatescrollbar"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror", "./searchcursor", "../scroll/annotatescrollbar"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.defineExtension("showMatchesOnScrollbar", function(query, caseFold, options) {
15 | if (typeof options == "string") options = {className: options};
16 | if (!options) options = {};
17 | return new SearchAnnotation(this, query, caseFold, options);
18 | });
19 |
20 | function SearchAnnotation(cm, query, caseFold, options) {
21 | this.cm = cm;
22 | this.options = options;
23 | var annotateOptions = {listenForChanges: false};
24 | for (var prop in options) annotateOptions[prop] = options[prop];
25 | if (!annotateOptions.className) annotateOptions.className = "CodeMirror-search-match";
26 | this.annotation = cm.annotateScrollbar(annotateOptions);
27 | this.query = query;
28 | this.caseFold = caseFold;
29 | this.gap = {from: cm.firstLine(), to: cm.lastLine() + 1};
30 | this.matches = [];
31 | this.update = null;
32 |
33 | this.findMatches();
34 | this.annotation.update(this.matches);
35 |
36 | var self = this;
37 | cm.on("change", this.changeHandler = function(_cm, change) { self.onChange(change); });
38 | }
39 |
40 | var MAX_MATCHES = 1000;
41 |
42 | SearchAnnotation.prototype.findMatches = function() {
43 | if (!this.gap) return;
44 | for (var i = 0; i < this.matches.length; i++) {
45 | var match = this.matches[i];
46 | if (match.from.line >= this.gap.to) break;
47 | if (match.to.line >= this.gap.from) this.matches.splice(i--, 1);
48 | }
49 | var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), this.caseFold);
50 | var maxMatches = this.options && this.options.maxMatches || MAX_MATCHES;
51 | while (cursor.findNext()) {
52 | var match = {from: cursor.from(), to: cursor.to()};
53 | if (match.from.line >= this.gap.to) break;
54 | this.matches.splice(i++, 0, match);
55 | if (this.matches.length > maxMatches) break;
56 | }
57 | this.gap = null;
58 | };
59 |
60 | function offsetLine(line, changeStart, sizeChange) {
61 | if (line <= changeStart) return line;
62 | return Math.max(changeStart, line + sizeChange);
63 | }
64 |
65 | SearchAnnotation.prototype.onChange = function(change) {
66 | var startLine = change.from.line;
67 | var endLine = CodeMirror.changeEnd(change).line;
68 | var sizeChange = endLine - change.to.line;
69 | if (this.gap) {
70 | this.gap.from = Math.min(offsetLine(this.gap.from, startLine, sizeChange), change.from.line);
71 | this.gap.to = Math.max(offsetLine(this.gap.to, startLine, sizeChange), change.from.line);
72 | } else {
73 | this.gap = {from: change.from.line, to: endLine + 1};
74 | }
75 |
76 | if (sizeChange) for (var i = 0; i < this.matches.length; i++) {
77 | var match = this.matches[i];
78 | var newFrom = offsetLine(match.from.line, startLine, sizeChange);
79 | if (newFrom != match.from.line) match.from = CodeMirror.Pos(newFrom, match.from.ch);
80 | var newTo = offsetLine(match.to.line, startLine, sizeChange);
81 | if (newTo != match.to.line) match.to = CodeMirror.Pos(newTo, match.to.ch);
82 | }
83 | clearTimeout(this.update);
84 | var self = this;
85 | this.update = setTimeout(function() { self.updateAfterChange(); }, 250);
86 | };
87 |
88 | SearchAnnotation.prototype.updateAfterChange = function() {
89 | this.findMatches();
90 | this.annotation.update(this.matches);
91 | };
92 |
93 | SearchAnnotation.prototype.clear = function() {
94 | this.cm.off("change", this.changeHandler);
95 | this.annotation.clear();
96 | };
97 | });
98 |
--------------------------------------------------------------------------------
/front-vue/build/webpack.prod.conf.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var utils = require('./utils')
3 | var webpack = require('webpack')
4 | var config = require('../config/index')
5 | var merge = require('webpack-merge')
6 | var baseWebpackConfig = require('./webpack.base.conf')
7 | var CopyWebpackPlugin = require('copy-webpack-plugin')
8 | var HtmlWebpackPlugin = require('html-webpack-plugin')
9 | var ExtractTextPlugin = require('extract-text-webpack-plugin')
10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
11 |
12 | var env = config.build.env
13 |
14 | var webpackConfig = merge(baseWebpackConfig, {
15 | module: {
16 | rules: utils.styleLoaders({
17 | sourceMap: config.build.productionSourceMap,
18 | extract: true
19 | })
20 | },
21 | devtool: config.build.productionSourceMap ? '#source-map' : false,
22 | output: {
23 | path: config.build.assetsRoot,
24 | filename: utils.assetsPath('js/[name].[chunkhash].js'),
25 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
26 | },
27 | plugins: [
28 | // http://vuejs.github.io/vue-loader/en/workflow/production.html
29 | new webpack.DefinePlugin({
30 | 'process.env': env
31 | }),
32 | new webpack.optimize.UglifyJsPlugin({
33 | compress: {
34 | warnings: false
35 | },
36 | sourceMap: true
37 | }),
38 | // extract css into its own file
39 | new ExtractTextPlugin({
40 | filename: utils.assetsPath('css/[name].[contenthash].css')
41 | }),
42 | // Compress extracted CSS. We are using this plugin so that possible
43 | // duplicated CSS from different components can be deduped.
44 | new OptimizeCSSPlugin({
45 | cssProcessorOptions: {
46 | safe: true
47 | }
48 | }),
49 | // generate dist index.html with correct asset hash for caching.
50 | // you can customize output by editing /index.html
51 | // see https://github.com/ampedandwired/html-webpack-plugin
52 | new HtmlWebpackPlugin({
53 | filename: config.build.index,
54 | template: 'index.html',
55 | inject: true,
56 | minify: {
57 | removeComments: true,
58 | collapseWhitespace: true,
59 | removeAttributeQuotes: true
60 | // more options:
61 | // https://github.com/kangax/html-minifier#options-quick-reference
62 | },
63 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin
64 | chunksSortMode: 'dependency'
65 | }),
66 | // split vendor js into its own file
67 | new webpack.optimize.CommonsChunkPlugin({
68 | name: 'vendor',
69 | minChunks: function (module, count) {
70 | // any required modules inside node_modules are extracted to vendor
71 | return (
72 | module.resource &&
73 | /\.js$/.test(module.resource) &&
74 | module.resource.indexOf(
75 | path.join(__dirname, '../node_modules')
76 | ) === 0
77 | )
78 | }
79 | }),
80 | // extract webpack runtime and module manifest to its own file in order to
81 | // prevent vendor hash from being updated whenever app bundle is updated
82 | new webpack.optimize.CommonsChunkPlugin({
83 | name: 'manifest',
84 | chunks: ['vendor']
85 | }),
86 | // copy custom static assets
87 | new CopyWebpackPlugin([
88 | {
89 | from: path.resolve(__dirname, '../static'),
90 | to: config.build.assetsSubDirectory,
91 | ignore: ['.*']
92 | }
93 | ])
94 | ]
95 | })
96 |
97 | if (config.build.productionGzip) {
98 | var CompressionWebpackPlugin = require('compression-webpack-plugin')
99 |
100 | webpackConfig.plugins.push(
101 | new CompressionWebpackPlugin({
102 | asset: '[path].gz[query]',
103 | algorithm: 'gzip',
104 | test: new RegExp(
105 | '\\.(' +
106 | config.build.productionGzipExtensions.join('|') +
107 | ')$'
108 | ),
109 | threshold: 10240,
110 | minRatio: 0.8
111 | })
112 | )
113 | }
114 |
115 | if (config.build.bundleAnalyzerReport) {
116 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
117 | webpackConfig.plugins.push(new BundleAnalyzerPlugin())
118 | }
119 |
120 | module.exports = webpackConfig
121 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/fold/brace-fold.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | CodeMirror.registerHelper("fold", "brace", function(cm, start) {
15 | var line = start.line, lineText = cm.getLine(line);
16 | var tokenType;
17 |
18 | function findOpening(openCh) {
19 | for (var at = start.ch, pass = 0;;) {
20 | var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1);
21 | if (found == -1) {
22 | if (pass == 1) break;
23 | pass = 1;
24 | at = lineText.length;
25 | continue;
26 | }
27 | if (pass == 1 && found < start.ch) break;
28 | tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
29 | if (!/^(comment|string)/.test(tokenType)) return found + 1;
30 | at = found - 1;
31 | }
32 | }
33 |
34 | var startToken = "{", endToken = "}", startCh = findOpening("{");
35 | if (startCh == null) {
36 | startToken = "[", endToken = "]";
37 | startCh = findOpening("[");
38 | }
39 |
40 | if (startCh == null) return;
41 | var count = 1, lastLine = cm.lastLine(), end, endCh;
42 | outer: for (var i = line; i <= lastLine; ++i) {
43 | var text = cm.getLine(i), pos = i == line ? startCh : 0;
44 | for (;;) {
45 | var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
46 | if (nextOpen < 0) nextOpen = text.length;
47 | if (nextClose < 0) nextClose = text.length;
48 | pos = Math.min(nextOpen, nextClose);
49 | if (pos == text.length) break;
50 | if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) {
51 | if (pos == nextOpen) ++count;
52 | else if (!--count) { end = i; endCh = pos; break outer; }
53 | }
54 | ++pos;
55 | }
56 | }
57 | if (end == null || line == end && endCh == startCh) return;
58 | return {from: CodeMirror.Pos(line, startCh),
59 | to: CodeMirror.Pos(end, endCh)};
60 | });
61 |
62 | CodeMirror.registerHelper("fold", "import", function(cm, start) {
63 | function hasImport(line) {
64 | if (line < cm.firstLine() || line > cm.lastLine()) return null;
65 | var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
66 | if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
67 | if (start.type != "keyword" || start.string != "import") return null;
68 | // Now find closing semicolon, return its position
69 | for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) {
70 | var text = cm.getLine(i), semi = text.indexOf(";");
71 | if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)};
72 | }
73 | }
74 |
75 | var startLine = start.line, has = hasImport(startLine), prev;
76 | if (!has || hasImport(startLine - 1) || ((prev = hasImport(startLine - 2)) && prev.end.line == startLine - 1))
77 | return null;
78 | for (var end = has.end;;) {
79 | var next = hasImport(end.line + 1);
80 | if (next == null) break;
81 | end = next.end;
82 | }
83 | return {from: cm.clipPos(CodeMirror.Pos(startLine, has.startCh + 1)), to: end};
84 | });
85 |
86 | CodeMirror.registerHelper("fold", "include", function(cm, start) {
87 | function hasInclude(line) {
88 | if (line < cm.firstLine() || line > cm.lastLine()) return null;
89 | var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
90 | if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
91 | if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8;
92 | }
93 |
94 | var startLine = start.line, has = hasInclude(startLine);
95 | if (has == null || hasInclude(startLine - 1) != null) return null;
96 | for (var end = startLine;;) {
97 | var next = hasInclude(end + 1);
98 | if (next == null) break;
99 | ++end;
100 | }
101 | return {from: CodeMirror.Pos(startLine, has + 1),
102 | to: cm.clipPos(CodeMirror.Pos(end))};
103 | });
104 |
105 | });
106 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/selection/mark-selection.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | // Because sometimes you need to mark the selected *text*.
5 | //
6 | // Adds an option 'styleSelectedText' which, when enabled, gives
7 | // selected text the CSS class given as option value, or
8 | // "CodeMirror-selectedtext" when the value is not a string.
9 |
10 | (function(mod) {
11 | if (typeof exports == "object" && typeof module == "object") // CommonJS
12 | mod(require("../../lib/codemirror"));
13 | else if (typeof define == "function" && define.amd) // AMD
14 | define(["../../lib/codemirror"], mod);
15 | else // Plain browser env
16 | mod(CodeMirror);
17 | })(function(CodeMirror) {
18 | "use strict";
19 |
20 | CodeMirror.defineOption("styleSelectedText", false, function(cm, val, old) {
21 | var prev = old && old != CodeMirror.Init;
22 | if (val && !prev) {
23 | cm.state.markedSelection = [];
24 | cm.state.markedSelectionStyle = typeof val == "string" ? val : "CodeMirror-selectedtext";
25 | reset(cm);
26 | cm.on("cursorActivity", onCursorActivity);
27 | cm.on("change", onChange);
28 | } else if (!val && prev) {
29 | cm.off("cursorActivity", onCursorActivity);
30 | cm.off("change", onChange);
31 | clear(cm);
32 | cm.state.markedSelection = cm.state.markedSelectionStyle = null;
33 | }
34 | });
35 |
36 | function onCursorActivity(cm) {
37 | if (cm.state.markedSelection)
38 | cm.operation(function() { update(cm); });
39 | }
40 |
41 | function onChange(cm) {
42 | if (cm.state.markedSelection && cm.state.markedSelection.length)
43 | cm.operation(function() { clear(cm); });
44 | }
45 |
46 | var CHUNK_SIZE = 8;
47 | var Pos = CodeMirror.Pos;
48 | var cmp = CodeMirror.cmpPos;
49 |
50 | function coverRange(cm, from, to, addAt) {
51 | if (cmp(from, to) == 0) return;
52 | var array = cm.state.markedSelection;
53 | var cls = cm.state.markedSelectionStyle;
54 | for (var line = from.line;;) {
55 | var start = line == from.line ? from : Pos(line, 0);
56 | var endLine = line + CHUNK_SIZE, atEnd = endLine >= to.line;
57 | var end = atEnd ? to : Pos(endLine, 0);
58 | var mark = cm.markText(start, end, {className: cls});
59 | if (addAt == null) array.push(mark);
60 | else array.splice(addAt++, 0, mark);
61 | if (atEnd) break;
62 | line = endLine;
63 | }
64 | }
65 |
66 | function clear(cm) {
67 | var array = cm.state.markedSelection;
68 | for (var i = 0; i < array.length; ++i) array[i].clear();
69 | array.length = 0;
70 | }
71 |
72 | function reset(cm) {
73 | clear(cm);
74 | var ranges = cm.listSelections();
75 | for (var i = 0; i < ranges.length; i++)
76 | coverRange(cm, ranges[i].from(), ranges[i].to());
77 | }
78 |
79 | function update(cm) {
80 | if (!cm.somethingSelected()) return clear(cm);
81 | if (cm.listSelections().length > 1) return reset(cm);
82 |
83 | var from = cm.getCursor("start"), to = cm.getCursor("end");
84 |
85 | var array = cm.state.markedSelection;
86 | if (!array.length) return coverRange(cm, from, to);
87 |
88 | var coverStart = array[0].find(), coverEnd = array[array.length - 1].find();
89 | if (!coverStart || !coverEnd || to.line - from.line < CHUNK_SIZE ||
90 | cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0)
91 | return reset(cm);
92 |
93 | while (cmp(from, coverStart.from) > 0) {
94 | array.shift().clear();
95 | coverStart = array[0].find();
96 | }
97 | if (cmp(from, coverStart.from) < 0) {
98 | if (coverStart.to.line - from.line < CHUNK_SIZE) {
99 | array.shift().clear();
100 | coverRange(cm, from, coverStart.to, 0);
101 | } else {
102 | coverRange(cm, from, coverStart.from, 0);
103 | }
104 | }
105 |
106 | while (cmp(to, coverEnd.to) < 0) {
107 | array.pop().clear();
108 | coverEnd = array[array.length - 1].find();
109 | }
110 | if (cmp(to, coverEnd.to) > 0) {
111 | if (to.line - coverEnd.from.line < CHUNK_SIZE) {
112 | array.pop().clear();
113 | coverRange(cm, coverEnd.from, to);
114 | } else {
115 | coverRange(cm, coverEnd.to, to);
116 | }
117 | }
118 | }
119 | });
120 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/lib/model/document_data.js:
--------------------------------------------------------------------------------
1 | import { loadMode } from "../display/mode_state"
2 | import { runInOp } from "../display/operations"
3 | import { regChange } from "../display/view_tracking"
4 | import { Line, updateLine } from "../line/line_data"
5 | import { findMaxLine } from "../line/spans"
6 | import { getLine } from "../line/utils_line"
7 | import { estimateLineHeights } from "../measurement/position_measurement"
8 | import { addClass, rmClass } from "../util/dom"
9 | import { lst } from "../util/misc"
10 | import { signalLater } from "../util/operation_group"
11 |
12 | // DOCUMENT DATA STRUCTURE
13 |
14 | // By default, updates that start and end at the beginning of a line
15 | // are treated specially, in order to make the association of line
16 | // widgets and marker elements with the text behave more intuitive.
17 | export function isWholeLineUpdate(doc, change) {
18 | return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
19 | (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
20 | }
21 |
22 | // Perform a change on the document data structure.
23 | export function updateDoc(doc, change, markedSpans, estimateHeight) {
24 | function spansFor(n) {return markedSpans ? markedSpans[n] : null}
25 | function update(line, text, spans) {
26 | updateLine(line, text, spans, estimateHeight)
27 | signalLater(line, "change", line, change)
28 | }
29 | function linesFor(start, end) {
30 | let result = []
31 | for (let i = start; i < end; ++i)
32 | result.push(new Line(text[i], spansFor(i), estimateHeight))
33 | return result
34 | }
35 |
36 | let from = change.from, to = change.to, text = change.text
37 | let firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line)
38 | let lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line
39 |
40 | // Adjust the line structure
41 | if (change.full) {
42 | doc.insert(0, linesFor(0, text.length))
43 | doc.remove(text.length, doc.size - text.length)
44 | } else if (isWholeLineUpdate(doc, change)) {
45 | // This is a whole-line replace. Treated specially to make
46 | // sure line objects move the way they are supposed to.
47 | let added = linesFor(0, text.length - 1)
48 | update(lastLine, lastLine.text, lastSpans)
49 | if (nlines) doc.remove(from.line, nlines)
50 | if (added.length) doc.insert(from.line, added)
51 | } else if (firstLine == lastLine) {
52 | if (text.length == 1) {
53 | update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)
54 | } else {
55 | let added = linesFor(1, text.length - 1)
56 | added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))
57 | update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
58 | doc.insert(from.line + 1, added)
59 | }
60 | } else if (text.length == 1) {
61 | update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))
62 | doc.remove(from.line + 1, nlines)
63 | } else {
64 | update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
65 | update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)
66 | let added = linesFor(1, text.length - 1)
67 | if (nlines > 1) doc.remove(from.line + 1, nlines - 1)
68 | doc.insert(from.line + 1, added)
69 | }
70 |
71 | signalLater(doc, "change", doc, change)
72 | }
73 |
74 | // Call f for all linked documents.
75 | export function linkedDocs(doc, f, sharedHistOnly) {
76 | function propagate(doc, skip, sharedHist) {
77 | if (doc.linked) for (let i = 0; i < doc.linked.length; ++i) {
78 | let rel = doc.linked[i]
79 | if (rel.doc == skip) continue
80 | let shared = sharedHist && rel.sharedHist
81 | if (sharedHistOnly && !shared) continue
82 | f(rel.doc, shared)
83 | propagate(rel.doc, doc, shared)
84 | }
85 | }
86 | propagate(doc, null, true)
87 | }
88 |
89 | // Attach a document to an editor.
90 | export function attachDoc(cm, doc) {
91 | if (doc.cm) throw new Error("This document is already in use.")
92 | cm.doc = doc
93 | doc.cm = cm
94 | estimateLineHeights(cm)
95 | loadMode(cm)
96 | setDirectionClass(cm)
97 | if (!cm.options.lineWrapping) findMaxLine(cm)
98 | cm.options.mode = doc.modeOption
99 | regChange(cm)
100 | }
101 |
102 | function setDirectionClass(cm) {
103 | ;(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl")
104 | }
105 |
106 | export function directionChanged(cm) {
107 | runInOp(cm, () => {
108 | setDirectionClass(cm)
109 | regChange(cm)
110 | })
111 | }
112 |
--------------------------------------------------------------------------------
/front-vue/src/assets/CodeMirror/addon/display/panel.js:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | CodeMirror.defineExtension("addPanel", function(node, options) {
13 | options = options || {};
14 |
15 | if (!this.state.panels) initPanels(this);
16 |
17 | var info = this.state.panels;
18 | var wrapper = info.wrapper;
19 | var cmWrapper = this.getWrapperElement();
20 |
21 | if (options.after instanceof Panel && !options.after.cleared) {
22 | wrapper.insertBefore(node, options.before.node.nextSibling);
23 | } else if (options.before instanceof Panel && !options.before.cleared) {
24 | wrapper.insertBefore(node, options.before.node);
25 | } else if (options.replace instanceof Panel && !options.replace.cleared) {
26 | wrapper.insertBefore(node, options.replace.node);
27 | options.replace.clear();
28 | } else if (options.position == "bottom") {
29 | wrapper.appendChild(node);
30 | } else if (options.position == "before-bottom") {
31 | wrapper.insertBefore(node, cmWrapper.nextSibling);
32 | } else if (options.position == "after-top") {
33 | wrapper.insertBefore(node, cmWrapper);
34 | } else {
35 | wrapper.insertBefore(node, wrapper.firstChild);
36 | }
37 |
38 | var height = (options && options.height) || node.offsetHeight;
39 | this._setSize(null, info.heightLeft -= height);
40 | info.panels++;
41 | if (options.stable && isAtTop(this, node))
42 | this.scrollTo(null, this.getScrollInfo().top + height)
43 |
44 | return new Panel(this, node, options, height);
45 | });
46 |
47 | function Panel(cm, node, options, height) {
48 | this.cm = cm;
49 | this.node = node;
50 | this.options = options;
51 | this.height = height;
52 | this.cleared = false;
53 | }
54 |
55 | Panel.prototype.clear = function() {
56 | if (this.cleared) return;
57 | this.cleared = true;
58 | var info = this.cm.state.panels;
59 | this.cm._setSize(null, info.heightLeft += this.height);
60 | if (this.options.stable && isAtTop(this.cm, this.node))
61 | this.cm.scrollTo(null, this.cm.getScrollInfo().top - this.height)
62 | info.wrapper.removeChild(this.node);
63 | if (--info.panels == 0) removePanels(this.cm);
64 | };
65 |
66 | Panel.prototype.changed = function(height) {
67 | var newHeight = height == null ? this.node.offsetHeight : height;
68 | var info = this.cm.state.panels;
69 | this.cm._setSize(null, info.heightLeft -= (newHeight - this.height));
70 | this.height = newHeight;
71 | };
72 |
73 | function initPanels(cm) {
74 | var wrap = cm.getWrapperElement();
75 | var style = window.getComputedStyle ? window.getComputedStyle(wrap) : wrap.currentStyle;
76 | var height = parseInt(style.height);
77 | var info = cm.state.panels = {
78 | setHeight: wrap.style.height,
79 | heightLeft: height,
80 | panels: 0,
81 | wrapper: document.createElement("div")
82 | };
83 | wrap.parentNode.insertBefore(info.wrapper, wrap);
84 | var hasFocus = cm.hasFocus();
85 | info.wrapper.appendChild(wrap);
86 | if (hasFocus) cm.focus();
87 |
88 | cm._setSize = cm.setSize;
89 | if (height != null) cm.setSize = function(width, newHeight) {
90 | if (newHeight == null) return this._setSize(width, newHeight);
91 | info.setHeight = newHeight;
92 | if (typeof newHeight != "number") {
93 | var px = /^(\d+\.?\d*)px$/.exec(newHeight);
94 | if (px) {
95 | newHeight = Number(px[1]);
96 | } else {
97 | info.wrapper.style.height = newHeight;
98 | newHeight = info.wrapper.offsetHeight;
99 | info.wrapper.style.height = "";
100 | }
101 | }
102 | cm._setSize(width, info.heightLeft += (newHeight - height));
103 | height = newHeight;
104 | };
105 | }
106 |
107 | function removePanels(cm) {
108 | var info = cm.state.panels;
109 | cm.state.panels = null;
110 |
111 | var wrap = cm.getWrapperElement();
112 | info.wrapper.parentNode.replaceChild(wrap, info.wrapper);
113 | wrap.style.height = info.setHeight;
114 | cm.setSize = cm._setSize;
115 | cm.setSize();
116 | }
117 |
118 | function isAtTop(cm, dom) {
119 | for (var sibling = dom.nextSibling; sibling; sibling = sibling.nextSibling)
120 | if (sibling == cm.getWrapperElement()) return true
121 | return false
122 | }
123 | });
124 |
--------------------------------------------------------------------------------