├── test ├── karma │ └── karma.conf.js └── mocha │ ├── readme.txt │ └── data │ └── userTest.js ├── web ├── view │ ├── user │ │ ├── home.html │ │ ├── signin.html │ │ └── signup.html │ ├── home │ │ ├── error.html │ │ ├── donate.html │ │ └── about.html │ ├── shared │ │ └── scripts.html │ ├── layout_inner.html │ ├── footer │ │ └── footer.html │ ├── layout.html │ └── post │ │ ├── detail.html │ │ └── post_edit.html └── static │ ├── lib │ ├── bootstrap │ │ ├── 3.1.1 │ │ │ ├── less │ │ │ │ ├── mixins.css │ │ │ │ ├── variables.css │ │ │ │ ├── media.css │ │ │ │ ├── .csslintrc │ │ │ │ ├── component-animations.less │ │ │ │ ├── wells.less │ │ │ │ ├── breadcrumbs.less │ │ │ │ ├── close.less │ │ │ │ ├── thumbnails.less │ │ │ │ ├── utilities.less │ │ │ │ ├── jumbotron.less │ │ │ │ ├── bootstrap.less │ │ │ │ ├── media.less │ │ │ │ ├── pager.less │ │ │ │ ├── badges.less │ │ │ │ ├── labels.less │ │ │ │ ├── print.css │ │ │ │ ├── code.less │ │ │ │ ├── alerts.less │ │ │ │ ├── grid.less │ │ │ │ ├── progress-bars.less │ │ │ │ ├── print.less │ │ │ │ ├── pagination.less │ │ │ │ ├── responsive-utilities.less │ │ │ │ ├── tooltip.less │ │ │ │ └── scaffolding.less │ │ │ └── fonts │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ └── glyphicons-halflings-regular.woff │ │ └── notify │ │ │ └── 1.0.0 │ │ │ └── less │ │ │ ├── bootstrap-notify.less │ │ │ └── styles │ │ │ ├── alert-bangtidy.less │ │ │ ├── alert-notification-animations.css │ │ │ └── alert-bangtidy.css │ ├── w5cValidator │ │ ├── 2.0.0 │ │ │ ├── style.less │ │ │ └── style.css │ │ └── 1.0.0 │ │ │ ├── style.css │ │ │ └── style.less │ └── highlight │ │ └── 8.0 │ │ └── styles │ │ ├── pojoaque.jpg │ │ ├── school_book.png │ │ ├── brown_papersq.png │ │ ├── ascetic.css │ │ ├── mono-blue.css │ │ ├── tomorrow.css │ │ ├── paraiso.dark.css │ │ ├── paraiso.light.css │ │ ├── vs.css │ │ ├── tomorrow-night-bright.css │ │ ├── tomorrow-night-eighties.css │ │ ├── tomorrow-night.css │ │ ├── tomorrow-night-blue.css │ │ ├── ir_black.css │ │ ├── atelier-dune.dark.css │ │ ├── atelier-dune.light.css │ │ ├── atelier-heath.dark.css │ │ ├── atelier-heath.light.css │ │ ├── atelier-forest.dark.css │ │ ├── atelier-forest.light.css │ │ ├── atelier-seaside.dark.css │ │ ├── atelier-lakeside.dark.css │ │ ├── atelier-seaside.light.css │ │ ├── atelier-lakeside.light.css │ │ ├── solarized_dark.css │ │ ├── solarized_light.css │ │ ├── rainbow.css │ │ ├── pojoaque.css │ │ ├── foundation.css │ │ ├── dark.css │ │ ├── brown_paper.css │ │ ├── github.css │ │ ├── idea.css │ │ ├── zenburn.css │ │ ├── docco.css │ │ ├── far.css │ │ ├── magula.css │ │ ├── school_book.css │ │ ├── monokai.css │ │ ├── googlecode.css │ │ ├── sunburst.css │ │ └── monokai_sublime.css │ ├── fonts │ ├── font-awesome │ │ └── 4.0.3 │ │ │ ├── less │ │ │ ├── mixins.css │ │ │ ├── variables.css │ │ │ ├── fixed-width.less │ │ │ ├── core.less │ │ │ ├── bordered-pulled.less │ │ │ ├── rotated-flipped.less │ │ │ ├── larger.less │ │ │ ├── list.less │ │ │ ├── font-awesome.less │ │ │ ├── stacked.less │ │ │ ├── path.less │ │ │ ├── mixins.less │ │ │ └── spinning.less │ │ │ └── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff │ ├── img │ ├── favicon.ico │ ├── angular-small.png │ ├── default_avatar.png │ └── pay_why520crazy.png │ ├── css │ └── less │ │ ├── user.less │ │ └── layout.less │ └── js │ ├── tpl │ └── common │ │ └── delete_confirm_modal.html │ ├── filter │ └── filter.js │ ├── controller │ ├── home.js │ └── user.js │ ├── status.js │ ├── directive │ └── directive.js │ └── main.js ├── server ├── config │ ├── index.js │ ├── production.confidential.simple.js │ ├── test.js │ ├── development.js │ ├── production.js │ └── config.js ├── controller │ ├── index.js │ ├── userCtrl.js │ └── postCtrl.js ├── data │ ├── model │ │ ├── schema.js │ │ ├── applySchema.js │ │ ├── userSchema.js │ │ └── postSchema.js │ ├── apply.js │ ├── base.js │ ├── index.js │ └── user.js ├── kits │ ├── index.js │ ├── status.js │ ├── logger.js │ ├── constant.js │ └── utils.js ├── auth.js ├── passport.js ├── handler.js └── api │ └── index.js ├── bin └── start.sh ├── .gitignore ├── LICENSE ├── package.json ├── README.md ├── gruntfile.js └── app.js /test/karma/karma.conf.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/view/user/home.html: -------------------------------------------------------------------------------- 1 | 个人主页 -------------------------------------------------------------------------------- /web/view/home/error.html: -------------------------------------------------------------------------------- 1 | 服务器似乎跑小差了 -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/mixins.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/mixins.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/variables.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/variables.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/config/index.js: -------------------------------------------------------------------------------- 1 | exports = module.exports = require("./config"); -------------------------------------------------------------------------------- /web/static/lib/w5cValidator/2.0.0/style.less: -------------------------------------------------------------------------------- 1 | .w5c-error{ 2 | color: #b94a48; 3 | } -------------------------------------------------------------------------------- /web/static/lib/w5cValidator/2.0.0/style.css: -------------------------------------------------------------------------------- 1 | .w5c-error { 2 | color: #b94a48; 3 | } 4 | -------------------------------------------------------------------------------- /web/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/img/favicon.ico -------------------------------------------------------------------------------- /web/static/img/angular-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/img/angular-small.png -------------------------------------------------------------------------------- /web/static/img/default_avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/img/default_avatar.png -------------------------------------------------------------------------------- /web/static/img/pay_why520crazy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/img/pay_why520crazy.png -------------------------------------------------------------------------------- /bin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is a very simple example 3 | killall node 4 | cd /home/ng-nice 5 | NODE_ENV=production pm2 start app.js 6 | -------------------------------------------------------------------------------- /web/static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /web/static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/pojoaque.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/lib/highlight/8.0/styles/pojoaque.jpg -------------------------------------------------------------------------------- /web/static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/school_book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/lib/highlight/8.0/styles/school_book.png -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/brown_papersq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/lib/highlight/8.0/styles/brown_papersq.png -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/fonts/font-awesome/4.0.3/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/fonts/font-awesome/4.0.3/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/fonts/font-awesome/4.0.3/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/fonts/font-awesome/4.0.3/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/lib/bootstrap/3.1.1/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/lib/bootstrap/3.1.1/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular-cn/ng-nice/HEAD/web/static/lib/bootstrap/3.1.1/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /test/mocha/readme.txt: -------------------------------------------------------------------------------- 1 | 单元测试框架mocha介绍: 1. 本地环境安装mocha:执行命令 npm install -g mocha; 2. 命令行切换到当前目录,执行 mocha XXX.js 命令执行XXX.js文件的单元测试,mocha * 执行所有文件的单元测试; 3. 更多 mocha 的信息,参照 http://visionmedia.github.io/mocha/。 -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/fixed-width.less: -------------------------------------------------------------------------------- 1 | // Fixed Width Icons 2 | // ------------------------- 3 | .@{fa-css-prefix}-fw { 4 | width: (18em / 14); 5 | text-align: center; 6 | } 7 | -------------------------------------------------------------------------------- /server/config/production.confidential.simple.js: -------------------------------------------------------------------------------- 1 | var config = { 2 | mongoServer : "mongodb://127.0.0.1/ngnicexxx", 3 | cookieSecret : "WOJIUSHINIUBI123456" 4 | }; 5 | 6 | module.exports = exports = config; 7 | -------------------------------------------------------------------------------- /server/controller/index.js: -------------------------------------------------------------------------------- 1 | /*global exports,require*/ (function () { "use strict"; module.exports = { home: require("./homeCtrl"), user : require("./userCtrl"), post : require("./postCtrl") }; })(); -------------------------------------------------------------------------------- /server/data/model/schema.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), Schema = mongoose.Schema; schemas = { Post : require("./postSchema"), User : require("./userSchema"), Apply: require("./applySchema") }; module.exports = schemas; -------------------------------------------------------------------------------- /server/kits/index.js: -------------------------------------------------------------------------------- 1 | var config = require("../config"); 2 | 3 | module.exports = exports = { 4 | status : require("./status"), 5 | utils : require("./utils"), 6 | constant: require("./constant"), 7 | logger : require("./logger")(config.logger) 8 | }; -------------------------------------------------------------------------------- /web/static/css/less/user.less: -------------------------------------------------------------------------------- 1 | .signin-panel { 2 | margin-top: 50px; 3 | 4 | form { 5 | width: 350px; 6 | @media (max-width : @screen-xs) { 7 | width: 90%; 8 | } 9 | margin: auto; 10 | .form-control{ 11 | height: 44px; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /web/view/home/donate.html: -------------------------------------------------------------------------------- 1 |

捐赠


如果你觉得NgNice站点对你有用,并且愿意以捐赠的方式资助我们继续为AngularJS社区作贡献,我们非常欢迎。
支付宝账号:why520crazy@163.com, 代收人:站长 why520crazy
用支付宝钱包可以直接扫描二维码捐赠:

-------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/core.less: -------------------------------------------------------------------------------- 1 | // Base Class Definition 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix} { 5 | display: inline-block; 6 | font-family: FontAwesome; 7 | font-style: normal; 8 | font-weight: normal; 9 | line-height: 1; 10 | -webkit-font-smoothing: antialiased; 11 | -moz-osx-font-smoothing: grayscale; 12 | } 13 | -------------------------------------------------------------------------------- /web/static/lib/w5cValidator/1.0.0/style.css: -------------------------------------------------------------------------------- 1 | .w5c-form input.error:invalid, 2 | .w5c-form textarea.error:invalid, 3 | .w5c-form select.error:invalid { 4 | border-color: #e9322d; 5 | -webkit-box-shadow: 0 0 6px #f8b9b7; 6 | -moz-box-shadow: 0 0 6px #f8b9b7; 7 | box-shadow: 0 0 6px #f8b9b7; 8 | } 9 | .w5c-form .dropdown-menu { 10 | max-height: 400px; 11 | overflow-y: auto; 12 | } 13 | -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/bordered-pulled.less: -------------------------------------------------------------------------------- 1 | // Bordered & Pulled 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-border { 5 | padding: .2em .25em .15em; 6 | border: solid .08em @fa-border-color; 7 | border-radius: .1em; 8 | } 9 | 10 | .pull-right { float: right; } 11 | .pull-left { float: left; } 12 | 13 | .@{fa-css-prefix} { 14 | &.pull-left { margin-right: .3em; } 15 | &.pull-right { margin-left: .3em; } 16 | } 17 | -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/rotated-flipped.less: -------------------------------------------------------------------------------- 1 | // Rotated & Flipped Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-rotate-90 { .fa-icon-rotate(90deg, 1); } 5 | .@{fa-css-prefix}-rotate-180 { .fa-icon-rotate(180deg, 2); } 6 | .@{fa-css-prefix}-rotate-270 { .fa-icon-rotate(270deg, 3); } 7 | 8 | .@{fa-css-prefix}-flip-horizontal { .fa-icon-flip(-1, 1, 0); } 9 | .@{fa-css-prefix}-flip-vertical { .fa-icon-flip(1, -1, 2); } 10 | -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/larger.less: -------------------------------------------------------------------------------- 1 | // Icon Sizes 2 | // ------------------------- 3 | 4 | /* makes the font 33% larger relative to the icon container */ 5 | .@{fa-css-prefix}-lg { 6 | font-size: (4em / 3); 7 | line-height: (3em / 4); 8 | vertical-align: -15%; 9 | } 10 | .@{fa-css-prefix}-2x { font-size: 2em; } 11 | .@{fa-css-prefix}-3x { font-size: 3em; } 12 | .@{fa-css-prefix}-4x { font-size: 4em; } 13 | .@{fa-css-prefix}-5x { font-size: 5em; } 14 | -------------------------------------------------------------------------------- /web/static/js/tpl/common/delete_confirm_modal.html: -------------------------------------------------------------------------------- 1 | 4 | 7 | -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/list.less: -------------------------------------------------------------------------------- 1 | // List Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-ul { 5 | padding-left: 0; 6 | margin-left: @fa-li-width; 7 | list-style-type: none; 8 | > li { position: relative; } 9 | } 10 | .@{fa-css-prefix}-li { 11 | position: absolute; 12 | left: -@fa-li-width; 13 | width: @fa-li-width; 14 | top: (2em / 14); 15 | text-align: center; 16 | &.@{fa-css-prefix}-lg { 17 | left: -@fa-li-width + (4em / 14); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /web/static/js/filter/filter.js: -------------------------------------------------------------------------------- 1 | /*global ngNice,moment*/ 2 | (function () { 3 | "use strict"; 4 | ngNice.ngApp.filter("fullDate", [function () { 5 | return function (input) { 6 | var date = moment(input); 7 | return date.format("YYYY-MM-DD HH:ss"); 8 | } 9 | }]).filter("categoryName", ['config', function (config) { 10 | return function (input) { 11 | return _.findWhere(config.categories, {value: input}).name; 12 | } 13 | }]); 14 | })(); 15 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/media.css: -------------------------------------------------------------------------------- 1 | .media, 2 | .media-body { 3 | overflow: hidden; 4 | zoom: 1; 5 | } 6 | .media, 7 | .media .media { 8 | margin-top: 15px; 9 | } 10 | .media:first-child { 11 | margin-top: 0; 12 | } 13 | .media-object { 14 | display: block; 15 | } 16 | .media-heading { 17 | margin: 0 0 5px; 18 | } 19 | .media > .pull-left { 20 | margin-right: 10px; 21 | } 22 | .media > .pull-right { 23 | margin-left: 10px; 24 | } 25 | .media-list { 26 | padding-left: 0; 27 | list-style: none; 28 | } 29 | -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/font-awesome.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome 3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 4 | */ 5 | 6 | @import "variables"; 7 | @import "mixins"; 8 | @import "path"; 9 | @import "core"; 10 | @import "larger"; 11 | @import "fixed-width"; 12 | @import "list"; 13 | @import "bordered-pulled"; 14 | @import "spinning"; 15 | @import "rotated-flipped"; 16 | @import "stacked"; 17 | @import "icons"; 18 | -------------------------------------------------------------------------------- /server/data/model/applySchema.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), Schema = mongoose.Schema, _ = require("lodash"); //var Avatar = new Schema({ // type: { type: Number}, // path: { type: String } //}, { _id: false }); var Apply = new Schema({ id : {type: String, index: true }, email : {type: String }, desc : {type: String }, is_deleted : {type: Number, default: 0}, // 0: false; 1: true; create_date: {type: Number, default: Date.now}, update_date: {type: Number, default: Date.now} }); module.exports = Apply; -------------------------------------------------------------------------------- /web/static/js/controller/home.js: -------------------------------------------------------------------------------- 1 | /*global ngNice*/ 2 | (function () { 3 | "use strict"; 4 | 5 | ngNice.ngApp.controller("home_ctrl", ["$scope", "data", "$http", "$timeout", function ($scope, data, $http, $timeout) { 6 | 7 | $scope.input_keywords = ""; 8 | 9 | $scope.js_search = function (keywords) { 10 | window.open("https://www.google.com.hk/#q=site:ngnice.com+" + keywords); 11 | //window.location.href = "https://www.google.com.hk/#q=site:ngnice.com+" + keywords; 12 | }; 13 | }]); 14 | 15 | })(); 16 | 17 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/.csslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "adjoining-classes": false, 3 | "box-sizing": false, 4 | "box-model": false, 5 | "compatible-vendor-prefixes": false, 6 | "floats": false, 7 | "font-sizes": false, 8 | "gradients": false, 9 | "important": false, 10 | "known-properties": false, 11 | "outline-none": false, 12 | "qualified-headings": false, 13 | "regex-selectors": false, 14 | "shorthand": false, 15 | "text-indent": false, 16 | "unique-headings": false, 17 | "universal-selector": false, 18 | "unqualified-attributes": false 19 | } 20 | -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/stacked.less: -------------------------------------------------------------------------------- 1 | // Stacked Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-stack { 5 | position: relative; 6 | display: inline-block; 7 | width: 2em; 8 | height: 2em; 9 | line-height: 2em; 10 | vertical-align: middle; 11 | } 12 | .@{fa-css-prefix}-stack-1x, .@{fa-css-prefix}-stack-2x { 13 | position: absolute; 14 | left: 0; 15 | width: 100%; 16 | text-align: center; 17 | } 18 | .@{fa-css-prefix}-stack-1x { line-height: inherit; } 19 | .@{fa-css-prefix}-stack-2x { font-size: 2em; } 20 | .@{fa-css-prefix}-inverse { color: @fa-inverse; } 21 | -------------------------------------------------------------------------------- /server/auth.js: -------------------------------------------------------------------------------- 1 | var config = require("./config"), 2 | data = require("./data"), 3 | kits = require("./kits"), 4 | domain = require("domain"); 5 | 6 | /** 7 | * check auth 8 | * @param req 9 | * @param res 10 | * @param next 11 | */ 12 | exports.check = function (onlyCheck) { 13 | return function (req, res, next) { 14 | if (res.locals.isAuthorized || onlyCheck) { 15 | next(); 16 | } else { 17 | if (req.url.indexOf("/api") === 0) { 18 | return next({code: kits.status.error.permission_deny}); 19 | } else { 20 | return res.redirect("/signin"); 21 | } 22 | } 23 | }; 24 | }; -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/component-animations.less: -------------------------------------------------------------------------------- 1 | // 2 | // Component animations 3 | // -------------------------------------------------- 4 | 5 | // Heads up! 6 | // 7 | // We don't use the `.opacity()` mixin here since it causes a bug with text 8 | // fields in IE7-8. Source: https://github.com/twitter/bootstrap/pull/3552. 9 | 10 | .fade { 11 | opacity: 0; 12 | .transition(opacity .15s linear); 13 | &.in { 14 | opacity: 1; 15 | } 16 | } 17 | 18 | .collapse { 19 | display: none; 20 | &.in { 21 | display: block; 22 | } 23 | } 24 | .collapsing { 25 | position: relative; 26 | height: 0; 27 | overflow: hidden; 28 | .transition(height .35s ease); 29 | } 30 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/wells.less: -------------------------------------------------------------------------------- 1 | // 2 | // Wells 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .well { 8 | min-height: 20px; 9 | padding: 19px; 10 | margin-bottom: 20px; 11 | background-color: @well-bg; 12 | border: 1px solid @well-border; 13 | border-radius: @border-radius-base; 14 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); 15 | blockquote { 16 | border-color: #ddd; 17 | border-color: rgba(0,0,0,.15); 18 | } 19 | } 20 | 21 | // Sizes 22 | .well-lg { 23 | padding: 24px; 24 | border-radius: @border-radius-large; 25 | } 26 | .well-sm { 27 | padding: 9px; 28 | border-radius: @border-radius-small; 29 | } 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Deployed apps should consider commenting this line out: 24 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 25 | node_modules 26 | .idea 27 | /config.js 28 | web/static/css/less/*.css 29 | docs 30 | -------------------------------------------------------------------------------- /server/data/apply.js: -------------------------------------------------------------------------------- 1 | var util = require("util"), BaseData = require("./base"), mongoose = require('mongoose'), utils = require("../utils"), constant = require("../constant"); function ApplyData(schema) { this.Schema = schema; BaseData.call(this, mongoose.model("apply", schema)); /** * add user * @param name * @param email * @param password * @param callback */ this.add = function (name, email, callback) { var apply = new this.model({ id : utils.short_guid(), email : email }); apply.save(function (err) { return callback(err); }); }; }; util.inherits(ApplyData, BaseData); module.exports = ApplyData; -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/breadcrumbs.less: -------------------------------------------------------------------------------- 1 | // 2 | // Breadcrumbs 3 | // -------------------------------------------------- 4 | 5 | 6 | .breadcrumb { 7 | padding: @breadcrumb-padding-vertical @breadcrumb-padding-horizontal; 8 | margin-bottom: @line-height-computed; 9 | list-style: none; 10 | background-color: @breadcrumb-bg; 11 | border-radius: @border-radius-base; 12 | 13 | > li { 14 | display: inline-block; 15 | 16 | + li:before { 17 | content: "@{breadcrumb-separator}\00a0"; // Unicode space added since inline-block means non-collapsing white-space 18 | padding: 0 5px; 19 | color: @breadcrumb-color; 20 | } 21 | } 22 | 23 | > .active { 24 | color: @breadcrumb-active-color; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /web/static/lib/w5cValidator/1.0.0/style.less: -------------------------------------------------------------------------------- 1 | .w5c-form { 2 | input:focus:invalid:focus, 3 | textarea:focus:invalid:focus, 4 | select:focus:invalid:focus { 5 | border-color : rgba(82, 168, 236, 0.8); 6 | outline : 0; 7 | outline : thin dotted \9; 8 | .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)"); 9 | color : #000000; 10 | } 11 | 12 | input.error:invalid, 13 | textarea.error:invalid, 14 | select.error:invalid { 15 | border-color : #e9322d; 16 | -webkit-box-shadow : 0 0 6px #f8b9b7; 17 | -moz-box-shadow : 0 0 6px #f8b9b7; 18 | box-shadow : 0 0 6px #f8b9b7; 19 | } 20 | 21 | .dropdown-menu { 22 | max-height : 400px; 23 | overflow-y : auto; 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /web/view/shared/scripts.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | <% if(app.env == "development") {%> 8 | <% 9 | var scripts = app.siteScripts || []; 10 | for (var i = 0, l = scripts.length; i < l; i++) { %> 11 | 12 | <% } %> 13 | <% } else { %> 14 | 15 | 20 | 21 | <% } %> -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/path.less: -------------------------------------------------------------------------------- 1 | /* FONT PATH 2 | * -------------------------- */ 3 | 4 | @font-face { 5 | font-family: 'FontAwesome'; 6 | src: url('@{fa-font-path}/fontawesome-webfont.eot?v=@{fa-version}'); 7 | src: url('@{fa-font-path}/fontawesome-webfont.eot?#iefix&v=@{fa-version}') format('embedded-opentype'), 8 | url('@{fa-font-path}/fontawesome-webfont.woff?v=@{fa-version}') format('woff'), 9 | url('@{fa-font-path}/fontawesome-webfont.ttf?v=@{fa-version}') format('truetype'), 10 | url('@{fa-font-path}/fontawesome-webfont.svg?v=@{fa-version}#fontawesomeregular') format('svg'); 11 | // src: url('@{fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts 12 | font-weight: normal; 13 | font-style: normal; 14 | } 15 | -------------------------------------------------------------------------------- /server/controller/userCtrl.js: -------------------------------------------------------------------------------- 1 | /*global process,exports,require*/ (function () { "use strict"; var config = require("../config"); exports.signin = function (req, res) { res.render('user/signin.html', { title: '登录', current_nav: "signin" }); }; exports.signup = function (req, res) { res.render('user/signup.html', { title: '注册', current_nav: "signup" }); }; exports.logout = function (req, res) { res.clearCookie(config.sessionKey, { path: '/' }); res.redirect("/"); }; exports.home = function (req, res) { res.render('user/home.html', { title: '首页', current_nav: "profile" }); }; exports.setting = function (req, res) { res.render('user/setting.html', {layout: 'layout', title: '帐户设置', current_nav: "profile" }); }; })(); -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------- 3 | 4 | .fa-icon-rotate(@degrees, @rotation) { 5 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation); 6 | -webkit-transform: rotate(@degrees); 7 | -moz-transform: rotate(@degrees); 8 | -ms-transform: rotate(@degrees); 9 | -o-transform: rotate(@degrees); 10 | transform: rotate(@degrees); 11 | } 12 | 13 | .fa-icon-flip(@horiz, @vert, @rotation) { 14 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation, mirror=1); 15 | -webkit-transform: scale(@horiz, @vert); 16 | -moz-transform: scale(@horiz, @vert); 17 | -ms-transform: scale(@horiz, @vert); 18 | -o-transform: scale(@horiz, @vert); 19 | transform: scale(@horiz, @vert); 20 | } 21 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/close.less: -------------------------------------------------------------------------------- 1 | // 2 | // Close icons 3 | // -------------------------------------------------- 4 | 5 | 6 | .close { 7 | float: right; 8 | font-size: (@font-size-base * 1.5); 9 | font-weight: @close-font-weight; 10 | line-height: 1; 11 | color: @close-color; 12 | text-shadow: @close-text-shadow; 13 | .opacity(.2); 14 | 15 | &:hover, 16 | &:focus { 17 | color: @close-color; 18 | text-decoration: none; 19 | cursor: pointer; 20 | .opacity(.5); 21 | } 22 | 23 | // Additional properties for button version 24 | // iOS requires the button element instead of an anchor tag. 25 | // If you want the anchor version, it requires `href="#"`. 26 | button& { 27 | padding: 0; 28 | cursor: pointer; 29 | background: transparent; 30 | border: 0; 31 | -webkit-appearance: none; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /web/view/layout_inner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <%-title%> - <%=app.title%> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | <%-include header/header.html%> 17 |
18 | <%-body%> 19 |
20 |
21 |
22 | 23 | <%-include shared/scripts.html%> 24 | 25 | 26 | -------------------------------------------------------------------------------- /web/view/footer/footer.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/config/test.js: -------------------------------------------------------------------------------- 1 | var config = { 2 | port : 8888, 3 | host : "127.0.0.1", 4 | domain : ".ngnice.local", 5 | baseUrl : "http://127.0.0.1:8888", 6 | mongoServer : "mongodb://127.0.0.1/ngnice", 7 | cookieSecret : "WOJIUSHINIUBI123456", 8 | errorHandlerOptions: { 9 | dumpExceptions: true, 10 | showStack : true 11 | }, 12 | passport : { 13 | weibo: { 14 | authorizationURL: "https://api.weibo.com/oauth2/authorize", 15 | tokenURL : "https://api.weibo.com/oauth2/access_token", 16 | clientID : "2012243955", 17 | clientSecret : "3af5d86cd7e6309bdc2076c89fd46f97", 18 | callbackURL : "http://local.ngnice.com:8888/auth/weibo/callback" 19 | } 20 | } 21 | }; 22 | 23 | module.exports = exports = config; 24 | -------------------------------------------------------------------------------- /web/view/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <%-title%> - <%=app.title%> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | <%-include header/header.html%> 16 |
17 | <%-body%> 18 |
19 |
20 |
21 |
22 | 23 | <%-include footer/footer.html%> 24 | 25 | <%-include shared/scripts.html%> 26 | 27 | 28 | -------------------------------------------------------------------------------- /web/static/fonts/font-awesome/4.0.3/less/spinning.less: -------------------------------------------------------------------------------- 1 | // Spinning Icons 2 | // -------------------------- 3 | 4 | .@{fa-css-prefix}-spin { 5 | -webkit-animation: spin 2s infinite linear; 6 | -moz-animation: spin 2s infinite linear; 7 | -o-animation: spin 2s infinite linear; 8 | animation: spin 2s infinite linear; 9 | } 10 | 11 | @-moz-keyframes spin { 12 | 0% { -moz-transform: rotate(0deg); } 13 | 100% { -moz-transform: rotate(359deg); } 14 | } 15 | @-webkit-keyframes spin { 16 | 0% { -webkit-transform: rotate(0deg); } 17 | 100% { -webkit-transform: rotate(359deg); } 18 | } 19 | @-o-keyframes spin { 20 | 0% { -o-transform: rotate(0deg); } 21 | 100% { -o-transform: rotate(359deg); } 22 | } 23 | @-ms-keyframes spin { 24 | 0% { -ms-transform: rotate(0deg); } 25 | 100% { -ms-transform: rotate(359deg); } 26 | } 27 | @keyframes spin { 28 | 0% { transform: rotate(0deg); } 29 | 100% { transform: rotate(359deg); } 30 | } 31 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/thumbnails.less: -------------------------------------------------------------------------------- 1 | // 2 | // Thumbnails 3 | // -------------------------------------------------- 4 | 5 | 6 | // Mixin and adjust the regular image class 7 | .thumbnail { 8 | display: block; 9 | padding: @thumbnail-padding; 10 | margin-bottom: @line-height-computed; 11 | line-height: @line-height-base; 12 | background-color: @thumbnail-bg; 13 | border: 1px solid @thumbnail-border; 14 | border-radius: @thumbnail-border-radius; 15 | .transition(all .2s ease-in-out); 16 | 17 | > img, 18 | a > img { 19 | &:extend(.img-responsive); 20 | margin-left: auto; 21 | margin-right: auto; 22 | } 23 | 24 | // Add a hover state for linked versions only 25 | a&:hover, 26 | a&:focus, 27 | a&.active { 28 | border-color: @link-color; 29 | } 30 | 31 | // Image captions 32 | .caption { 33 | padding: @thumbnail-caption-padding; 34 | color: @thumbnail-caption-color; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /server/data/base.js: -------------------------------------------------------------------------------- 1 | var Base = function (model) { 2 | var self = this; 3 | this.model = model; 4 | 5 | Base.prototype.get_by_id = function (id, callback) { 6 | this.model.findOne({id: id}, function (err, data) { 7 | return callback(err, data); 8 | }); 9 | }; 10 | 11 | Base.prototype.get_list_page = function (options, fields, sort, page, size, callback) { 12 | var query = self.model.find(options); 13 | query.count(function (err, total) { 14 | if (err) { 15 | return callback(err); 16 | } 17 | query = self.model.find(options, fields); 18 | query.sort(sort).skip((page - 1) * size).limit(size).exec(function (err, data) { 19 | if (err) { 20 | return callback(err); 21 | } 22 | return callback(null, data, total) 23 | }); 24 | }); 25 | }; 26 | }; 27 | 28 | 29 | module.exports = Base; 30 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/ascetic.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Original style from softwaremaniacs.org (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | background: white; color: black; 10 | } 11 | 12 | .hljs-string, 13 | .hljs-tag .hljs-value, 14 | .hljs-filter .hljs-argument, 15 | .hljs-addition, 16 | .hljs-change, 17 | .apache .hljs-tag, 18 | .apache .hljs-cbracket, 19 | .nginx .hljs-built_in, 20 | .tex .hljs-formula { 21 | color: #888; 22 | } 23 | 24 | .hljs-comment, 25 | .hljs-template_comment, 26 | .hljs-shebang, 27 | .hljs-doctype, 28 | .hljs-pi, 29 | .hljs-javadoc, 30 | .hljs-deletion, 31 | .apache .hljs-sqbracket { 32 | color: #CCC; 33 | } 34 | 35 | .hljs-keyword, 36 | .hljs-tag .hljs-title, 37 | .ini .hljs-title, 38 | .lisp .hljs-title, 39 | .clojure .hljs-title, 40 | .http .hljs-title, 41 | .nginx .hljs-title, 42 | .css .hljs-tag, 43 | .hljs-winutils, 44 | .hljs-flow, 45 | .apache .hljs-tag, 46 | .tex .hljs-command, 47 | .hljs-request, 48 | .hljs-status { 49 | font-weight: bold; 50 | } 51 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/utilities.less: -------------------------------------------------------------------------------- 1 | // 2 | // Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // Floats 7 | // ------------------------- 8 | 9 | .clearfix { 10 | .clearfix(); 11 | } 12 | .center-block { 13 | .center-block(); 14 | } 15 | .pull-right { 16 | float: right !important; 17 | } 18 | .pull-left { 19 | float: left !important; 20 | } 21 | 22 | 23 | // Toggling content 24 | // ------------------------- 25 | 26 | // Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1 27 | .hide { 28 | display: none !important; 29 | } 30 | .show { 31 | display: block !important; 32 | } 33 | .invisible { 34 | visibility: hidden; 35 | } 36 | .text-hide { 37 | .text-hide(); 38 | } 39 | 40 | 41 | // Hide from screenreaders and browsers 42 | // 43 | // Credit: HTML5 Boilerplate 44 | 45 | .hidden { 46 | display: none !important; 47 | visibility: hidden !important; 48 | } 49 | 50 | 51 | // For Affix plugin 52 | // ------------------------- 53 | 54 | .affix { 55 | position: fixed; 56 | } 57 | -------------------------------------------------------------------------------- /server/kits/status.js: -------------------------------------------------------------------------------- 1 | /*global require,module*/ var status = { ok : 200, invalid_input: 401, not_found : 404, error : { sig : 1001, //错误的签名 ver : 1002, //错误的接口版本号 err_client_ver : 1003, //错误的客户端版本号 invalid_token : 1004, //无效的访问令牌 permission_deny: 1005, // 无权限访问 server_error : 500, //服务端错误 unknown : 404, unknown_format : 406 }, user_error : { invalid_user : 1001, check_user_err : 1002, invalid_name_or_password: 1003, name_exists : 1004, email_exists : 1005, change_user : 1006, invalid_password : 1007, get_user_err : 1008, update_pwd_err : 1008 }, post_error : { add_err : 2001, get_list_err : 2002, get_err : 2003, update_err : 2004, publish_err : 2005, unpublish_err: 2006, delete_err : 2007 } }; exports = module.exports = status; -------------------------------------------------------------------------------- /server/config/development.js: -------------------------------------------------------------------------------- 1 | var config = { 2 | port : 8888, 3 | host : "127.0.0.1", 4 | domain : ".ngnice.local", 5 | baseUrl : "http://127.0.0.1:8888", 6 | mongoServer : "mongodb://127.0.0.1/ngnice", 7 | cookieSecret : "WOJIUSHINIUBI123456", 8 | errorHandlerOptions: { 9 | dumpExceptions: true, 10 | showStack : true 11 | }, 12 | passport : { 13 | weibo: { 14 | authorizationURL: "https://api.weibo.com/oauth2/authorize", 15 | tokenURL : "https://api.weibo.com/oauth2/access_token", 16 | clientID : "2012243955", 17 | clientSecret : "3af5d86cd7e6309bdc2076c89fd46f97", 18 | callbackURL : "http://local.ngnice.com:8888/auth/weibo/callback" 19 | } 20 | }, 21 | logger : { 22 | dirname : "logs", 23 | filename: "", 24 | level : "info", 25 | maxsize : 1024 * 1024 * 10 26 | } 27 | }; 28 | 29 | module.exports = exports = config; 30 | -------------------------------------------------------------------------------- /web/static/js/status.js: -------------------------------------------------------------------------------- 1 | 2 | (function () { 3 | "use strict"; 4 | var status = { 5 | ok : 200, 6 | invalid_input: 401, 7 | not_found : 404, 8 | error : { 9 | sig : 1001, //错误的签名 10 | ver : 1002, //错误的接口版本号 11 | err_client_ver : 1003, //错误的客户端版本号 12 | invalid_token : 1004, //无效的访问令牌 13 | permission_deny: 1005, // 无权限访问 14 | server_error : 500, //服务端错误 15 | unknown : 404, 16 | unknown_format : 406 17 | }, 18 | user_error : { 19 | invalid_user : 1001, 20 | check_user_err : 1002, 21 | invalid_name_or_password: 1003, 22 | name_exists : 1004, 23 | email_exists : 1005 24 | }, 25 | post_error : { 26 | add_err: 2001, 27 | get_list_err: 2002 28 | } 29 | }; 30 | 31 | 32 | window.ngNice.status = window.ngNice.status || status; 33 | })(); 34 | 35 | -------------------------------------------------------------------------------- /server/config/production.js: -------------------------------------------------------------------------------- 1 | var _ = require('lodash'); 2 | 3 | var config = { 4 | port : 8888, 5 | host : "www.ngnice.com", 6 | domain : ".ngnice.com", 7 | baseUrl : "http://www.ngnice.com", 8 | errorHandlerOptions: { 9 | dumpExceptions: true, 10 | showStack : true 11 | }, 12 | passport : { 13 | weibo: { 14 | authorizationURL: "https://api.weibo.com/oauth2/authorize", 15 | tokenURL : "https://api.weibo.com/oauth2/access_token", 16 | clientID : "2012243955", 17 | clientSecret : "3af5d86cd7e6309bdc2076c89fd46f97", 18 | callbackURL : "http://local.ngnice.com:8888/auth/weibo/callback" 19 | } 20 | }, 21 | logger : { 22 | dirname : "/home/web-log/node-js", 23 | filename: "log-info.log", 24 | level : "info", 25 | maxsize : 1024 * 1024 * 10 26 | } 27 | }; 28 | var envConfig = require("./production.confidential.js"); 29 | 30 | module.exports = exports = _.merge(config, envConfig);; 31 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/jumbotron.less: -------------------------------------------------------------------------------- 1 | // 2 | // Jumbotron 3 | // -------------------------------------------------- 4 | 5 | 6 | .jumbotron { 7 | padding: @jumbotron-padding; 8 | margin-bottom: @jumbotron-padding; 9 | color: @jumbotron-color; 10 | background-color: @jumbotron-bg; 11 | 12 | h1, 13 | .h1 { 14 | color: @jumbotron-heading-color; 15 | } 16 | p { 17 | margin-bottom: (@jumbotron-padding / 2); 18 | font-size: @jumbotron-font-size; 19 | font-weight: 200; 20 | } 21 | 22 | .container & { 23 | border-radius: @border-radius-large; // Only round corners at higher resolutions if contained in a container 24 | } 25 | 26 | .container { 27 | max-width: 100%; 28 | } 29 | 30 | @media screen and (min-width: @screen-sm-min) { 31 | padding-top: (@jumbotron-padding * 1.6); 32 | padding-bottom: (@jumbotron-padding * 1.6); 33 | 34 | .container & { 35 | padding-left: (@jumbotron-padding * 2); 36 | padding-right: (@jumbotron-padding * 2); 37 | } 38 | 39 | h1, 40 | .h1 { 41 | font-size: (@font-size-base * 4.5); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/bootstrap.less: -------------------------------------------------------------------------------- 1 | // Core variables and mixins 2 | @import "variables"; 3 | @import "mixins"; 4 | 5 | // Reset 6 | @import "normalize"; 7 | @import "print"; 8 | 9 | // Core CSS 10 | @import "scaffolding"; 11 | @import "type"; 12 | @import "code"; 13 | @import "grid"; 14 | @import "tables"; 15 | @import "forms"; 16 | @import "buttons"; 17 | 18 | // Components 19 | @import "component-animations"; 20 | @import "glyphicons"; 21 | @import "dropdowns"; 22 | @import "button-groups"; 23 | @import "input-groups"; 24 | @import "navs"; 25 | @import "navbar"; 26 | @import "breadcrumbs"; 27 | @import "pagination"; 28 | @import "pager"; 29 | @import "labels"; 30 | @import "badges"; 31 | @import "jumbotron"; 32 | @import "thumbnails"; 33 | @import "alerts"; 34 | @import "progress-bars"; 35 | @import "media"; 36 | @import "list-group"; 37 | @import "panels"; 38 | @import "wells"; 39 | @import "close"; 40 | 41 | // Components w/ JavaScript 42 | @import "modals"; 43 | @import "tooltip"; 44 | @import "popovers"; 45 | @import "carousel"; 46 | 47 | // Utility classes 48 | @import "utilities"; 49 | @import "responsive-utilities"; 50 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/media.less: -------------------------------------------------------------------------------- 1 | // Media objects 2 | // Source: http://stubbornella.org/content/?p=497 3 | // -------------------------------------------------- 4 | 5 | 6 | // Common styles 7 | // ------------------------- 8 | 9 | // Clear the floats 10 | .media, 11 | .media-body { 12 | overflow: hidden; 13 | zoom: 1; 14 | } 15 | 16 | // Proper spacing between instances of .media 17 | .media, 18 | .media .media { 19 | margin-top: 15px; 20 | } 21 | .media:first-child { 22 | margin-top: 0; 23 | } 24 | 25 | // For images and videos, set to block 26 | .media-object { 27 | display: block; 28 | } 29 | 30 | // Reset margins on headings for tighter default spacing 31 | .media-heading { 32 | margin: 0 0 5px; 33 | } 34 | 35 | 36 | // Media image alignment 37 | // ------------------------- 38 | 39 | .media { 40 | > .pull-left { 41 | margin-right: 10px; 42 | } 43 | > .pull-right { 44 | margin-left: 10px; 45 | } 46 | } 47 | 48 | 49 | // Media list variation 50 | // ------------------------- 51 | 52 | // Undo default ul/ol styles 53 | .media-list { 54 | padding-left: 0; 55 | list-style: none; 56 | } 57 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/pager.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pager pagination 3 | // -------------------------------------------------- 4 | 5 | 6 | .pager { 7 | padding-left: 0; 8 | margin: @line-height-computed 0; 9 | list-style: none; 10 | text-align: center; 11 | &:extend(.clearfix all); 12 | li { 13 | display: inline; 14 | > a, 15 | > span { 16 | display: inline-block; 17 | padding: 5px 14px; 18 | background-color: @pager-bg; 19 | border: 1px solid @pager-border; 20 | border-radius: @pager-border-radius; 21 | } 22 | 23 | > a:hover, 24 | > a:focus { 25 | text-decoration: none; 26 | background-color: @pager-hover-bg; 27 | } 28 | } 29 | 30 | .next { 31 | > a, 32 | > span { 33 | float: right; 34 | } 35 | } 36 | 37 | .previous { 38 | > a, 39 | > span { 40 | float: left; 41 | } 42 | } 43 | 44 | .disabled { 45 | > a, 46 | > a:hover, 47 | > a:focus, 48 | > span { 49 | color: @pager-disabled-color; 50 | background-color: @pager-bg; 51 | cursor: not-allowed; 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Angular中国区互助组 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /server/data/index.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), config = require('../config'), schemas = require("./model/schema"), kits = require("../kits"), UserData = require("./user"), PostData = require("./post"), connectTimes = 0; var connect = function () { connectTimes++; if(connectTimes > 5){ return; } var options = { server: { socketOptions: { keepAlive: 1 } } } mongoose.connect(config.mongoServer, options, function (err) { if (err) { kits.logger.error(err, "connect mongodb error"); }else{ kits.logger.info("connect mongodb successfully..."); } }); }; // Error handler mongoose.connection.on('error', function (err) { kits.logger.error(err, "connect mongodb error"); }); // Reconnect when closed mongoose.connection.on('disconnected', function () { connect(); }); // Connect mongodb connect(); process.on('SIGINT', function() { mongoose.connection.close(function () { kits.logger.info('Mongoose disconnected through app termination'); process.exit(0); }); }); module.exports = { User: new UserData(schemas.User), Post: new PostData(schemas.Post) }; -------------------------------------------------------------------------------- /server/passport.js: -------------------------------------------------------------------------------- 1 | var config = require("./config"), 2 | WeiboStrategy = require('passport-weibo').Strategy, 3 | //GithubStrategy = require('passport-github').Strategy, 4 | data = require("./data"); 5 | 6 | module.exports = exports = { 7 | config: function (passport) { 8 | passport.serializeUser(function (user, done) { 9 | done(null, user); 10 | }); 11 | 12 | passport.deserializeUser(function (obj, done) { 13 | done(null, obj); 14 | }); 15 | 16 | passport.use(new WeiboStrategy({ 17 | authorizationURL: config.passport.weibo.authorizationURL, 18 | tokenURL : config.passport.weibo.tokenURL, 19 | clientID : config.passport.weibo.clientID, 20 | clientSecret : config.passport.weibo.clientSecret, 21 | callbackURL : config.passport.weibo.callbackURL 22 | }, 23 | function (accessToken, refreshToken, profile, done) { 24 | data.User.get_or_create(profile, function (err, user) { 25 | return done(err, user); 26 | }); 27 | } 28 | )); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/mono-blue.css: -------------------------------------------------------------------------------- 1 | /* 2 | Five-color theme from a single blue hue. 3 | */ 4 | .hljs { 5 | display: block; padding: 0.5em; 6 | background: #EAEEF3; color: #00193A; 7 | } 8 | 9 | .hljs-keyword, 10 | .hljs-title, 11 | .hljs-important, 12 | .hljs-request, 13 | .hljs-header, 14 | .hljs-javadoctag { 15 | font-weight: bold; 16 | } 17 | 18 | .hljs-comment, 19 | .hljs-chunk, 20 | .hljs-template_comment { 21 | color: #738191; 22 | } 23 | 24 | .hljs-string, 25 | .hljs-title, 26 | .hljs-parent, 27 | .hljs-built_in, 28 | .hljs-literal, 29 | .hljs-filename, 30 | .hljs-value, 31 | .hljs-addition, 32 | .hljs-tag, 33 | .hljs-argument, 34 | .hljs-link_label, 35 | .hljs-blockquote, 36 | .hljs-header { 37 | color: #0048AB; 38 | } 39 | 40 | .hljs-decorator, 41 | .hljs-prompt, 42 | .hljs-yardoctag, 43 | .hljs-subst, 44 | .hljs-symbol, 45 | .hljs-doctype, 46 | .hljs-regexp, 47 | .hljs-preprocessor, 48 | .hljs-pragma, 49 | .hljs-pi, 50 | .hljs-attribute, 51 | .hljs-attr_selector, 52 | .hljs-javadoc, 53 | .hljs-xmlDocTag, 54 | .hljs-deletion, 55 | .hljs-shebang, 56 | .hljs-string .hljs-variable, 57 | .hljs-link_url, 58 | .hljs-bullet, 59 | .hljs-sqbracket, 60 | .hljs-phony { 61 | color: #4C81C9; 62 | } 63 | -------------------------------------------------------------------------------- /web/view/user/signin.html: -------------------------------------------------------------------------------- 1 |
{{form_user_login.$errors[0]}}
-------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-nice", 3 | "version": "1.0.4", 4 | "author": "why520crazy", 5 | "description": "ng-nice app!", 6 | "scripts": { 7 | "start": "NODE_ENV=production node app.js", 8 | "start-dev": "NODE_ENV=development node app.js", 9 | "test": "grunt test" 10 | }, 11 | "dependencies": { 12 | "body-parser": "~1.0.2", 13 | "compression": "~1.0.7", 14 | "cookie-parser": "~1.0.1", 15 | "ejs": "2.5.7", 16 | "express": "~4.8.2", 17 | "express3-ejs-layout": "~0.0.1", 18 | "formidable": "~1.0.14", 19 | "lodash": "~2.4.1", 20 | "markdown": "~0.5.0", 21 | "marked": "~0.3.2", 22 | "method-override": "~1.0.0", 23 | "moment": "2.19.3", 24 | "mongoose": "~3.8.8", 25 | "morgan": "~1.0.1", 26 | "node-uuid": "~1.4.1", 27 | "nodemailer": "~0.6.3", 28 | "passport": "~0.2.0", 29 | "passport-github": "~0.1.5", 30 | "passport-weibo": "~0.1.0", 31 | "winston": "^1.0.1" 32 | }, 33 | "devDependencies": { 34 | "grunt": "~0.4.4", 35 | "grunt-contrib-concat": "*", 36 | "grunt-contrib-jshint": "~0.6.0", 37 | "grunt-contrib-less": "^1.0.0", 38 | "grunt-contrib-nodeunit": "~0.2.0", 39 | "grunt-contrib-uglify": "~0.2.2", 40 | "grunt-jsdoc": "~0.5.6", 41 | "ink-docstrap": "~0.4.12" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/badges.less: -------------------------------------------------------------------------------- 1 | // 2 | // Badges 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base classes 7 | .badge { 8 | display: inline-block; 9 | min-width: 10px; 10 | padding: 3px 7px; 11 | font-size: @font-size-small; 12 | font-weight: @badge-font-weight; 13 | color: @badge-color; 14 | line-height: @badge-line-height; 15 | vertical-align: baseline; 16 | white-space: nowrap; 17 | text-align: center; 18 | background-color: @badge-bg; 19 | border-radius: @badge-border-radius; 20 | 21 | // Empty badges collapse automatically (not available in IE8) 22 | &:empty { 23 | display: none; 24 | } 25 | 26 | // Quick fix for badges in buttons 27 | .btn & { 28 | position: relative; 29 | top: -1px; 30 | } 31 | .btn-xs & { 32 | top: 0; 33 | padding: 1px 5px; 34 | } 35 | } 36 | 37 | // Hover state, but only for links 38 | a.badge { 39 | &:hover, 40 | &:focus { 41 | color: @badge-link-hover-color; 42 | text-decoration: none; 43 | cursor: pointer; 44 | } 45 | } 46 | 47 | // Account for counters in navs 48 | a.list-group-item.active > .badge, 49 | .nav-pills > .active > a > .badge { 50 | color: @badge-active-color; 51 | background-color: @badge-active-bg; 52 | } 53 | .nav-pills > li > a > .badge { 54 | margin-left: 3px; 55 | } 56 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/labels.less: -------------------------------------------------------------------------------- 1 | // 2 | // Labels 3 | // -------------------------------------------------- 4 | 5 | .label { 6 | display: inline; 7 | padding: .2em .6em .3em; 8 | font-size: 75%; 9 | font-weight: bold; 10 | line-height: 1; 11 | color: @label-color; 12 | text-align: center; 13 | white-space: nowrap; 14 | vertical-align: baseline; 15 | border-radius: .25em; 16 | 17 | // Add hover effects, but only for links 18 | &[href] { 19 | &:hover, 20 | &:focus { 21 | color: @label-link-hover-color; 22 | text-decoration: none; 23 | cursor: pointer; 24 | } 25 | } 26 | 27 | // Empty labels collapse automatically (not available in IE8) 28 | &:empty { 29 | display: none; 30 | } 31 | 32 | // Quick fix for labels in buttons 33 | .btn & { 34 | position: relative; 35 | top: -1px; 36 | } 37 | } 38 | 39 | // Colors 40 | // Contextual variations (linked labels get darker on :hover) 41 | 42 | .label-default { 43 | .label-variant(@label-default-bg); 44 | } 45 | 46 | .label-primary { 47 | .label-variant(@label-primary-bg); 48 | } 49 | 50 | .label-success { 51 | .label-variant(@label-success-bg); 52 | } 53 | 54 | .label-info { 55 | .label-variant(@label-info-bg); 56 | } 57 | 58 | .label-warning { 59 | .label-variant(@label-warning-bg); 60 | } 61 | 62 | .label-danger { 63 | .label-variant(@label-danger-bg); 64 | } 65 | -------------------------------------------------------------------------------- /server/data/model/userSchema.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), Schema = mongoose.Schema, _ = require("lodash"); //var Avatar = new Schema({ // type: { type: Number}, // path: { type: String } //}, { _id: false }); var User = new Schema({ id : {type: String, index: true }, name : {type: String }, nickname : {type: String }, email : {type: String }, avatar : { type: { type: Number, default: 1 },//1:remote url path: { type: String, default: '' } }, desc : {type: String, default: ''}, password : {type: String}, salt : {type: String}, is_deleted : {type: Number, default: 0}, // 0: false; 1: true; status : {type: Number, default: 1 }, // 1: ok, 2: need to mail confirm role : {type: Number, default: 1},//1.member,2.admin,3.supper admin online : {type: Number, default: 0}, create_date: {type: Number, default: Date.now}, update_date: {type: Number, default: Date.now} }); User.virtual('display_name').get(function () { return this.nickname || this.name; }); User.methods = { makeSimple: function () { var result = _.pick(this, 'id', 'name', 'nickname', 'email', 'avatar', 'status', 'role','display_name','desc'); if (result.avatar.type == 1 && _.isEmpty(result.avatar.path)) { result.avatar.path = "/img/default_avatar.png"; } return result; } }; User.statics = { }; module.exports = User; -------------------------------------------------------------------------------- /web/static/lib/bootstrap/notify/1.0.0/less/bootstrap-notify.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Bootstrap-notify.less 3 | * 4 | * @author Vitaly @Laboratory 5 | * @author Nijiko Yonskai 6 | * @copyright 2012 Vitaly 7 | * @copyright 2013 Nijiko Yonskai 8 | */ 9 | 10 | @right: 200px; 11 | @left: @right; 12 | @top: 0px; 13 | @bottom: @top; 14 | 15 | .notifications { 16 | position: fixed; 17 | //pointer-events: none; 18 | 19 | z-index: 1060; 20 | 21 | &.top-right { 22 | right: @right; 23 | top: @top; 24 | } 25 | 26 | &.top-left { 27 | left: @left; 28 | top: @top; 29 | } 30 | 31 | &.bottom-left { 32 | left: @left; 33 | bottom: @bottom; 34 | } 35 | 36 | &.bottom-right { 37 | right: @right; 38 | bottom: @bottom; 39 | } 40 | 41 | > div { 42 | position: relative; 43 | z-index: 9999; 44 | margin: 5px 0px; 45 | } 46 | 47 | &.center { 48 | top: 48%; 49 | left: 0; 50 | width: 100%; 51 | 52 | > div { 53 | margin: 5px auto; 54 | width: 20%; 55 | text-align: center; 56 | } 57 | } 58 | &.center-top{ 59 | top: 60px; 60 | left: 0; 61 | width: 100%; 62 | 63 | > div { 64 | pointer-events: auto; 65 | margin: 5px auto; 66 | width: 20%; 67 | text-align: center; 68 | } 69 | } 70 | } 71 | 72 | .notifications{ 73 | right: 200px; 74 | width: 300px; 75 | .alert{ 76 | padding: 9px; 77 | text-align: center; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/print.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | * { 3 | text-shadow: none !important; 4 | color: #000 !important; 5 | background: transparent !important; 6 | box-shadow: none !important; 7 | } 8 | a, 9 | a:visited { 10 | text-decoration: underline; 11 | } 12 | a[href]:after { 13 | content: " (" attr(href) ")"; 14 | } 15 | abbr[title]:after { 16 | content: " (" attr(title) ")"; 17 | } 18 | a[href^="javascript:"]:after, 19 | a[href^="#"]:after { 20 | content: ""; 21 | } 22 | pre, 23 | blockquote { 24 | border: 1px solid #999; 25 | page-break-inside: avoid; 26 | } 27 | thead { 28 | display: table-header-group; 29 | } 30 | tr, 31 | img { 32 | page-break-inside: avoid; 33 | } 34 | img { 35 | max-width: 100% !important; 36 | } 37 | p, 38 | h2, 39 | h3 { 40 | orphans: 3; 41 | widows: 3; 42 | } 43 | h2, 44 | h3 { 45 | page-break-after: avoid; 46 | } 47 | select { 48 | background: #fff !important; 49 | } 50 | .navbar { 51 | display: none; 52 | } 53 | .table td, 54 | .table th { 55 | background-color: #fff !important; 56 | } 57 | .btn > .caret, 58 | .dropup > .btn > .caret { 59 | border-top-color: #000 !important; 60 | } 61 | .label { 62 | border: 1px solid #000; 63 | } 64 | .table { 65 | border-collapse: collapse !important; 66 | } 67 | .table-bordered th, 68 | .table-bordered td { 69 | border: 1px solid #ddd !important; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /web/view/user/signup.html: -------------------------------------------------------------------------------- 1 |
{{form_user_signup.$errors[0]}}
-------------------------------------------------------------------------------- /web/view/home/about.html: -------------------------------------------------------------------------------- 1 |

关于我们


NgNice站点是由一批AngularJS爱好者发起的,致力于打造一个AngularJS的学习和经验分享平台。
目前NgNice平台不对外开放注册功能,站内分享内容主要由NgNice官方团队进行维护,如果你也是AngularJS的爱好者,并且乐于分享你的经验给其他人,那就加入我们吧! 官方团队成员参见:点击查看团队成员

NgNice站点目前提供的功能如下:

  1. 简单的内容发布,主要分享一些AngularJS使用的经验
  2. AngularJS开发指南中文翻译的展示,github源码地址:https://github.com/jingyanjiaoliu/angular-guide-zh
  3. AngularJS showcase项目的展示,目前处于开发阶段,github源码地址:https://github.com/angular-cn/ng-showcase
  4. ...

说明:

-------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/code.less: -------------------------------------------------------------------------------- 1 | // 2 | // Code (inline and block) 3 | // -------------------------------------------------- 4 | 5 | 6 | // Inline and block code styles 7 | code, 8 | kbd, 9 | pre, 10 | samp { 11 | font-family: @font-family-monospace; 12 | } 13 | 14 | // Inline code 15 | code { 16 | padding: 2px 4px; 17 | font-size: 90%; 18 | color: @code-color; 19 | background-color: @code-bg; 20 | white-space: nowrap; 21 | border-radius: @border-radius-base; 22 | } 23 | 24 | // User input typically entered via keyboard 25 | kbd { 26 | padding: 2px 4px; 27 | font-size: 90%; 28 | color: @kbd-color; 29 | background-color: @kbd-bg; 30 | border-radius: @border-radius-small; 31 | box-shadow: inset 0 -1px 0 rgba(0,0,0,.25); 32 | } 33 | 34 | // Blocks of code 35 | pre { 36 | display: block; 37 | padding: ((@line-height-computed - 1) / 2); 38 | margin: 0 0 (@line-height-computed / 2); 39 | font-size: (@font-size-base - 1); // 14px to 13px 40 | line-height: @line-height-base; 41 | word-break: break-all; 42 | word-wrap: break-word; 43 | color: @pre-color; 44 | background-color: @pre-bg; 45 | border: 1px solid @pre-border-color; 46 | border-radius: @border-radius-base; 47 | 48 | // Account for some code outputs that place code tags in pre tags 49 | code { 50 | padding: 0; 51 | font-size: inherit; 52 | color: inherit; 53 | white-space: pre-wrap; 54 | background-color: transparent; 55 | border-radius: 0; 56 | } 57 | } 58 | 59 | // Enable scrollable blocks of code 60 | .pre-scrollable { 61 | max-height: @pre-scrollable-max-height; 62 | overflow-y: scroll; 63 | } 64 | -------------------------------------------------------------------------------- /test/mocha/data/userTest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; /** * Module dependencies. */ var should = require('should'), mongoose = require('mongoose'), User = mongoose.model('user'); //Globals var user, user2; //The tests describe('', function() { describe('Model User:', function() { before(function(done) { user = new User({ name: 'Full name', email: 'test@test.com', username: 'user', password: 'password', provider: 'local' }); user2 = new User(user); done(); }); describe('Method Save', function() { it('should begin without the test user', function(done) { User.find({ email: 'test@test.com' }, function(err, users) { users.should.have.length(0); done(); }); }); it('should be able to save without problems', function(done) { user.save(done); }); it('should fail to save an existing user again', function(done) { user.save(); return user2.save(function(err) { should.exist(err); done(); }); }); it('should show an error when try to save without name', function(done) { user.name = ''; return user.save(function(err) { should.exist(err); done(); }); }); }); after(function(done) { user.remove(); done(); }); }); }); -------------------------------------------------------------------------------- /server/kits/logger.js: -------------------------------------------------------------------------------- 1 | /*global module,exports,require,console*/ 2 | "use strict"; 3 | var winston = require("winston"); 4 | 5 | module.exports = function (loggerConfig) { 6 | var logger = new (winston.Logger)({}), errorLogger = new (winston.Logger)({ 7 | transports: [ 8 | new (winston.transports.File)({ filename: loggerConfig.dirname + '/error.log', level: "warn" }) 9 | ] 10 | }); 11 | 12 | logger.handleExceptions(new winston.transports.File({ filename: loggerConfig.dirname + '/exceptions-error.log' })); 13 | errorLogger.handleExceptions(new winston.transports.File({ filename: loggerConfig.dirname + '/exceptions-error.log' })); 14 | if(loggerConfig.filename){ 15 | logger.add(winston.transports.File, { 16 | level : loggerConfig.level, 17 | filename: loggerConfig.filename, 18 | dirname : loggerConfig.dirname, 19 | maxsize : loggerConfig.maxsize 20 | }); 21 | }else{ 22 | logger.add(winston.transports.Console, {level: 'debug'}); 23 | errorLogger.add(winston.transports.Console, {level: 'debug'}); 24 | } 25 | return { 26 | log : function () { 27 | logger.log.apply(logger, arguments); 28 | }, 29 | info : function () { 30 | logger.info.apply(logger, arguments); 31 | }, 32 | debug: function () { 33 | logger.debug.apply(logger, arguments); 34 | }, 35 | warn : function () { 36 | errorLogger.warn.apply(logger, arguments); 37 | }, 38 | error: function () { 39 | errorLogger.error.apply(logger, arguments); 40 | } 41 | }; 42 | }; -------------------------------------------------------------------------------- /server/config/config.js: -------------------------------------------------------------------------------- 1 | var _ = require('lodash'); 2 | 3 | var config = { 4 | sessionKey : "xid", 5 | perPageCount: 20, 6 | title : "AngularJS Nice Things", 7 | siteScripts : [ 8 | "lib/jquery/1.11.0/jquery.js", 9 | "lib/bootstrap/3.1.1/js/bootstrap.js", 10 | "lib/bootstrap/notify/1.0.0/js/bootstrap-notify.js", 11 | "lib/angular/1.2.16/angular.js", 12 | "lib/w5cValidator/2.0.0/w5cValidator.js", 13 | "lib/angular-ui/ui-bootstrap/0.9.0/ui-bootstrap-tpls.js", 14 | "lib/highlight/8.0/highlight.pack.js", 15 | "lib/lodash/2.4.1/lodash.js", 16 | "lib/marked/0.3.2/marked.js", 17 | "lib/moment/2.6.0/moment.js", 18 | "js/main.js", 19 | "js/service/service.js", 20 | "js/filter/filter.js", 21 | "js/directive/directive.js", 22 | "js/controller/user.js", 23 | "js/controller/post.js", 24 | "js/controller/home.js", 25 | "js/status.js" 26 | ] 27 | }; 28 | 29 | initConfig(); 30 | 31 | module.exports = exports = config; 32 | 33 | function initConfig() { 34 | var env = process.env.NODE_ENV; 35 | if (!env) { 36 | env = 'development'; 37 | } 38 | switch (env.toLowerCase()) { 39 | case 'dev': 40 | case 'development': 41 | env = 'development'; 42 | break; 43 | case 'prod': 44 | case 'production': 45 | env = 'production'; 46 | break; 47 | case 'test': 48 | env = 'test'; 49 | break; 50 | default: 51 | break; 52 | } 53 | var envConfig = require("./" + env); 54 | config = _.merge(config, envConfig); 55 | config.env = env; 56 | }; -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/alerts.less: -------------------------------------------------------------------------------- 1 | // 2 | // Alerts 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base styles 7 | // ------------------------- 8 | 9 | .alert { 10 | padding: @alert-padding; 11 | margin-bottom: @line-height-computed; 12 | border: 1px solid transparent; 13 | border-radius: @alert-border-radius; 14 | 15 | // Headings for larger alerts 16 | h4 { 17 | margin-top: 0; 18 | // Specified for the h4 to prevent conflicts of changing @headings-color 19 | color: inherit; 20 | } 21 | // Provide class for links that match alerts 22 | .alert-link { 23 | font-weight: @alert-link-font-weight; 24 | } 25 | 26 | // Improve alignment and spacing of inner content 27 | > p, 28 | > ul { 29 | margin-bottom: 0; 30 | } 31 | > p + p { 32 | margin-top: 5px; 33 | } 34 | } 35 | 36 | // Dismissable alerts 37 | // 38 | // Expand the right padding and account for the close button's positioning. 39 | 40 | .alert-dismissable { 41 | padding-right: (@alert-padding + 20); 42 | 43 | // Adjust close link position 44 | .close { 45 | position: relative; 46 | top: -2px; 47 | right: -21px; 48 | color: inherit; 49 | } 50 | } 51 | 52 | // Alternate styles 53 | // 54 | // Generate contextual modifier classes for colorizing the alert. 55 | 56 | .alert-success { 57 | .alert-variant(@alert-success-bg; @alert-success-border; @alert-success-text); 58 | } 59 | .alert-info { 60 | .alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text); 61 | } 62 | .alert-warning { 63 | .alert-variant(@alert-warning-bg; @alert-warning-border; @alert-warning-text); 64 | } 65 | .alert-danger { 66 | .alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text); 67 | } 68 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/grid.less: -------------------------------------------------------------------------------- 1 | // 2 | // Grid system 3 | // -------------------------------------------------- 4 | 5 | 6 | // Container widths 7 | // 8 | // Set the container width, and override it for fixed navbars in media queries. 9 | 10 | .container { 11 | .container-fixed(); 12 | 13 | @media (min-width: @screen-sm-min) { 14 | width: @container-sm; 15 | } 16 | @media (min-width: @screen-md-min) { 17 | width: @container-md; 18 | } 19 | @media (min-width: @screen-lg-min) { 20 | width: @container-lg; 21 | } 22 | } 23 | 24 | 25 | // Fluid container 26 | // 27 | // Utilizes the mixin meant for fixed width containers, but without any defined 28 | // width for fluid, full width layouts. 29 | 30 | .container-fluid { 31 | .container-fixed(); 32 | } 33 | 34 | 35 | // Row 36 | // 37 | // Rows contain and clear the floats of your columns. 38 | 39 | .row { 40 | .make-row(); 41 | } 42 | 43 | 44 | // Columns 45 | // 46 | // Common styles for small and large grid columns 47 | 48 | .make-grid-columns(); 49 | 50 | 51 | // Extra small grid 52 | // 53 | // Columns, offsets, pushes, and pulls for extra small devices like 54 | // smartphones. 55 | 56 | .make-grid(xs); 57 | 58 | 59 | // Small grid 60 | // 61 | // Columns, offsets, pushes, and pulls for the small device range, from phones 62 | // to tablets. 63 | 64 | @media (min-width: @screen-sm-min) { 65 | .make-grid(sm); 66 | } 67 | 68 | 69 | // Medium grid 70 | // 71 | // Columns, offsets, pushes, and pulls for the desktop device range. 72 | 73 | @media (min-width: @screen-md-min) { 74 | .make-grid(md); 75 | } 76 | 77 | 78 | // Large grid 79 | // 80 | // Columns, offsets, pushes, and pulls for the large desktop device range. 81 | 82 | @media (min-width: @screen-lg-min) { 83 | .make-grid(lg); 84 | } 85 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/tomorrow.css: -------------------------------------------------------------------------------- 1 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 2 | 3 | /* Tomorrow Comment */ 4 | .hljs-comment, 5 | .hljs-title { 6 | color: #8e908c; 7 | } 8 | 9 | /* Tomorrow Red */ 10 | .hljs-variable, 11 | .hljs-attribute, 12 | .hljs-tag, 13 | .hljs-regexp, 14 | .ruby .hljs-constant, 15 | .xml .hljs-tag .hljs-title, 16 | .xml .hljs-pi, 17 | .xml .hljs-doctype, 18 | .html .hljs-doctype, 19 | .css .hljs-id, 20 | .css .hljs-class, 21 | .css .hljs-pseudo { 22 | color: #c82829; 23 | } 24 | 25 | /* Tomorrow Orange */ 26 | .hljs-number, 27 | .hljs-preprocessor, 28 | .hljs-pragma, 29 | .hljs-built_in, 30 | .hljs-literal, 31 | .hljs-params, 32 | .hljs-constant { 33 | color: #f5871f; 34 | } 35 | 36 | /* Tomorrow Yellow */ 37 | .ruby .hljs-class .hljs-title, 38 | .css .hljs-rules .hljs-attribute { 39 | color: #eab700; 40 | } 41 | 42 | /* Tomorrow Green */ 43 | .hljs-string, 44 | .hljs-value, 45 | .hljs-inheritance, 46 | .hljs-header, 47 | .ruby .hljs-symbol, 48 | .xml .hljs-cdata { 49 | color: #718c00; 50 | } 51 | 52 | /* Tomorrow Aqua */ 53 | .css .hljs-hexcolor { 54 | color: #3e999f; 55 | } 56 | 57 | /* Tomorrow Blue */ 58 | .hljs-function, 59 | .python .hljs-decorator, 60 | .python .hljs-title, 61 | .ruby .hljs-function .hljs-title, 62 | .ruby .hljs-title .hljs-keyword, 63 | .perl .hljs-sub, 64 | .javascript .hljs-title, 65 | .coffeescript .hljs-title { 66 | color: #4271ae; 67 | } 68 | 69 | /* Tomorrow Purple */ 70 | .hljs-keyword, 71 | .javascript .hljs-function { 72 | color: #8959a8; 73 | } 74 | 75 | .hljs { 76 | display: block; 77 | background: white; 78 | color: #4d4d4c; 79 | padding: 0.5em; 80 | } 81 | 82 | .coffeescript .javascript, 83 | .javascript .xml, 84 | .tex .hljs-formula, 85 | .xml .javascript, 86 | .xml .vbscript, 87 | .xml .css, 88 | .xml .hljs-cdata { 89 | opacity: 0.5; 90 | } 91 | -------------------------------------------------------------------------------- /server/kits/constant.js: -------------------------------------------------------------------------------- 1 | /*global require,module*/ var constant = { reserved_names: ['worktile', 'home', 'index', 'console', 'beta', 'admin', 'administrator', 'wow', 'pro', 'service', 'notify', 'user', 'test', 'mail', 'system', 'hello', 'gold', 'vip', 'setting', 'business', 'enterprise', 'free', 'nonprofit', 'verify', 'developer', 'api', 'app', 'appcenter', 'center', 'iphone', 'android', 'ipad', 'window', 'wp8', 'mac', 'tool', 'market', 'travel', 'lefestyle', 'collaboration', 'project', 'team', 'post', 'page', 'task', 'file', 'graph', 'event', 'calendar', 'empty', 'group', 'blog', 'forum', 'thread', 'comment', 'message', 'account', 'coupon', 'payment', 'member', 'feed', 'pay', 'billing', 'entry', 'category', 'activity', 'subscription', 'archive', 'discussion', 'press', 'job', 'about', 'contact', 'feedback', 'plan', 'security', 'tour', 'customer', 'guide', 'privacy', 'terms', 'shield', 'level', 'medal', 'trophy', 'inbox', 'add', 'edit', 'delete', 'modify', 'update', 'create', 'trash', 'watch', 'assign', 'weibo', 'twitter', 'facebook', 'video', 'google', 'baidu', 'node', 'angular', 'nodejs', 'angularjs', 'signin', 'signup', 'login', 'logout', 'post', 'article', 'category', 'windows', 'mac', 'xcode'], post : { status : { ok : 1, draft: 0 }, published: { yes: 1, no : 0 }, category : { "默认" : 0, "AngularJS" : 1, "NodeJS" : 2, "Javascript": 3, "技术架构" : 4 } }, user : { status: { ok : 1, inactive: 2 }, role : { member : 1, admin : 2, supper_admin: 3 } }, is_deleted : { yes: 1, no : 0 } }; exports = module.exports = constant; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## NgNice 2 | 站点:http://ngnice.com/ 3 | 4 | NgNice 站点是由一批 Angular.js 爱好者发起的,致力于打造一个 Angular.js 的学习和经验分享平台。 5 | 目前 NgNice 平台不对外开放注册功能,站内分享内容主要由 NgNice 官方团队进行维护,如果你也是 Angular.js 的爱好者, 6 | 并且乐于分享你的经验给其他人,那就加入我们吧! 官方团队成员参见:[点击查看团队成员](https://worktile.com/teams/195a7878764eb2)。 7 | NgNice站点目前提供的功能如下: 8 | 9 | 1. 简单的内容发布系统,主要分享一些 Angular.js 使用的经验和精品文章; 10 | 1. Angular.js开发指南中文翻译的展示,github源码地址:https://github.com/jingyanjiaoliu/angular-guide-zh 11 | 1. Angular.js showcase项目的展示,目前处于开发阶段,github源码地址:https://github.com/angular-cn/ng-showcase 12 | 13 | 14 | 详细说明参见:http://ngnice.com/about 15 | 16 | ## 整体架构技术说明 17 | 18 | 服务端技术:Node.js >=0.10.x + Express >=4.x + Mongodb >=2.x 19 | 20 | 前端技术:Angular.js >= 1.2.x + Bootstrap >= 3.x 21 | 22 | ## 本地搭建步骤 23 | 24 | 1. 配置开发环境的配置文件 server/config/development.js (包括 mongodb 数据库链接字符串和 cookie_secret); 25 | 1. 运行命令 `npm install` 安装 NodeJS Modules; 26 | 1. 运行命令 `node app` 或者 `npm run start-dev` 启动服务; 27 | 1. 生产环境使用 `NODE_ENV=production node app` 或者 `npm start`(仅限linux环境下)。 28 | 1. 生产环境使用的配置文件为 server/config/production.js 和 production.confidential.js(数据库和cookieSecret铭感信息是不在代码库中,第一次部署需要新建此文件) 29 | 30 | ## 大致目录结构 31 | 32 | ``` 33 | . 34 | |-- bin 35 | |-- server 36 | | |-- api 37 | | |-- config 38 | | |-- controller 39 | | |-- data 40 | | | `-- model 41 | | |-- lib 42 | | |-- mailer 43 | | `-- validation 44 | |-- test 45 | | |-- karma 46 | | `-- mocha 47 | | `-- data 48 | `-- web 49 | |-- static 50 | | |-- css 51 | | |-- fonts 52 | | |-- img 53 | | |-- js 54 | | | |-- controller 55 | | | |-- directive 56 | | | |-- filter 57 | | | |-- service 58 | | | `-- tpl 59 | | | |-- common 60 | | | `-- directive 61 | | |-- lib 62 | `-- view 63 | |-- footer 64 | |-- header 65 | |-- home 66 | |-- post 67 | |-- shared 68 | `-- user 69 | 70 | ``` 71 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/paraiso.dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | Paraíso (dark) 3 | Created by Jan T. Sott (http://github.com/idleberg) 4 | Inspired by the art of Rubens LP (http://www.rubenslp.com.br) 5 | */ 6 | 7 | /* Paraíso Comment */ 8 | .hljs-comment, 9 | .hljs-title { 10 | color: #8d8687; 11 | } 12 | 13 | /* Paraíso Red */ 14 | .hljs-variable, 15 | .hljs-attribute, 16 | .hljs-tag, 17 | .hljs-regexp, 18 | .ruby .hljs-constant, 19 | .xml .hljs-tag .hljs-title, 20 | .xml .hljs-pi, 21 | .xml .hljs-doctype, 22 | .html .hljs-doctype, 23 | .css .hljs-id, 24 | .css .hljs-class, 25 | .css .hljs-pseudo { 26 | color: #ef6155; 27 | } 28 | 29 | /* Paraíso Orange */ 30 | .hljs-number, 31 | .hljs-preprocessor, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #f99b15; 37 | } 38 | 39 | /* Paraíso Yellow */ 40 | .ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #fec418; 43 | } 44 | 45 | /* Paraíso Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #48b685; 53 | } 54 | 55 | /* Paraíso Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #5bc4bf; 58 | } 59 | 60 | /* Paraíso Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #06b6ef; 70 | } 71 | 72 | /* Paraíso Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #815ba4; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #2f1e2e; 81 | color: #a39e9b; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/paraiso.light.css: -------------------------------------------------------------------------------- 1 | /* 2 | Paraíso (light) 3 | Created by Jan T. Sott (http://github.com/idleberg) 4 | Inspired by the art of Rubens LP (http://www.rubenslp.com.br) 5 | */ 6 | 7 | /* Paraíso Comment */ 8 | .hljs-comment, 9 | .hljs-title { 10 | color: #776e71; 11 | } 12 | 13 | /* Paraíso Red */ 14 | .hljs-variable, 15 | .hljs-attribute, 16 | .hljs-tag, 17 | .hljs-regexp, 18 | .ruby .hljs-constant, 19 | .xml .hljs-tag .hljs-title, 20 | .xml .hljs-pi, 21 | .xml .hljs-doctype, 22 | .html .hljs-doctype, 23 | .css .hljs-id, 24 | .css .hljs-class, 25 | .css .hljs-pseudo { 26 | color: #ef6155; 27 | } 28 | 29 | /* Paraíso Orange */ 30 | .hljs-number, 31 | .hljs-preprocessor, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #f99b15; 37 | } 38 | 39 | /* Paraíso Yellow */ 40 | .ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #fec418; 43 | } 44 | 45 | /* Paraíso Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #48b685; 53 | } 54 | 55 | /* Paraíso Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #5bc4bf; 58 | } 59 | 60 | /* Paraíso Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #06b6ef; 70 | } 71 | 72 | /* Paraíso Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #815ba4; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #e7e9db; 81 | color: #4f424c; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/notify/1.0.0/less/styles/alert-bangtidy.less: -------------------------------------------------------------------------------- 1 | /** 2 | * bangTidy2 Style - Ported from Growl Style 3 | * Ported and Cleaned By Nijikokun @nijikokun 4 | * Less By Vitaly @Laboratory 5 | * Original Author Daryl Ginn 6 | * Based On http://dribbble.com/shots/527056-Growl-Theme-2 7 | * 8 | * To use, for style use: bangTidy 9 | * 10 | */ 11 | 12 | @glossLight: rgba(0, 0, 0, 0.80); 13 | @glossDark: rgba(0, 0, 0, 0.88); 14 | @box_shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.1); 15 | @text_shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); 16 | @border_radius: 4px; 17 | 18 | .alert-bangTidy { 19 | box-sizing: border-box; 20 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 21 | background: @glossLight; 22 | background: -moz-linear-gradient(top, @glossLight 0%, @glossDark 100%); 23 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @glossLight), color-stop(100%, @glossDark)); 24 | background: -webkit-linear-gradient(top, @glossLight 0%, @glossDark 100%); 25 | background: -o-linear-gradient(top, @glossLight 0%, @glossDark 100%); 26 | background: -ms-linear-gradient(top, @glossLight 0%, @glossDark 100%); 27 | background: linear-gradient(top, @glossLight 0%, @glossDark 100%); 28 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '@{glossLight}', endColorstr = '@{glossDark}', GradientType = 0); 29 | border: 1px solid #000; 30 | -webkit-box-shadow: @box_shadow; 31 | -moz-box-shadow: @box_shadow; 32 | -o-box-shadow: @box_shadow; 33 | box-shadow: @box_shadow; 34 | -webkit-border-radius: @border_radius; 35 | -moz-border-radius: @border_radius; 36 | -o-border-radius: @border_radius; 37 | border-radius: @border_radius; 38 | overflow: hidden; 39 | color: white; 40 | -webkit-text-shadow: @text_shadow; 41 | -moz-text-shadow: @text_shadow; 42 | -o-text-shadow: @text_shadow; 43 | text-shadow: @text_shadow; 44 | -webkit-font-smoothing: antialiased; 45 | } -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/progress-bars.less: -------------------------------------------------------------------------------- 1 | // 2 | // Progress bars 3 | // -------------------------------------------------- 4 | 5 | 6 | // Bar animations 7 | // ------------------------- 8 | 9 | // WebKit 10 | @-webkit-keyframes progress-bar-stripes { 11 | from { background-position: 40px 0; } 12 | to { background-position: 0 0; } 13 | } 14 | 15 | // Spec and IE10+ 16 | @keyframes progress-bar-stripes { 17 | from { background-position: 40px 0; } 18 | to { background-position: 0 0; } 19 | } 20 | 21 | 22 | 23 | // Bar itself 24 | // ------------------------- 25 | 26 | // Outer container 27 | .progress { 28 | overflow: hidden; 29 | height: @line-height-computed; 30 | margin-bottom: @line-height-computed; 31 | background-color: @progress-bg; 32 | border-radius: @border-radius-base; 33 | .box-shadow(inset 0 1px 2px rgba(0,0,0,.1)); 34 | } 35 | 36 | // Bar of progress 37 | .progress-bar { 38 | float: left; 39 | width: 0%; 40 | height: 100%; 41 | font-size: @font-size-small; 42 | line-height: @line-height-computed; 43 | color: @progress-bar-color; 44 | text-align: center; 45 | background-color: @progress-bar-bg; 46 | .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15)); 47 | .transition(width .6s ease); 48 | } 49 | 50 | // Striped bars 51 | .progress-striped .progress-bar { 52 | #gradient > .striped(); 53 | background-size: 40px 40px; 54 | } 55 | 56 | // Call animation for the active one 57 | .progress.active .progress-bar { 58 | .animation(progress-bar-stripes 2s linear infinite); 59 | } 60 | 61 | 62 | 63 | // Variations 64 | // ------------------------- 65 | 66 | .progress-bar-success { 67 | .progress-bar-variant(@progress-bar-success-bg); 68 | } 69 | 70 | .progress-bar-info { 71 | .progress-bar-variant(@progress-bar-info-bg); 72 | } 73 | 74 | .progress-bar-warning { 75 | .progress-bar-variant(@progress-bar-warning-bg); 76 | } 77 | 78 | .progress-bar-danger { 79 | .progress-bar-variant(@progress-bar-danger-bg); 80 | } 81 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/vs.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Visual Studio-like style based on original C# coloring by Jason Diamond 4 | 5 | */ 6 | .hljs { 7 | display: block; padding: 0.5em; 8 | background: white; color: black; 9 | } 10 | 11 | .hljs-comment, 12 | .hljs-annotation, 13 | .hljs-template_comment, 14 | .diff .hljs-header, 15 | .hljs-chunk, 16 | .apache .hljs-cbracket { 17 | color: #008000; 18 | } 19 | 20 | .hljs-keyword, 21 | .hljs-id, 22 | .hljs-built_in, 23 | .smalltalk .hljs-class, 24 | .hljs-winutils, 25 | .bash .hljs-variable, 26 | .tex .hljs-command, 27 | .hljs-request, 28 | .hljs-status, 29 | .nginx .hljs-title, 30 | .xml .hljs-tag, 31 | .xml .hljs-tag .hljs-value { 32 | color: #00f; 33 | } 34 | 35 | .hljs-string, 36 | .hljs-title, 37 | .hljs-parent, 38 | .hljs-tag .hljs-value, 39 | .hljs-rules .hljs-value, 40 | .hljs-rules .hljs-value .hljs-number, 41 | .ruby .hljs-symbol, 42 | .ruby .hljs-symbol .hljs-string, 43 | .hljs-aggregate, 44 | .hljs-template_tag, 45 | .django .hljs-variable, 46 | .hljs-addition, 47 | .hljs-flow, 48 | .hljs-stream, 49 | .apache .hljs-tag, 50 | .hljs-date, 51 | .tex .hljs-formula, 52 | .coffeescript .hljs-attribute { 53 | color: #a31515; 54 | } 55 | 56 | .ruby .hljs-string, 57 | .hljs-decorator, 58 | .hljs-filter .hljs-argument, 59 | .hljs-localvars, 60 | .hljs-array, 61 | .hljs-attr_selector, 62 | .hljs-pseudo, 63 | .hljs-pi, 64 | .hljs-doctype, 65 | .hljs-deletion, 66 | .hljs-envvar, 67 | .hljs-shebang, 68 | .hljs-preprocessor, 69 | .hljs-pragma, 70 | .userType, 71 | .apache .hljs-sqbracket, 72 | .nginx .hljs-built_in, 73 | .tex .hljs-special, 74 | .hljs-prompt { 75 | color: #2b91af; 76 | } 77 | 78 | .hljs-phpdoc, 79 | .hljs-javadoc, 80 | .hljs-xmlDocTag { 81 | color: #808080; 82 | } 83 | 84 | .vhdl .hljs-typename { font-weight: bold; } 85 | .vhdl .hljs-string { color: #666666; } 86 | .vhdl .hljs-literal { color: #a31515; } 87 | .vhdl .hljs-attribute { color: #00B0E8; } 88 | 89 | .xml .hljs-attribute { color: #f00; } 90 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/tomorrow-night-bright.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Night Bright Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 4 | 5 | /* Tomorrow Comment */ 6 | .hljs-comment, 7 | .hljs-title { 8 | color: #969896; 9 | } 10 | 11 | /* Tomorrow Red */ 12 | .hljs-variable, 13 | .hljs-attribute, 14 | .hljs-tag, 15 | .hljs-regexp, 16 | .ruby .hljs-constant, 17 | .xml .hljs-tag .hljs-title, 18 | .xml .hljs-pi, 19 | .xml .hljs-doctype, 20 | .html .hljs-doctype, 21 | .css .hljs-id, 22 | .css .hljs-class, 23 | .css .hljs-pseudo { 24 | color: #d54e53; 25 | } 26 | 27 | /* Tomorrow Orange */ 28 | .hljs-number, 29 | .hljs-preprocessor, 30 | .hljs-pragma, 31 | .hljs-built_in, 32 | .hljs-literal, 33 | .hljs-params, 34 | .hljs-constant { 35 | color: #e78c45; 36 | } 37 | 38 | /* Tomorrow Yellow */ 39 | .ruby .hljs-class .hljs-title, 40 | .css .hljs-rules .hljs-attribute { 41 | color: #e7c547; 42 | } 43 | 44 | /* Tomorrow Green */ 45 | .hljs-string, 46 | .hljs-value, 47 | .hljs-inheritance, 48 | .hljs-header, 49 | .ruby .hljs-symbol, 50 | .xml .hljs-cdata { 51 | color: #b9ca4a; 52 | } 53 | 54 | /* Tomorrow Aqua */ 55 | .css .hljs-hexcolor { 56 | color: #70c0b1; 57 | } 58 | 59 | /* Tomorrow Blue */ 60 | .hljs-function, 61 | .python .hljs-decorator, 62 | .python .hljs-title, 63 | .ruby .hljs-function .hljs-title, 64 | .ruby .hljs-title .hljs-keyword, 65 | .perl .hljs-sub, 66 | .javascript .hljs-title, 67 | .coffeescript .hljs-title { 68 | color: #7aa6da; 69 | } 70 | 71 | /* Tomorrow Purple */ 72 | .hljs-keyword, 73 | .javascript .hljs-function { 74 | color: #c397d8; 75 | } 76 | 77 | .hljs { 78 | display: block; 79 | background: black; 80 | color: #eaeaea; 81 | padding: 0.5em; 82 | } 83 | 84 | .coffeescript .javascript, 85 | .javascript .xml, 86 | .tex .hljs-formula, 87 | .xml .javascript, 88 | .xml .vbscript, 89 | .xml .css, 90 | .xml .hljs-cdata { 91 | opacity: 0.5; 92 | } 93 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/tomorrow-night-eighties.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Night Eighties Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 4 | 5 | /* Tomorrow Comment */ 6 | .hljs-comment, 7 | .hljs-title { 8 | color: #999999; 9 | } 10 | 11 | /* Tomorrow Red */ 12 | .hljs-variable, 13 | .hljs-attribute, 14 | .hljs-tag, 15 | .hljs-regexp, 16 | .ruby .hljs-constant, 17 | .xml .hljs-tag .hljs-title, 18 | .xml .hljs-pi, 19 | .xml .hljs-doctype, 20 | .html .hljs-doctype, 21 | .css .hljs-id, 22 | .css .hljs-class, 23 | .css .hljs-pseudo { 24 | color: #f2777a; 25 | } 26 | 27 | /* Tomorrow Orange */ 28 | .hljs-number, 29 | .hljs-preprocessor, 30 | .hljs-pragma, 31 | .hljs-built_in, 32 | .hljs-literal, 33 | .hljs-params, 34 | .hljs-constant { 35 | color: #f99157; 36 | } 37 | 38 | /* Tomorrow Yellow */ 39 | .ruby .hljs-class .hljs-title, 40 | .css .hljs-rules .hljs-attribute { 41 | color: #ffcc66; 42 | } 43 | 44 | /* Tomorrow Green */ 45 | .hljs-string, 46 | .hljs-value, 47 | .hljs-inheritance, 48 | .hljs-header, 49 | .ruby .hljs-symbol, 50 | .xml .hljs-cdata { 51 | color: #99cc99; 52 | } 53 | 54 | /* Tomorrow Aqua */ 55 | .css .hljs-hexcolor { 56 | color: #66cccc; 57 | } 58 | 59 | /* Tomorrow Blue */ 60 | .hljs-function, 61 | .python .hljs-decorator, 62 | .python .hljs-title, 63 | .ruby .hljs-function .hljs-title, 64 | .ruby .hljs-title .hljs-keyword, 65 | .perl .hljs-sub, 66 | .javascript .hljs-title, 67 | .coffeescript .hljs-title { 68 | color: #6699cc; 69 | } 70 | 71 | /* Tomorrow Purple */ 72 | .hljs-keyword, 73 | .javascript .hljs-function { 74 | color: #cc99cc; 75 | } 76 | 77 | .hljs { 78 | display: block; 79 | background: #2d2d2d; 80 | color: #cccccc; 81 | padding: 0.5em; 82 | } 83 | 84 | .coffeescript .javascript, 85 | .javascript .xml, 86 | .tex .hljs-formula, 87 | .xml .javascript, 88 | .xml .vbscript, 89 | .xml .css, 90 | .xml .hljs-cdata { 91 | opacity: 0.5; 92 | } 93 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/tomorrow-night.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Night Theme */ 2 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 3 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 4 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 5 | 6 | /* Tomorrow Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #969896; 10 | } 11 | 12 | /* Tomorrow Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #cc6666; 26 | } 27 | 28 | /* Tomorrow Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #de935f; 37 | } 38 | 39 | /* Tomorrow Yellow */ 40 | .ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #f0c674; 43 | } 44 | 45 | /* Tomorrow Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #b5bd68; 53 | } 54 | 55 | /* Tomorrow Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #8abeb7; 58 | } 59 | 60 | /* Tomorrow Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #81a2be; 70 | } 71 | 72 | /* Tomorrow Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #b294bb; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #1d1f21; 81 | color: #c5c8c6; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/tomorrow-night-blue.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Night Blue Theme */ 2 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 3 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 4 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ 5 | 6 | /* Tomorrow Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #7285b7; 10 | } 11 | 12 | /* Tomorrow Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #ff9da4; 26 | } 27 | 28 | /* Tomorrow Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #ffc58f; 37 | } 38 | 39 | /* Tomorrow Yellow */ 40 | .ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #ffeead; 43 | } 44 | 45 | /* Tomorrow Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #d1f1a9; 53 | } 54 | 55 | /* Tomorrow Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #99ffff; 58 | } 59 | 60 | /* Tomorrow Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #bbdaff; 70 | } 71 | 72 | /* Tomorrow Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #ebbbff; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #002451; 81 | color: white; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/notify/1.0.0/less/styles/alert-notification-animations.css: -------------------------------------------------------------------------------- 1 | /* ## Notification Keyframe Animations 2 | * 3 | * ## Usage 4 | * 5 | * ```css 6 | * -webkit-animation: notification .75s linear; 7 | * -moz-animation: notification .75s linear; 8 | * -ms-animation: notification .75s linear; 9 | * -o-animation: notification .75s linear; 10 | * animation: notification .75s linear; 11 | * ``` 12 | */ 13 | 14 | @-webkit-keyframes notification { 15 | 0% { -webkit-transform: rotateY(-90deg); opacity: 0; } 16 | 70% { -webkit-transform: rotateY(20deg); opacity: .8; } 17 | 90% { -webkit-transform: rotateY(-10deg); opacity: 1; } 18 | 100% { -webkit-transform: rotateY(-0deg); opacity: 1; } 19 | } 20 | 21 | @-moz-keyframes notification { 22 | 0% { -moz-transform: rotateY(-90deg); opacity: 0; } 23 | 70% { -moz-transform: rotateY(20deg); opacity: .8; } 24 | 90% { -moz-transform: rotateY(-10deg); opacity: 1; } 25 | 100% { -moz-transform: rotateY(-0deg); opacity: 1; } 26 | } 27 | 28 | @-ms-keyframes notification { 29 | 0% { -ms-transform: rotateY(-90deg); opacity: 0; } 30 | 70% { -ms-transform: rotateY(20deg); opacity: .8; } 31 | 90% { -ms-transform: rotateY(-10deg); opacity: 1; } 32 | 100% { -ms-transform: rotateY(-0deg); opacity: 1; } 33 | } 34 | 35 | @-o-keyframes notification { 36 | 0% { -o-transform: rotateY(-90deg); opacity: 0; } 37 | 70% { -o-transform: rotateY(20deg); opacity: .8; } 38 | 90% { -o-transform: rotateY(-10deg); opacity: 1; } 39 | 100% { -o-transform: rotateY(-0deg); opacity: 1; } 40 | } 41 | 42 | keyframes notification { 43 | 0% { transform: rotateY(-90deg); opacity: 0; } 44 | 70% { transform: rotateY(20deg); opacity: .8; } 45 | 90% { transform: rotateY(-10deg); opacity: 1; } 46 | 100% { transform: rotateY(-0deg); opacity: 1; } 47 | } 48 | 49 | .notifications > div { 50 | -webkit-animation: notification .75s linear; 51 | -moz-animation: notification .75s linear; 52 | -ms-animation: notification .75s linear; 53 | -o-animation: notification .75s linear; 54 | animation: notification .75s linear; 55 | } -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/ir_black.css: -------------------------------------------------------------------------------- 1 | /* 2 | IR_Black style (c) Vasily Mikhailitchenko 3 | */ 4 | 5 | .hljs { 6 | display: block; padding: 0.5em; 7 | background: #000; color: #f8f8f8; 8 | } 9 | 10 | .hljs-shebang, 11 | .hljs-comment, 12 | .hljs-template_comment, 13 | .hljs-javadoc { 14 | color: #7c7c7c; 15 | } 16 | 17 | .hljs-keyword, 18 | .hljs-tag, 19 | .tex .hljs-command, 20 | .hljs-request, 21 | .hljs-status, 22 | .clojure .hljs-attribute { 23 | color: #96CBFE; 24 | } 25 | 26 | .hljs-sub .hljs-keyword, 27 | .method, 28 | .hljs-list .hljs-title, 29 | .nginx .hljs-title { 30 | color: #FFFFB6; 31 | } 32 | 33 | .hljs-string, 34 | .hljs-tag .hljs-value, 35 | .hljs-cdata, 36 | .hljs-filter .hljs-argument, 37 | .hljs-attr_selector, 38 | .apache .hljs-cbracket, 39 | .hljs-date, 40 | .coffeescript .hljs-attribute { 41 | color: #A8FF60; 42 | } 43 | 44 | .hljs-subst { 45 | color: #DAEFA3; 46 | } 47 | 48 | .hljs-regexp { 49 | color: #E9C062; 50 | } 51 | 52 | .hljs-title, 53 | .hljs-sub .hljs-identifier, 54 | .hljs-pi, 55 | .hljs-decorator, 56 | .tex .hljs-special, 57 | .haskell .hljs-type, 58 | .hljs-constant, 59 | .smalltalk .hljs-class, 60 | .hljs-javadoctag, 61 | .hljs-yardoctag, 62 | .hljs-phpdoc, 63 | .nginx .hljs-built_in { 64 | color: #FFFFB6; 65 | } 66 | 67 | .hljs-symbol, 68 | .ruby .hljs-symbol .hljs-string, 69 | .hljs-number, 70 | .hljs-variable, 71 | .vbscript, 72 | .hljs-literal { 73 | color: #C6C5FE; 74 | } 75 | 76 | .css .hljs-tag { 77 | color: #96CBFE; 78 | } 79 | 80 | .css .hljs-rules .hljs-property, 81 | .css .hljs-id { 82 | color: #FFFFB6; 83 | } 84 | 85 | .css .hljs-class { 86 | color: #FFF; 87 | } 88 | 89 | .hljs-hexcolor { 90 | color: #C6C5FE; 91 | } 92 | 93 | .hljs-number { 94 | color:#FF73FD; 95 | } 96 | 97 | .coffeescript .javascript, 98 | .javascript .xml, 99 | .tex .hljs-formula, 100 | .xml .javascript, 101 | .xml .vbscript, 102 | .xml .css, 103 | .xml .hljs-cdata { 104 | opacity: 0.7; 105 | } 106 | -------------------------------------------------------------------------------- /server/data/model/postSchema.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), Schema = mongoose.Schema, _ = require("lodash"); /** * Getters */ var getTags = function (tags) { return tags.join(',') }; /** * Setters */ var setTags = function (tags) { return tags.split(',') }; var Comment = new Schema({ cid : { type: String}, uid : { type: String }, message : {type: String}, format : {type: Number, default: 1}, // 1: text; 2: html type : { type: Number, default: 1},// 1:text;2:emotion;3:audio status : { type: Number, default: 0},//0.待审核 1: OK create_date: { type: Number, default: Date.now} }, { _id: false }); var Post = new Schema({ id : { type: String, index: true }, title : {type: String }, summary : { type: String, default: ''}, content : {type: String }, //status : { type: Number, default: 1}, // 0: 草稿,1: OK published : { type: Number, default: 1},//1 true 0 false is_deleted : { type: Number, default: 0}, // 0: false; 1: true; comment_count : { type: Number, default: 0}, comments : [ Comment], tags : { type: [], get: getTags, set: setTags}, category : { type: Number, default: 0 }, last_reply_uid : { type: String, default: '' }, last_reply_date: { type: Number, default: Date.now }, author : { type: String, index: true}, create_date : { type: Number, default: Date.now, index: true}, publish_date : { type: Number, default: Date.now}, update_uid : { type: String }, update_date : { type: Number, default: Date.now}, hits : { type: Number, default: 0} }); Post.methods = { makeSimple: function () { return _.pick(this, 'id', 'title', 'summary', 'category', 'published', 'tags', 'author', 'create_date', 'publish_date', 'hits'); }, makeFull : function () { return _.pick(this, 'id', 'title', 'summary', 'category', 'content', 'published', 'tags', 'author', 'create_date', 'publish_date', 'hits', 'comments'); } }; Post.statics = { }; module.exports = Post; -------------------------------------------------------------------------------- /web/static/lib/bootstrap/notify/1.0.0/less/styles/alert-bangtidy.css: -------------------------------------------------------------------------------- 1 | /** 2 | * bangTidy2 Style - Ported from Growl Style 3 | * Ported and Cleaned By Nijikokun @nijikokun 4 | * Less By Vitaly @Laboratory 5 | * Original Author Daryl Ginn 6 | * Based On http://dribbble.com/shots/527056-Growl-Theme-2 7 | * 8 | * To use, for style use: bangTidy 9 | * 10 | */ 11 | .alert-bangTidy { 12 | box-sizing: border-box; 13 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 14 | background: rgba(0, 0, 0, 0.8); 15 | background: -moz-linear-gradient(top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.88) 100%); 16 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0.8)), color-stop(100%, rgba(0, 0, 0, 0.88))); 17 | background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.88) 100%); 18 | background: -o-linear-gradient(top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.88) 100%); 19 | background: -ms-linear-gradient(top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.88) 100%); 20 | background: linear-gradient(top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.88) 100%); 21 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='rgba(0, 0, 0, 0.8)', endColorstr='rgba(0, 0, 0, 0.88)', GradientType=0); 22 | border: 1px solid #000; 23 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.1); 24 | -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.1); 25 | -o-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.1); 26 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.1); 27 | -webkit-border-radius: 4px; 28 | -moz-border-radius: 4px; 29 | -o-border-radius: 4px; 30 | border-radius: 4px; 31 | overflow: hidden; 32 | color: white; 33 | -webkit-text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); 34 | -moz-text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); 35 | -o-text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); 36 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); 37 | -webkit-font-smoothing: antialiased; 38 | } 39 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-dune.dark.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Dune Dark - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Dune Dark Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #999580; 10 | } 11 | 12 | /* Atelier Dune Dark Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #d73737; 26 | } 27 | 28 | /* Atelier Dune Dark Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #b65611; 37 | } 38 | 39 | /* Atelier Dune Dark Yellow */ 40 | .ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #cfb017; 43 | } 44 | 45 | /* Atelier Dune Dark Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #60ac39; 53 | } 54 | 55 | /* Atelier Dune Dark Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #1fad83; 58 | } 59 | 60 | /* Atelier Dune Dark Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #6684e1; 70 | } 71 | 72 | /* Atelier Dune Dark Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #b854d4; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #292824; 81 | color: #a6a28c; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-dune.light.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Dune Light - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Dune Light Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #7d7a68; 10 | } 11 | 12 | /* Atelier Dune Light Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #d73737; 26 | } 27 | 28 | /* Atelier Dune Light Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #b65611; 37 | } 38 | 39 | /* Atelier Dune Light Yellow */ 40 | .hljs-ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #cfb017; 43 | } 44 | 45 | /* Atelier Dune Light Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #60ac39; 53 | } 54 | 55 | /* Atelier Dune Light Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #1fad83; 58 | } 59 | 60 | /* Atelier Dune Light Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #6684e1; 70 | } 71 | 72 | /* Atelier Dune Light Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #b854d4; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #fefbec; 81 | color: #6e6b5e; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-heath.dark.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Heath Dark - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Heath Dark Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #9e8f9e; 10 | } 11 | 12 | /* Atelier Heath Dark Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #ca402b; 26 | } 27 | 28 | /* Atelier Heath Dark Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #a65926; 37 | } 38 | 39 | /* Atelier Heath Dark Yellow */ 40 | .hljs-ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #bb8a35; 43 | } 44 | 45 | /* Atelier Heath Dark Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #379a37; 53 | } 54 | 55 | /* Atelier Heath Dark Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #159393; 58 | } 59 | 60 | /* Atelier Heath Dark Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #516aec; 70 | } 71 | 72 | /* Atelier Heath Dark Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #7b59c0; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #292329; 81 | color: #ab9bab; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/print.less: -------------------------------------------------------------------------------- 1 | // 2 | // Basic print styles 3 | // -------------------------------------------------- 4 | // Source: https://github.com/h5bp/html5-boilerplate/blob/master/css/main.css 5 | 6 | @media print { 7 | 8 | * { 9 | text-shadow: none !important; 10 | color: #000 !important; // Black prints faster: h5bp.com/s 11 | background: transparent !important; 12 | box-shadow: none !important; 13 | } 14 | 15 | a, 16 | a:visited { 17 | text-decoration: underline; 18 | } 19 | 20 | a[href]:after { 21 | content: " (" attr(href) ")"; 22 | } 23 | 24 | abbr[title]:after { 25 | content: " (" attr(title) ")"; 26 | } 27 | 28 | // Don't show links for images, or javascript/internal links 29 | a[href^="javascript:"]:after, 30 | a[href^="#"]:after { 31 | content: ""; 32 | } 33 | 34 | pre, 35 | blockquote { 36 | border: 1px solid #999; 37 | page-break-inside: avoid; 38 | } 39 | 40 | thead { 41 | display: table-header-group; // h5bp.com/t 42 | } 43 | 44 | tr, 45 | img { 46 | page-break-inside: avoid; 47 | } 48 | 49 | img { 50 | max-width: 100% !important; 51 | } 52 | 53 | p, 54 | h2, 55 | h3 { 56 | orphans: 3; 57 | widows: 3; 58 | } 59 | 60 | h2, 61 | h3 { 62 | page-break-after: avoid; 63 | } 64 | 65 | // Chrome (OSX) fix for https://github.com/twbs/bootstrap/issues/11245 66 | // Once fixed, we can just straight up remove this. 67 | select { 68 | background: #fff !important; 69 | } 70 | 71 | // Bootstrap components 72 | .navbar { 73 | display: none; 74 | } 75 | .table { 76 | td, 77 | th { 78 | background-color: #fff !important; 79 | } 80 | } 81 | .btn, 82 | .dropup > .btn { 83 | > .caret { 84 | border-top-color: #000 !important; 85 | } 86 | } 87 | .label { 88 | border: 1px solid #000; 89 | } 90 | 91 | .table { 92 | border-collapse: collapse !important; 93 | } 94 | .table-bordered { 95 | th, 96 | td { 97 | border: 1px solid #ddd !important; 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-heath.light.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Heath Light - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Heath Light Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #776977; 10 | } 11 | 12 | /* Atelier Heath Light Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #ca402b; 26 | } 27 | 28 | /* Atelier Heath Light Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #a65926; 37 | } 38 | 39 | /* Atelier Heath Light Yellow */ 40 | .hljs-ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #bb8a35; 43 | } 44 | 45 | /* Atelier Heath Light Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #379a37; 53 | } 54 | 55 | /* Atelier Heath Light Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #159393; 58 | } 59 | 60 | /* Atelier Heath Light Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #516aec; 70 | } 71 | 72 | /* Atelier Heath Light Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #7b59c0; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #f7f3f7; 81 | color: #695d69; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-forest.dark.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Forest Dark - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Forest Dark Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #9c9491; 10 | } 11 | 12 | /* Atelier Forest Dark Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #f22c40; 26 | } 27 | 28 | /* Atelier Forest Dark Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #df5320; 37 | } 38 | 39 | /* Atelier Forest Dark Yellow */ 40 | .hljs-ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #d5911a; 43 | } 44 | 45 | /* Atelier Forest Dark Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #5ab738; 53 | } 54 | 55 | /* Atelier Forest Dark Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #00ad9c; 58 | } 59 | 60 | /* Atelier Forest Dark Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #407ee7; 70 | } 71 | 72 | /* Atelier Forest Dark Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #6666ea; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #2c2421; 81 | color: #a8a19f; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-forest.light.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Forest Light - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Forest Light Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #766e6b; 10 | } 11 | 12 | /* Atelier Forest Light Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #f22c40; 26 | } 27 | 28 | /* Atelier Forest Light Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #df5320; 37 | } 38 | 39 | /* Atelier Forest Light Yellow */ 40 | .hljs-ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #d5911a; 43 | } 44 | 45 | /* Atelier Forest Light Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #5ab738; 53 | } 54 | 55 | /* Atelier Forest Light Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #00ad9c; 58 | } 59 | 60 | /* Atelier Forest Light Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #407ee7; 70 | } 71 | 72 | /* Atelier Forest Light Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #6666ea; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #f1efee; 81 | color: #68615e; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-seaside.dark.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Seaside Dark - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Seaside Dark Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #809980; 10 | } 11 | 12 | /* Atelier Seaside Dark Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #e6193c; 26 | } 27 | 28 | /* Atelier Seaside Dark Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #87711d; 37 | } 38 | 39 | /* Atelier Seaside Dark Yellow */ 40 | .hljs-ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #c3c322; 43 | } 44 | 45 | /* Atelier Seaside Dark Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #29a329; 53 | } 54 | 55 | /* Atelier Seaside Dark Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #1999b3; 58 | } 59 | 60 | /* Atelier Seaside Dark Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #3d62f5; 70 | } 71 | 72 | /* Atelier Seaside Dark Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #ad2bee; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #242924; 81 | color: #8ca68c; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-lakeside.dark.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Lakeside Dark - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Lakeside Dark Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #7195a8; 10 | } 11 | 12 | /* Atelier Lakeside Dark Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #d22d72; 26 | } 27 | 28 | /* Atelier Lakeside Dark Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #935c25; 37 | } 38 | 39 | /* Atelier Lakeside Dark Yellow */ 40 | .hljs-ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #8a8a0f; 43 | } 44 | 45 | /* Atelier Lakeside Dark Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #568c3b; 53 | } 54 | 55 | /* Atelier Lakeside Dark Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #2d8f6f; 58 | } 59 | 60 | /* Atelier Lakeside Dark Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #257fad; 70 | } 71 | 72 | /* Atelier Lakeside Dark Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #5d5db1; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #1f292e; 81 | color: #7ea2b4; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-seaside.light.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Seaside Light - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Seaside Light Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #687d68; 10 | } 11 | 12 | /* Atelier Seaside Light Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #e6193c; 26 | } 27 | 28 | /* Atelier Seaside Light Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #87711d; 37 | } 38 | 39 | /* Atelier Seaside Light Yellow */ 40 | .hljs-ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #c3c322; 43 | } 44 | 45 | /* Atelier Seaside Light Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #29a329; 53 | } 54 | 55 | /* Atelier Seaside Light Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #1999b3; 58 | } 59 | 60 | /* Atelier Seaside Light Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #3d62f5; 70 | } 71 | 72 | /* Atelier Seaside Light Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #ad2bee; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #f0fff0; 81 | color: #5e6e5e; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/atelier-lakeside.light.css: -------------------------------------------------------------------------------- 1 | /* Base16 Atelier Lakeside Light - Theme */ 2 | /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/) */ 3 | /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ 4 | /* https://github.com/jmblog/color-themes-for-highlightjs */ 5 | 6 | /* Atelier Lakeside Light Comment */ 7 | .hljs-comment, 8 | .hljs-title { 9 | color: #5a7b8c; 10 | } 11 | 12 | /* Atelier Lakeside Light Red */ 13 | .hljs-variable, 14 | .hljs-attribute, 15 | .hljs-tag, 16 | .hljs-regexp, 17 | .ruby .hljs-constant, 18 | .xml .hljs-tag .hljs-title, 19 | .xml .hljs-pi, 20 | .xml .hljs-doctype, 21 | .html .hljs-doctype, 22 | .css .hljs-id, 23 | .css .hljs-class, 24 | .css .hljs-pseudo { 25 | color: #d22d72; 26 | } 27 | 28 | /* Atelier Lakeside Light Orange */ 29 | .hljs-number, 30 | .hljs-preprocessor, 31 | .hljs-pragma, 32 | .hljs-built_in, 33 | .hljs-literal, 34 | .hljs-params, 35 | .hljs-constant { 36 | color: #935c25; 37 | } 38 | 39 | /* Atelier Lakeside Light Yellow */ 40 | .hljs-ruby .hljs-class .hljs-title, 41 | .css .hljs-rules .hljs-attribute { 42 | color: #8a8a0f; 43 | } 44 | 45 | /* Atelier Lakeside Light Green */ 46 | .hljs-string, 47 | .hljs-value, 48 | .hljs-inheritance, 49 | .hljs-header, 50 | .ruby .hljs-symbol, 51 | .xml .hljs-cdata { 52 | color: #568c3b; 53 | } 54 | 55 | /* Atelier Lakeside Light Aqua */ 56 | .css .hljs-hexcolor { 57 | color: #2d8f6f; 58 | } 59 | 60 | /* Atelier Lakeside Light Blue */ 61 | .hljs-function, 62 | .python .hljs-decorator, 63 | .python .hljs-title, 64 | .ruby .hljs-function .hljs-title, 65 | .ruby .hljs-title .hljs-keyword, 66 | .perl .hljs-sub, 67 | .javascript .hljs-title, 68 | .coffeescript .hljs-title { 69 | color: #257fad; 70 | } 71 | 72 | /* Atelier Lakeside Light Purple */ 73 | .hljs-keyword, 74 | .javascript .hljs-function { 75 | color: #5d5db1; 76 | } 77 | 78 | .hljs { 79 | display: block; 80 | background: #ebf8ff; 81 | color: #516d7b; 82 | padding: 0.5em; 83 | } 84 | 85 | .coffeescript .javascript, 86 | .javascript .xml, 87 | .tex .hljs-formula, 88 | .xml .javascript, 89 | .xml .vbscript, 90 | .xml .css, 91 | .xml .hljs-cdata { 92 | opacity: 0.5; 93 | } 94 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/solarized_dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | padding: 0.5em; 10 | background: #002b36; 11 | color: #839496; 12 | } 13 | 14 | .hljs-comment, 15 | .hljs-template_comment, 16 | .diff .hljs-header, 17 | .hljs-doctype, 18 | .hljs-pi, 19 | .lisp .hljs-string, 20 | .hljs-javadoc { 21 | color: #586e75; 22 | } 23 | 24 | /* Solarized Green */ 25 | .hljs-keyword, 26 | .hljs-winutils, 27 | .method, 28 | .hljs-addition, 29 | .css .hljs-tag, 30 | .hljs-request, 31 | .hljs-status, 32 | .nginx .hljs-title { 33 | color: #859900; 34 | } 35 | 36 | /* Solarized Cyan */ 37 | .hljs-number, 38 | .hljs-command, 39 | .hljs-string, 40 | .hljs-tag .hljs-value, 41 | .hljs-rules .hljs-value, 42 | .hljs-phpdoc, 43 | .tex .hljs-formula, 44 | .hljs-regexp, 45 | .hljs-hexcolor, 46 | .hljs-link_url { 47 | color: #2aa198; 48 | } 49 | 50 | /* Solarized Blue */ 51 | .hljs-title, 52 | .hljs-localvars, 53 | .hljs-chunk, 54 | .hljs-decorator, 55 | .hljs-built_in, 56 | .hljs-identifier, 57 | .vhdl .hljs-literal, 58 | .hljs-id, 59 | .css .hljs-function { 60 | color: #268bd2; 61 | } 62 | 63 | /* Solarized Yellow */ 64 | .hljs-attribute, 65 | .hljs-variable, 66 | .lisp .hljs-body, 67 | .smalltalk .hljs-number, 68 | .hljs-constant, 69 | .hljs-class .hljs-title, 70 | .hljs-parent, 71 | .haskell .hljs-type, 72 | .hljs-link_reference { 73 | color: #b58900; 74 | } 75 | 76 | /* Solarized Orange */ 77 | .hljs-preprocessor, 78 | .hljs-preprocessor .hljs-keyword, 79 | .hljs-pragma, 80 | .hljs-shebang, 81 | .hljs-symbol, 82 | .hljs-symbol .hljs-string, 83 | .diff .hljs-change, 84 | .hljs-special, 85 | .hljs-attr_selector, 86 | .hljs-subst, 87 | .hljs-cdata, 88 | .clojure .hljs-title, 89 | .css .hljs-pseudo, 90 | .hljs-header { 91 | color: #cb4b16; 92 | } 93 | 94 | /* Solarized Red */ 95 | .hljs-deletion, 96 | .hljs-important { 97 | color: #dc322f; 98 | } 99 | 100 | /* Solarized Violet */ 101 | .hljs-link_label { 102 | color: #6c71c4; 103 | } 104 | 105 | .tex .hljs-formula { 106 | background: #073642; 107 | } 108 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/solarized_light.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | padding: 0.5em; 10 | background: #fdf6e3; 11 | color: #657b83; 12 | } 13 | 14 | .hljs-comment, 15 | .hljs-template_comment, 16 | .diff .hljs-header, 17 | .hljs-doctype, 18 | .hljs-pi, 19 | .lisp .hljs-string, 20 | .hljs-javadoc { 21 | color: #93a1a1; 22 | } 23 | 24 | /* Solarized Green */ 25 | .hljs-keyword, 26 | .hljs-winutils, 27 | .method, 28 | .hljs-addition, 29 | .css .hljs-tag, 30 | .hljs-request, 31 | .hljs-status, 32 | .nginx .hljs-title { 33 | color: #859900; 34 | } 35 | 36 | /* Solarized Cyan */ 37 | .hljs-number, 38 | .hljs-command, 39 | .hljs-string, 40 | .hljs-tag .hljs-value, 41 | .hljs-rules .hljs-value, 42 | .hljs-phpdoc, 43 | .tex .hljs-formula, 44 | .hljs-regexp, 45 | .hljs-hexcolor, 46 | .hljs-link_url { 47 | color: #2aa198; 48 | } 49 | 50 | /* Solarized Blue */ 51 | .hljs-title, 52 | .hljs-localvars, 53 | .hljs-chunk, 54 | .hljs-decorator, 55 | .hljs-built_in, 56 | .hljs-identifier, 57 | .vhdl .hljs-literal, 58 | .hljs-id, 59 | .css .hljs-function { 60 | color: #268bd2; 61 | } 62 | 63 | /* Solarized Yellow */ 64 | .hljs-attribute, 65 | .hljs-variable, 66 | .lisp .hljs-body, 67 | .smalltalk .hljs-number, 68 | .hljs-constant, 69 | .hljs-class .hljs-title, 70 | .hljs-parent, 71 | .haskell .hljs-type, 72 | .hljs-link_reference { 73 | color: #b58900; 74 | } 75 | 76 | /* Solarized Orange */ 77 | .hljs-preprocessor, 78 | .hljs-preprocessor .hljs-keyword, 79 | .hljs-pragma, 80 | .hljs-shebang, 81 | .hljs-symbol, 82 | .hljs-symbol .hljs-string, 83 | .diff .hljs-change, 84 | .hljs-special, 85 | .hljs-attr_selector, 86 | .hljs-subst, 87 | .hljs-cdata, 88 | .clojure .hljs-title, 89 | .css .hljs-pseudo, 90 | .hljs-header { 91 | color: #cb4b16; 92 | } 93 | 94 | /* Solarized Red */ 95 | .hljs-deletion, 96 | .hljs-important { 97 | color: #dc322f; 98 | } 99 | 100 | /* Solarized Violet */ 101 | .hljs-link_label { 102 | color: #6c71c4; 103 | } 104 | 105 | .tex .hljs-formula { 106 | background: #eee8d5; 107 | } 108 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/rainbow.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Style with support for rainbow parens 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | background: #474949; color: #D1D9E1; 10 | } 11 | 12 | 13 | .hljs-body, 14 | .hljs-collection { 15 | color: #D1D9E1; 16 | } 17 | 18 | .hljs-comment, 19 | .hljs-template_comment, 20 | .diff .hljs-header, 21 | .hljs-doctype, 22 | .lisp .hljs-string, 23 | .hljs-javadoc { 24 | color: #969896; 25 | font-style: italic; 26 | } 27 | 28 | .hljs-keyword, 29 | .clojure .hljs-attribute, 30 | .hljs-winutils, 31 | .javascript .hljs-title, 32 | .hljs-addition, 33 | .css .hljs-tag { 34 | color: #cc99cc; 35 | } 36 | 37 | .hljs-number { color: #f99157; } 38 | 39 | .hljs-command, 40 | .hljs-string, 41 | .hljs-tag .hljs-value, 42 | .hljs-phpdoc, 43 | .tex .hljs-formula, 44 | .hljs-regexp, 45 | .hljs-hexcolor { 46 | color: #8abeb7; 47 | } 48 | 49 | .hljs-title, 50 | .hljs-localvars, 51 | .hljs-function .hljs-title, 52 | .hljs-chunk, 53 | .hljs-decorator, 54 | .hljs-built_in, 55 | .lisp .hljs-title, 56 | .hljs-identifier 57 | { 58 | color: #b5bd68; 59 | } 60 | 61 | .hljs-class .hljs-keyword 62 | { 63 | color: #f2777a; 64 | } 65 | 66 | .hljs-variable, 67 | .lisp .hljs-body, 68 | .smalltalk .hljs-number, 69 | .hljs-constant, 70 | .hljs-class .hljs-title, 71 | .hljs-parent, 72 | .haskell .hljs-label, 73 | .hljs-id, 74 | .lisp .hljs-title, 75 | .clojure .hljs-title .hljs-built_in { 76 | color: #ffcc66; 77 | } 78 | 79 | .hljs-tag .hljs-title, 80 | .hljs-rules .hljs-property, 81 | .django .hljs-tag .hljs-keyword, 82 | .clojure .hljs-title .hljs-built_in { 83 | font-weight: bold; 84 | } 85 | 86 | .hljs-attribute, 87 | .clojure .hljs-title { 88 | color: #81a2be; 89 | } 90 | 91 | .hljs-preprocessor, 92 | .hljs-pragma, 93 | .hljs-pi, 94 | .hljs-shebang, 95 | .hljs-symbol, 96 | .hljs-symbol .hljs-string, 97 | .diff .hljs-change, 98 | .hljs-special, 99 | .hljs-attr_selector, 100 | .hljs-important, 101 | .hljs-subst, 102 | .hljs-cdata { 103 | color: #f99157; 104 | } 105 | 106 | .hljs-deletion { 107 | color: #dc322f; 108 | } 109 | 110 | .tex .hljs-formula { 111 | background: #eee8d5; 112 | } 113 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/pojoaque.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Pojoaque Style by Jason Tate 4 | http://web-cms-designs.com/ftopict-10-pojoaque-style-for-highlight-js-code-highlighter.html 5 | Based on Solarized Style from http://ethanschoonover.com/solarized 6 | 7 | */ 8 | 9 | .hljs { 10 | display: block; padding: 0.5em; 11 | color: #DCCF8F; 12 | background: url(./pojoaque.jpg) repeat scroll left top #181914; 13 | } 14 | 15 | .hljs-comment, 16 | .hljs-template_comment, 17 | .diff .hljs-header, 18 | .hljs-doctype, 19 | .lisp .hljs-string, 20 | .hljs-javadoc { 21 | color: #586e75; 22 | font-style: italic; 23 | } 24 | 25 | .hljs-keyword, 26 | .css .rule .hljs-keyword, 27 | .hljs-winutils, 28 | .javascript .hljs-title, 29 | .method, 30 | .hljs-addition, 31 | .css .hljs-tag, 32 | .clojure .hljs-title, 33 | .nginx .hljs-title { 34 | color: #B64926; 35 | } 36 | 37 | .hljs-number, 38 | .hljs-command, 39 | .hljs-string, 40 | .hljs-tag .hljs-value, 41 | .hljs-phpdoc, 42 | .tex .hljs-formula, 43 | .hljs-regexp, 44 | .hljs-hexcolor { 45 | color: #468966; 46 | } 47 | 48 | .hljs-title, 49 | .hljs-localvars, 50 | .hljs-function .hljs-title, 51 | .hljs-chunk, 52 | .hljs-decorator, 53 | .hljs-built_in, 54 | .lisp .hljs-title, 55 | .clojure .hljs-built_in, 56 | .hljs-identifier, 57 | .hljs-id { 58 | color: #FFB03B; 59 | } 60 | 61 | .hljs-attribute, 62 | .hljs-variable, 63 | .lisp .hljs-body, 64 | .smalltalk .hljs-number, 65 | .hljs-constant, 66 | .hljs-class .hljs-title, 67 | .hljs-parent, 68 | .haskell .hljs-type { 69 | color: #b58900; 70 | } 71 | 72 | .css .hljs-attribute { 73 | color: #b89859; 74 | } 75 | 76 | .css .hljs-number, 77 | .css .hljs-hexcolor { 78 | color: #DCCF8F; 79 | } 80 | 81 | .css .hljs-class { 82 | color: #d3a60c; 83 | } 84 | 85 | .hljs-preprocessor, 86 | .hljs-pragma, 87 | .hljs-pi, 88 | .hljs-shebang, 89 | .hljs-symbol, 90 | .hljs-symbol .hljs-string, 91 | .diff .hljs-change, 92 | .hljs-special, 93 | .hljs-attr_selector, 94 | .hljs-important, 95 | .hljs-subst, 96 | .hljs-cdata { 97 | color: #cb4b16; 98 | } 99 | 100 | .hljs-deletion { 101 | color: #dc322f; 102 | } 103 | 104 | .tex .hljs-formula { 105 | background: #073642; 106 | } 107 | -------------------------------------------------------------------------------- /server/controller/postCtrl.js: -------------------------------------------------------------------------------- 1 | /*global process,exports,require*/ 2 | (function () { 3 | "use strict"; 4 | var config = require("../config"), 5 | data = require("../data"), 6 | kits = require("../kits"), 7 | _ = require("lodash"); 8 | 9 | 10 | exports.add = function (req, res) { 11 | res.render('post/post_edit.html', { layout: 'layout_inner', title: '添加文章', current_nav: "add_post" }); 12 | }; 13 | 14 | exports.edit = function (req, res) { 15 | res.render('post/post_edit.html', { layout: 'layout_inner', title: '编辑文章', current_nav: "my_posts" }); 16 | }; 17 | 18 | exports.get_list_for_me = function (req, res) { 19 | res.render('post/posts.html', {layout: 'layout_inner', title: '我的文章', current_nav: "my_posts" }); 20 | }; 21 | 22 | exports.detail = function (req, res) { 23 | var post_id = req.param("post_id"); 24 | data.Post.get_by_id(post_id, function (err, post) { 25 | if (!post) { 26 | return res.redirect("/"); 27 | } 28 | post.hits = post.hits + 1; 29 | post.save(); 30 | var fullPost = post.makeFull(); 31 | fullPost.publish_date = kits.utils.date_format.fullDateTime(post.publish_date); 32 | fullPost.content = kits.utils.markdown_to_html(fullPost.content); 33 | data.Post.get_published_for_uid(fullPost.author, 10, function (err, posts) { 34 | if (err) { 35 | res.send({code: status.post_error.get_list_err}); 36 | } 37 | var otherPosts = []; 38 | _.forEach(posts, function (item) { 39 | if (item.id !== post.id) { 40 | var title = item.title; 41 | //if(title.length > 10) 42 | otherPosts.push({title: title, id: item.id}); 43 | } 44 | }); 45 | data.User.get_by_id(fullPost.author, function (err, user) { 46 | fullPost.author = user.makeSimple(); 47 | res.render('post/detail.html', {title: fullPost.title, post: fullPost, other_posts: otherPosts, current_nav: "home" }); 48 | }); 49 | 50 | }); 51 | 52 | }); 53 | 54 | }; 55 | })(); 56 | -------------------------------------------------------------------------------- /web/static/js/directive/directive.js: -------------------------------------------------------------------------------- 1 | /*global ngNice*/ 2 | (function () { 3 | "use strict"; 4 | ngNice.ngApp 5 | .directive("niceMarkdown", [function () { 6 | return { 7 | restrict: 'A', 8 | link : function (scope, element, attrs) { 9 | scope.$watch(attrs.niceMarkdown, function (value) { 10 | value = value || ''; 11 | if (value !== '') { 12 | value = marked(value); 13 | element.html(value); 14 | } else { 15 | element.html(''); 16 | } 17 | 18 | }); 19 | 20 | } 21 | } 22 | }]) 23 | .directive("loadingStatus", ['$timeout',function ($timeout) { 24 | return function (scope, element, attrs) { 25 | scope.$watch(attrs.loadingStatus, function (newValue, oldValue) { 26 | if (newValue === true) { 27 | element.button('loading'); 28 | } else if (newValue === false) { 29 | $timeout(function () { 30 | element.button('reset'); 31 | }); 32 | 33 | } 34 | }); 35 | }; 36 | }]) 37 | .directive("autoFocus", ['$timeout',function ($timeout) { 38 | return function (scope, element, attrs) { 39 | $timeout(function () { 40 | element[0].focus(); 41 | }); 42 | }; 43 | }]) 44 | .directive('niceEnter', ['$parse', function ($parse) { 45 | return function (scope, element, attrs) { 46 | var fn = $parse(attrs.niceEnter); 47 | element.bind("keydown keypress", function (event) { 48 | var keyCode = event.which || event.keyCode; 49 | if (keyCode === 13) { 50 | scope.$apply(function () { 51 | fn(scope, {$event: event}); 52 | }); 53 | event.preventDefault(); 54 | } 55 | }); 56 | }; 57 | }]); 58 | })(); 59 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/foundation.css: -------------------------------------------------------------------------------- 1 | /* 2 | Description: Foundation 4 docs style for highlight.js 3 | Author: Dan Allen 4 | Website: http://foundation.zurb.com/docs/ 5 | Version: 1.0 6 | Date: 2013-04-02 7 | */ 8 | 9 | .hljs { 10 | display: block; padding: 0.5em; 11 | background: #eee; 12 | } 13 | 14 | .hljs-header, 15 | .hljs-decorator, 16 | .hljs-annotation { 17 | color: #000077; 18 | } 19 | 20 | .hljs-horizontal_rule, 21 | .hljs-link_url, 22 | .hljs-emphasis, 23 | .hljs-attribute { 24 | color: #070; 25 | } 26 | 27 | .hljs-emphasis { 28 | font-style: italic; 29 | } 30 | 31 | .hljs-link_label, 32 | .hljs-strong, 33 | .hljs-value, 34 | .hljs-string, 35 | .scss .hljs-value .hljs-string { 36 | color: #d14; 37 | } 38 | 39 | .hljs-strong { 40 | font-weight: bold; 41 | } 42 | 43 | .hljs-blockquote, 44 | .hljs-comment { 45 | color: #998; 46 | font-style: italic; 47 | } 48 | 49 | .asciidoc .hljs-title, 50 | .hljs-function .hljs-title { 51 | color: #900; 52 | } 53 | 54 | .hljs-class { 55 | color: #458; 56 | } 57 | 58 | .hljs-id, 59 | .hljs-pseudo, 60 | .hljs-constant, 61 | .hljs-hexcolor { 62 | color: teal; 63 | } 64 | 65 | .hljs-variable { 66 | color: #336699; 67 | } 68 | 69 | .hljs-bullet, 70 | .hljs-javadoc { 71 | color: #997700; 72 | } 73 | 74 | .hljs-pi, 75 | .hljs-doctype { 76 | color: #3344bb; 77 | } 78 | 79 | .hljs-code, 80 | .hljs-number { 81 | color: #099; 82 | } 83 | 84 | .hljs-important { 85 | color: #f00; 86 | } 87 | 88 | .smartquote, 89 | .hljs-label { 90 | color: #970; 91 | } 92 | 93 | .hljs-preprocessor, 94 | .hljs-pragma { 95 | color: #579; 96 | } 97 | 98 | .hljs-reserved, 99 | .hljs-keyword, 100 | .scss .hljs-value { 101 | color: #000; 102 | } 103 | 104 | .hljs-regexp { 105 | background-color: #fff0ff; 106 | color: #880088; 107 | } 108 | 109 | .hljs-symbol { 110 | color: #990073; 111 | } 112 | 113 | .hljs-symbol .hljs-string { 114 | color: #a60; 115 | } 116 | 117 | .hljs-tag { 118 | color: #007700; 119 | } 120 | 121 | .hljs-at_rule, 122 | .hljs-at_rule .hljs-keyword { 123 | color: #088; 124 | } 125 | 126 | .hljs-at_rule .hljs-preprocessor { 127 | color: #808; 128 | } 129 | 130 | .scss .hljs-tag, 131 | .scss .hljs-attribute { 132 | color: #339; 133 | } 134 | -------------------------------------------------------------------------------- /server/handler.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var config = require("./config"), 3 | kits = require("./kits"), 4 | data = require("./data"), 5 | domain = require("domain"); 6 | 7 | /** 8 | * Init 9 | * @param req 10 | * @param res 11 | * @param next 12 | */ 13 | exports.init = function (req, res, next) { 14 | res.setHeader('X-Powered-By', 'ng-nice'); 15 | req.context = { 16 | operationId: kits.utils.guid() 17 | }; 18 | var uid = req.signedCookies[config.sessionKey]; 19 | 20 | if (uid) { 21 | data.User.get_by_id(uid, function (err, user) { 22 | if (err || !user) { 23 | res.locals.isAuthorized = false; 24 | next(); 25 | return; 26 | } 27 | res.locals.user = user.makeSimple(); 28 | req.user = res.locals.user; 29 | res.locals.isAuthorized = true; 30 | next(); 31 | }); 32 | } else { 33 | res.locals.isAuthorized = false; 34 | next(); 35 | } 36 | 37 | }; 38 | 39 | exports.domainMiddleware = function (req, res, next) { 40 | var d = domain.create(); 41 | d.add(req); 42 | d.add(res); 43 | d.on('error', function (err) { 44 | res.setHeader('Connection', 'close'); 45 | next(err); 46 | }); 47 | 48 | d.run(next); 49 | }; 50 | 51 | 52 | exports.errorHandler = function (error, req, res, next) { 53 | if (error && 'number' !== typeof error) { 54 | if (error.code && !error.error) { 55 | kits.logger.warn(error, {oid: req.context ? req.context.oid : ""}); 56 | } else { 57 | kits.logger.error(error, {oid: req.context ? req.context.oid : "", stack: error.stack || ""}); 58 | } 59 | } 60 | if (req.url.indexOf("/api") === 0) { 61 | if (error && error.code) { 62 | return res.send({code: error.code}); 63 | } else if ('number' === typeof error) { 64 | kits.logger.warn("response code is " + error, {oid: req.context ? req.context.oid : ""}); 65 | return res.send({code: error}); 66 | } else { 67 | return res.send({code: kits.status.error.server_error}); 68 | } 69 | } else { 70 | return res.render('home/error.html', {title: '服务器异常', current_nav: "error"}); 71 | } 72 | }; 73 | 74 | 75 | exports.passport = require("./passport.js"); -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Dark style from softwaremaniacs.org (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | background: #444; 10 | } 11 | 12 | .hljs-keyword, 13 | .hljs-literal, 14 | .hljs-change, 15 | .hljs-winutils, 16 | .hljs-flow, 17 | .lisp .hljs-title, 18 | .clojure .hljs-built_in, 19 | .nginx .hljs-title, 20 | .tex .hljs-special { 21 | color: white; 22 | } 23 | 24 | .hljs, 25 | .hljs-subst { 26 | color: #DDD; 27 | } 28 | 29 | .hljs-string, 30 | .hljs-title, 31 | .haskell .hljs-type, 32 | .ini .hljs-title, 33 | .hljs-tag .hljs-value, 34 | .css .hljs-rules .hljs-value, 35 | .hljs-preprocessor, 36 | .hljs-pragma, 37 | .ruby .hljs-symbol, 38 | .ruby .hljs-symbol .hljs-string, 39 | .ruby .hljs-class .hljs-parent, 40 | .hljs-built_in, 41 | .sql .hljs-aggregate, 42 | .django .hljs-template_tag, 43 | .django .hljs-variable, 44 | .smalltalk .hljs-class, 45 | .hljs-javadoc, 46 | .ruby .hljs-string, 47 | .django .hljs-filter .hljs-argument, 48 | .smalltalk .hljs-localvars, 49 | .smalltalk .hljs-array, 50 | .hljs-attr_selector, 51 | .hljs-pseudo, 52 | .hljs-addition, 53 | .hljs-stream, 54 | .hljs-envvar, 55 | .apache .hljs-tag, 56 | .apache .hljs-cbracket, 57 | .tex .hljs-command, 58 | .hljs-prompt, 59 | .coffeescript .hljs-attribute { 60 | color: #D88; 61 | } 62 | 63 | .hljs-comment, 64 | .java .hljs-annotation, 65 | .python .hljs-decorator, 66 | .hljs-template_comment, 67 | .hljs-pi, 68 | .hljs-doctype, 69 | .hljs-deletion, 70 | .hljs-shebang, 71 | .apache .hljs-sqbracket, 72 | .tex .hljs-formula { 73 | color: #777; 74 | } 75 | 76 | .hljs-keyword, 77 | .hljs-literal, 78 | .hljs-title, 79 | .css .hljs-id, 80 | .hljs-phpdoc, 81 | .haskell .hljs-type, 82 | .vbscript .hljs-built_in, 83 | .sql .hljs-aggregate, 84 | .rsl .hljs-built_in, 85 | .smalltalk .hljs-class, 86 | .diff .hljs-header, 87 | .hljs-chunk, 88 | .hljs-winutils, 89 | .bash .hljs-variable, 90 | .apache .hljs-tag, 91 | .tex .hljs-special, 92 | .hljs-request, 93 | .hljs-status { 94 | font-weight: bold; 95 | } 96 | 97 | .coffeescript .javascript, 98 | .javascript .xml, 99 | .tex .hljs-formula, 100 | .xml .javascript, 101 | .xml .vbscript, 102 | .xml .css, 103 | .xml .hljs-cdata { 104 | opacity: 0.5; 105 | } 106 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/brown_paper.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Brown Paper style from goldblog.com.ua (c) Zaripov Yura 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | background:#b7a68e url(./brown_papersq.png); 10 | } 11 | 12 | .hljs-keyword, 13 | .hljs-literal, 14 | .hljs-change, 15 | .hljs-winutils, 16 | .hljs-flow, 17 | .lisp .hljs-title, 18 | .clojure .hljs-built_in, 19 | .nginx .hljs-title, 20 | .tex .hljs-special, 21 | .hljs-request, 22 | .hljs-status { 23 | color:#005599; 24 | font-weight:bold; 25 | } 26 | 27 | .hljs, 28 | .hljs-subst, 29 | .hljs-tag .hljs-keyword { 30 | color: #363C69; 31 | } 32 | 33 | .hljs-string, 34 | .hljs-title, 35 | .haskell .hljs-type, 36 | .hljs-tag .hljs-value, 37 | .css .hljs-rules .hljs-value, 38 | .hljs-preprocessor, 39 | .hljs-pragma, 40 | .ruby .hljs-symbol, 41 | .ruby .hljs-symbol .hljs-string, 42 | .ruby .hljs-class .hljs-parent, 43 | .hljs-built_in, 44 | .sql .hljs-aggregate, 45 | .django .hljs-template_tag, 46 | .django .hljs-variable, 47 | .smalltalk .hljs-class, 48 | .hljs-javadoc, 49 | .ruby .hljs-string, 50 | .django .hljs-filter .hljs-argument, 51 | .smalltalk .hljs-localvars, 52 | .smalltalk .hljs-array, 53 | .hljs-attr_selector, 54 | .hljs-pseudo, 55 | .hljs-addition, 56 | .hljs-stream, 57 | .hljs-envvar, 58 | .apache .hljs-tag, 59 | .apache .hljs-cbracket, 60 | .tex .hljs-number { 61 | color: #2C009F; 62 | } 63 | 64 | .hljs-comment, 65 | .java .hljs-annotation, 66 | .python .hljs-decorator, 67 | .hljs-template_comment, 68 | .hljs-pi, 69 | .hljs-doctype, 70 | .hljs-deletion, 71 | .hljs-shebang, 72 | .apache .hljs-sqbracket, 73 | .nginx .hljs-built_in, 74 | .tex .hljs-formula { 75 | color: #802022; 76 | } 77 | 78 | .hljs-keyword, 79 | .hljs-literal, 80 | .css .hljs-id, 81 | .hljs-phpdoc, 82 | .hljs-title, 83 | .haskell .hljs-type, 84 | .vbscript .hljs-built_in, 85 | .sql .hljs-aggregate, 86 | .rsl .hljs-built_in, 87 | .smalltalk .hljs-class, 88 | .diff .hljs-header, 89 | .hljs-chunk, 90 | .hljs-winutils, 91 | .bash .hljs-variable, 92 | .apache .hljs-tag, 93 | .tex .hljs-command { 94 | font-weight: bold; 95 | } 96 | 97 | .coffeescript .javascript, 98 | .javascript .xml, 99 | .tex .hljs-formula, 100 | .xml .javascript, 101 | .xml .vbscript, 102 | .xml .css, 103 | .xml .hljs-cdata { 104 | opacity: 0.8; 105 | } 106 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | color: #333; 10 | background: #f8f8f8 11 | } 12 | 13 | .hljs-comment, 14 | .hljs-template_comment, 15 | .diff .hljs-header, 16 | .hljs-javadoc { 17 | color: #998; 18 | font-style: italic 19 | } 20 | 21 | .hljs-keyword, 22 | .css .rule .hljs-keyword, 23 | .hljs-winutils, 24 | .javascript .hljs-title, 25 | .nginx .hljs-title, 26 | .hljs-subst, 27 | .hljs-request, 28 | .hljs-status { 29 | color: #333; 30 | font-weight: bold 31 | } 32 | 33 | .hljs-number, 34 | .hljs-hexcolor, 35 | .ruby .hljs-constant { 36 | color: #099; 37 | } 38 | 39 | .hljs-string, 40 | .hljs-tag .hljs-value, 41 | .hljs-phpdoc, 42 | .tex .hljs-formula { 43 | color: #d14 44 | } 45 | 46 | .hljs-title, 47 | .hljs-id, 48 | .coffeescript .hljs-params, 49 | .scss .hljs-preprocessor { 50 | color: #900; 51 | font-weight: bold 52 | } 53 | 54 | .javascript .hljs-title, 55 | .lisp .hljs-title, 56 | .clojure .hljs-title, 57 | .hljs-subst { 58 | font-weight: normal 59 | } 60 | 61 | .hljs-class .hljs-title, 62 | .haskell .hljs-type, 63 | .vhdl .hljs-literal, 64 | .tex .hljs-command { 65 | color: #458; 66 | font-weight: bold 67 | } 68 | 69 | .hljs-tag, 70 | .hljs-tag .hljs-title, 71 | .hljs-rules .hljs-property, 72 | .django .hljs-tag .hljs-keyword { 73 | color: #000080; 74 | font-weight: normal 75 | } 76 | 77 | .hljs-attribute, 78 | .hljs-variable, 79 | .lisp .hljs-body { 80 | color: #008080 81 | } 82 | 83 | .hljs-regexp { 84 | color: #009926 85 | } 86 | 87 | .hljs-symbol, 88 | .ruby .hljs-symbol .hljs-string, 89 | .lisp .hljs-keyword, 90 | .tex .hljs-special, 91 | .hljs-prompt { 92 | color: #990073 93 | } 94 | 95 | .hljs-built_in, 96 | .lisp .hljs-title, 97 | .clojure .hljs-built_in { 98 | color: #0086b3 99 | } 100 | 101 | .hljs-preprocessor, 102 | .hljs-pragma, 103 | .hljs-pi, 104 | .hljs-doctype, 105 | .hljs-shebang, 106 | .hljs-cdata { 107 | color: #999; 108 | font-weight: bold 109 | } 110 | 111 | .hljs-deletion { 112 | background: #fdd 113 | } 114 | 115 | .hljs-addition { 116 | background: #dfd 117 | } 118 | 119 | .diff .hljs-change { 120 | background: #0086b3 121 | } 122 | 123 | .hljs-chunk { 124 | color: #aaa 125 | } 126 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/pagination.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pagination (multiple pages) 3 | // -------------------------------------------------- 4 | .pagination { 5 | display: inline-block; 6 | padding-left: 0; 7 | margin: @line-height-computed 0; 8 | border-radius: @border-radius-base; 9 | 10 | > li { 11 | display: inline; // Remove list-style and block-level defaults 12 | > a, 13 | > span { 14 | position: relative; 15 | float: left; // Collapse white-space 16 | padding: @padding-base-vertical @padding-base-horizontal; 17 | line-height: @line-height-base; 18 | text-decoration: none; 19 | color: @pagination-color; 20 | background-color: @pagination-bg; 21 | border: 1px solid @pagination-border; 22 | margin-left: -1px; 23 | } 24 | &:first-child { 25 | > a, 26 | > span { 27 | margin-left: 0; 28 | .border-left-radius(@border-radius-base); 29 | } 30 | } 31 | &:last-child { 32 | > a, 33 | > span { 34 | .border-right-radius(@border-radius-base); 35 | } 36 | } 37 | } 38 | 39 | > li > a, 40 | > li > span { 41 | &:hover, 42 | &:focus { 43 | color: @pagination-hover-color; 44 | background-color: @pagination-hover-bg; 45 | border-color: @pagination-hover-border; 46 | } 47 | } 48 | 49 | > .active > a, 50 | > .active > span { 51 | &, 52 | &:hover, 53 | &:focus { 54 | z-index: 2; 55 | color: @pagination-active-color; 56 | background-color: @pagination-active-bg; 57 | border-color: @pagination-active-border; 58 | cursor: default; 59 | } 60 | } 61 | 62 | > .disabled { 63 | > span, 64 | > span:hover, 65 | > span:focus, 66 | > a, 67 | > a:hover, 68 | > a:focus { 69 | color: @pagination-disabled-color; 70 | background-color: @pagination-disabled-bg; 71 | border-color: @pagination-disabled-border; 72 | cursor: not-allowed; 73 | } 74 | } 75 | } 76 | 77 | // Sizing 78 | // -------------------------------------------------- 79 | 80 | // Large 81 | .pagination-lg { 82 | .pagination-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @border-radius-large); 83 | } 84 | 85 | // Small 86 | .pagination-sm { 87 | .pagination-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @border-radius-small); 88 | } 89 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/idea.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Intellij Idea-like styling (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | color: #000; 10 | background: #fff; 11 | } 12 | 13 | .hljs-subst, 14 | .hljs-title { 15 | font-weight: normal; 16 | color: #000; 17 | } 18 | 19 | .hljs-comment, 20 | .hljs-template_comment, 21 | .hljs-javadoc, 22 | .diff .hljs-header { 23 | color: #808080; 24 | font-style: italic; 25 | } 26 | 27 | .hljs-annotation, 28 | .hljs-decorator, 29 | .hljs-preprocessor, 30 | .hljs-pragma, 31 | .hljs-doctype, 32 | .hljs-pi, 33 | .hljs-chunk, 34 | .hljs-shebang, 35 | .apache .hljs-cbracket, 36 | .hljs-prompt, 37 | .http .hljs-title { 38 | color: #808000; 39 | } 40 | 41 | .hljs-tag, 42 | .hljs-pi { 43 | background: #efefef; 44 | } 45 | 46 | .hljs-tag .hljs-title, 47 | .hljs-id, 48 | .hljs-attr_selector, 49 | .hljs-pseudo, 50 | .hljs-literal, 51 | .hljs-keyword, 52 | .hljs-hexcolor, 53 | .css .hljs-function, 54 | .ini .hljs-title, 55 | .css .hljs-class, 56 | .hljs-list .hljs-title, 57 | .clojure .hljs-title, 58 | .nginx .hljs-title, 59 | .tex .hljs-command, 60 | .hljs-request, 61 | .hljs-status { 62 | font-weight: bold; 63 | color: #000080; 64 | } 65 | 66 | .hljs-attribute, 67 | .hljs-rules .hljs-keyword, 68 | .hljs-number, 69 | .hljs-date, 70 | .hljs-regexp, 71 | .tex .hljs-special { 72 | font-weight: bold; 73 | color: #0000ff; 74 | } 75 | 76 | .hljs-number, 77 | .hljs-regexp { 78 | font-weight: normal; 79 | } 80 | 81 | .hljs-string, 82 | .hljs-value, 83 | .hljs-filter .hljs-argument, 84 | .css .hljs-function .hljs-params, 85 | .apache .hljs-tag { 86 | color: #008000; 87 | font-weight: bold; 88 | } 89 | 90 | .hljs-symbol, 91 | .ruby .hljs-symbol .hljs-string, 92 | .hljs-char, 93 | .tex .hljs-formula { 94 | color: #000; 95 | background: #d0eded; 96 | font-style: italic; 97 | } 98 | 99 | .hljs-phpdoc, 100 | .hljs-yardoctag, 101 | .hljs-javadoctag { 102 | text-decoration: underline; 103 | } 104 | 105 | .hljs-variable, 106 | .hljs-envvar, 107 | .apache .hljs-sqbracket, 108 | .nginx .hljs-built_in { 109 | color: #660e7a; 110 | } 111 | 112 | .hljs-addition { 113 | background: #baeeba; 114 | } 115 | 116 | .hljs-deletion { 117 | background: #ffc8bd; 118 | } 119 | 120 | .diff .hljs-change { 121 | background: #bccff9; 122 | } 123 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/responsive-utilities.less: -------------------------------------------------------------------------------- 1 | // 2 | // Responsive: Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // IE10 in Windows (Phone) 8 7 | // 8 | // Support for responsive views via media queries is kind of borked in IE10, for 9 | // Surface/desktop in split view and for Windows Phone 8. This particular fix 10 | // must be accompanied by a snippet of JavaScript to sniff the user agent and 11 | // apply some conditional CSS to *only* the Surface/desktop Windows 8. Look at 12 | // our Getting Started page for more information on this bug. 13 | // 14 | // For more information, see the following: 15 | // 16 | // Issue: https://github.com/twbs/bootstrap/issues/10497 17 | // Docs: http://getbootstrap.com/getting-started/#browsers 18 | // Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/ 19 | 20 | @-ms-viewport { 21 | width: device-width; 22 | } 23 | 24 | 25 | // Visibility utilities 26 | .visible-xs, 27 | .visible-sm, 28 | .visible-md, 29 | .visible-lg { 30 | .responsive-invisibility(); 31 | } 32 | 33 | .visible-xs { 34 | @media (max-width: @screen-xs-max) { 35 | .responsive-visibility(); 36 | } 37 | } 38 | .visible-sm { 39 | @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) { 40 | .responsive-visibility(); 41 | } 42 | } 43 | .visible-md { 44 | @media (min-width: @screen-md-min) and (max-width: @screen-md-max) { 45 | .responsive-visibility(); 46 | } 47 | } 48 | .visible-lg { 49 | @media (min-width: @screen-lg-min) { 50 | .responsive-visibility(); 51 | } 52 | } 53 | 54 | .hidden-xs { 55 | @media (max-width: @screen-xs-max) { 56 | .responsive-invisibility(); 57 | } 58 | } 59 | .hidden-sm { 60 | @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) { 61 | .responsive-invisibility(); 62 | } 63 | } 64 | .hidden-md { 65 | @media (min-width: @screen-md-min) and (max-width: @screen-md-max) { 66 | .responsive-invisibility(); 67 | } 68 | } 69 | .hidden-lg { 70 | @media (min-width: @screen-lg-min) { 71 | .responsive-invisibility(); 72 | } 73 | } 74 | 75 | 76 | // Print utilities 77 | // 78 | // Media queries are placed on the inside to be mixin-friendly. 79 | 80 | .visible-print { 81 | .responsive-invisibility(); 82 | 83 | @media print { 84 | .responsive-visibility(); 85 | } 86 | } 87 | 88 | .hidden-print { 89 | @media print { 90 | .responsive-invisibility(); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /web/static/css/less/layout.less: -------------------------------------------------------------------------------- 1 | @right_panel_width : 300px; 2 | 3 | html, body { 4 | height : 100%; 5 | //font-family: 'Droid Serif', serif; 6 | //font-family: Arial, Helvetica, sans-serif; 7 | font-family : arial, "微软雅黑" 8 | } 9 | 10 | .inner-body { 11 | color : #242628; 12 | font-weight : 300; 13 | background : #edece4; 14 | } 15 | 16 | @footer_height : 80px; 17 | #wrap { 18 | min-height : 100%; 19 | height : auto; 20 | margin : 0 auto -@footer_height; 21 | padding : 0 0 @footer_height; 22 | .main { 23 | min-height : 100%; 24 | height : auto; 25 | padding : 60px 20px 0 20px; 26 | @media (max-width : @screen-sm-min) { 27 | padding : 50px 5px 0 5px; 28 | } 29 | } 30 | 31 | } 32 | 33 | #inner-wrap { 34 | min-height : 100%; 35 | height : 100%; 36 | margin : 0 auto 0; 37 | .main { 38 | min-height : 100%; 39 | height : auto; 40 | padding : 60px 20px 0 20px; 41 | } 42 | } 43 | 44 | #footer { 45 | background : #f5f5f5; 46 | height : @footer_height; 47 | @media (max-width : @screen-sm-min) { 48 | height : 95px; 49 | } 50 | p { 51 | text-align : center; 52 | line-height : 20px; 53 | } 54 | .links { 55 | margin-top : 12px; 56 | } 57 | .text-muted { 58 | margin-top : 12px; 59 | a { 60 | color : #666666; 61 | &:hover { 62 | color : #242628; 63 | } 64 | } 65 | color : #999999; 66 | } 67 | } 68 | 69 | .push { 70 | height : 30px; 71 | @media (max-width : @screen-sm-min) { 72 | height : 0px; 73 | } 74 | } 75 | 76 | .center-right-panel { 77 | position : relative; 78 | .center-panel { 79 | margin-right : @right_panel_width; 80 | min-height : 300px; 81 | } 82 | .right-panel { 83 | position : absolute; 84 | width : @right_panel_width; 85 | min-height : 300px; 86 | right : 0px; 87 | float : left; 88 | top : 0px; 89 | } 90 | @media (max-width : @screen-sm-min) { 91 | .center-panel { 92 | margin-right : 0px; 93 | } 94 | 95 | .right-panel { 96 | float : none; 97 | position : inherit; 98 | margin-top : 10px; 99 | min-height : 30px; 100 | margin-left : auto; 101 | margin-right : auto; 102 | } 103 | 104 | } 105 | 106 | } -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/zenburn.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Zenburn style from voldmar.ru (c) Vladimir Epifanov 4 | based on dark.css by Ivan Sagalaev 5 | 6 | */ 7 | 8 | .hljs { 9 | display: block; padding: 0.5em; 10 | background: #3F3F3F; 11 | color: #DCDCDC; 12 | } 13 | 14 | .hljs-keyword, 15 | .hljs-tag, 16 | .css .hljs-class, 17 | .css .hljs-id, 18 | .lisp .hljs-title, 19 | .nginx .hljs-title, 20 | .hljs-request, 21 | .hljs-status, 22 | .clojure .hljs-attribute { 23 | color: #E3CEAB; 24 | } 25 | 26 | .django .hljs-template_tag, 27 | .django .hljs-variable, 28 | .django .hljs-filter .hljs-argument { 29 | color: #DCDCDC; 30 | } 31 | 32 | .hljs-number, 33 | .hljs-date { 34 | color: #8CD0D3; 35 | } 36 | 37 | .dos .hljs-envvar, 38 | .dos .hljs-stream, 39 | .hljs-variable, 40 | .apache .hljs-sqbracket { 41 | color: #EFDCBC; 42 | } 43 | 44 | .dos .hljs-flow, 45 | .diff .hljs-change, 46 | .python .exception, 47 | .python .hljs-built_in, 48 | .hljs-literal, 49 | .tex .hljs-special { 50 | color: #EFEFAF; 51 | } 52 | 53 | .diff .hljs-chunk, 54 | .hljs-subst { 55 | color: #8F8F8F; 56 | } 57 | 58 | .dos .hljs-keyword, 59 | .python .hljs-decorator, 60 | .hljs-title, 61 | .haskell .hljs-type, 62 | .diff .hljs-header, 63 | .ruby .hljs-class .hljs-parent, 64 | .apache .hljs-tag, 65 | .nginx .hljs-built_in, 66 | .tex .hljs-command, 67 | .hljs-prompt { 68 | color: #efef8f; 69 | } 70 | 71 | .dos .hljs-winutils, 72 | .ruby .hljs-symbol, 73 | .ruby .hljs-symbol .hljs-string, 74 | .ruby .hljs-string { 75 | color: #DCA3A3; 76 | } 77 | 78 | .diff .hljs-deletion, 79 | .hljs-string, 80 | .hljs-tag .hljs-value, 81 | .hljs-preprocessor, 82 | .hljs-pragma, 83 | .hljs-built_in, 84 | .sql .hljs-aggregate, 85 | .hljs-javadoc, 86 | .smalltalk .hljs-class, 87 | .smalltalk .hljs-localvars, 88 | .smalltalk .hljs-array, 89 | .css .hljs-rules .hljs-value, 90 | .hljs-attr_selector, 91 | .hljs-pseudo, 92 | .apache .hljs-cbracket, 93 | .tex .hljs-formula, 94 | .coffeescript .hljs-attribute { 95 | color: #CC9393; 96 | } 97 | 98 | .hljs-shebang, 99 | .diff .hljs-addition, 100 | .hljs-comment, 101 | .java .hljs-annotation, 102 | .hljs-template_comment, 103 | .hljs-pi, 104 | .hljs-doctype { 105 | color: #7F9F7F; 106 | } 107 | 108 | .coffeescript .javascript, 109 | .javascript .xml, 110 | .tex .hljs-formula, 111 | .xml .javascript, 112 | .xml .vbscript, 113 | .xml .css, 114 | .xml .hljs-cdata { 115 | opacity: 0.5; 116 | } 117 | 118 | -------------------------------------------------------------------------------- /web/static/js/controller/user.js: -------------------------------------------------------------------------------- 1 | /*global ngNice*/ 2 | (function () { 3 | "use strict"; 4 | 5 | ngNice.ngApp.controller("user_login_ctrl", ["$scope", "data", function ($scope, data) { 6 | 7 | $scope.js_login = function (form, user) { 8 | $scope.signining = true; 9 | data.user.signin(user.name, user.password, user.is_remember) 10 | .success(function (result) { 11 | $scope.is_success = true; 12 | window.location.href = "/"; 13 | }).error(function (result) { 14 | form.$errors.unshift("用户名或者密码输入错误"); 15 | }).finally(function (result) { 16 | $scope.signining = false; 17 | }); 18 | }; 19 | }]).controller("user_signup_ctrl", ["$scope", "data", function ($scope, data) { 20 | 21 | $scope.js_signup = function (form, user) { 22 | data.user.signup(user.name, user.email, user.password) 23 | .success(function (result) { 24 | window.location.href = "/signin"; 25 | }); 26 | }; 27 | }]).controller("user_setting_ctrl", ["$scope", "data", "niceUtil", function ($scope, data, niceUtil) { 28 | data.user.get_me().success(function (result) { 29 | $scope.user = result.data; 30 | }); 31 | 32 | $scope.js_change_basic = function (user) { 33 | $scope.saving = true; 34 | data.user.update(user.name, user.desc).success(function (result) { 35 | $scope.saving = false; 36 | niceUtil.msg.success("修改用户基本信息成功!"); 37 | $("#header_user_name").text(user.name); 38 | }) 39 | }; 40 | 41 | $scope.js_change_password = function (user) { 42 | $scope.saving = true; 43 | data.user.update_password(user.password, user.new_password).success(function (result) { 44 | $scope.saving = false; 45 | niceUtil.msg.success("修改密码成功!"); 46 | user.password = ""; 47 | user.new_password = ""; 48 | user.repeat_password = ""; 49 | }) 50 | }; 51 | 52 | $scope.js_update_avatar = function (user) { 53 | data.user.update_avatar(user.avatar.path).success(function (result) { 54 | niceUtil.msg.success("更新头像成功!"); 55 | $("#header_avatar_img").attr("src", user.avatar.path); 56 | }); 57 | } 58 | }]); 59 | 60 | })(); 61 | 62 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/docco.css: -------------------------------------------------------------------------------- 1 | /* 2 | Docco style used in http://jashkenas.github.com/docco/ converted by Simon Madine (@thingsinjars) 3 | */ 4 | 5 | .hljs { 6 | display: block; padding: 0.5em; 7 | color: #000; 8 | background: #f8f8ff 9 | } 10 | 11 | .hljs-comment, 12 | .hljs-template_comment, 13 | .diff .hljs-header, 14 | .hljs-javadoc { 15 | color: #408080; 16 | font-style: italic 17 | } 18 | 19 | .hljs-keyword, 20 | .assignment, 21 | .hljs-literal, 22 | .css .rule .hljs-keyword, 23 | .hljs-winutils, 24 | .javascript .hljs-title, 25 | .lisp .hljs-title, 26 | .hljs-subst { 27 | color: #954121; 28 | } 29 | 30 | .hljs-number, 31 | .hljs-hexcolor { 32 | color: #40a070 33 | } 34 | 35 | .hljs-string, 36 | .hljs-tag .hljs-value, 37 | .hljs-phpdoc, 38 | .tex .hljs-formula { 39 | color: #219161; 40 | } 41 | 42 | .hljs-title, 43 | .hljs-id { 44 | color: #19469D; 45 | } 46 | .hljs-params { 47 | color: #00F; 48 | } 49 | 50 | .javascript .hljs-title, 51 | .lisp .hljs-title, 52 | .hljs-subst { 53 | font-weight: normal 54 | } 55 | 56 | .hljs-class .hljs-title, 57 | .haskell .hljs-label, 58 | .tex .hljs-command { 59 | color: #458; 60 | font-weight: bold 61 | } 62 | 63 | .hljs-tag, 64 | .hljs-tag .hljs-title, 65 | .hljs-rules .hljs-property, 66 | .django .hljs-tag .hljs-keyword { 67 | color: #000080; 68 | font-weight: normal 69 | } 70 | 71 | .hljs-attribute, 72 | .hljs-variable, 73 | .instancevar, 74 | .lisp .hljs-body { 75 | color: #008080 76 | } 77 | 78 | .hljs-regexp { 79 | color: #B68 80 | } 81 | 82 | .hljs-class { 83 | color: #458; 84 | font-weight: bold 85 | } 86 | 87 | .hljs-symbol, 88 | .ruby .hljs-symbol .hljs-string, 89 | .ruby .hljs-symbol .hljs-keyword, 90 | .ruby .hljs-symbol .keymethods, 91 | .lisp .hljs-keyword, 92 | .tex .hljs-special, 93 | .input_number { 94 | color: #990073 95 | } 96 | 97 | .builtin, 98 | .constructor, 99 | .hljs-built_in, 100 | .lisp .hljs-title { 101 | color: #0086b3 102 | } 103 | 104 | .hljs-preprocessor, 105 | .hljs-pragma, 106 | .hljs-pi, 107 | .hljs-doctype, 108 | .hljs-shebang, 109 | .hljs-cdata { 110 | color: #999; 111 | font-weight: bold 112 | } 113 | 114 | .hljs-deletion { 115 | background: #fdd 116 | } 117 | 118 | .hljs-addition { 119 | background: #dfd 120 | } 121 | 122 | .diff .hljs-change { 123 | background: #0086b3 124 | } 125 | 126 | .hljs-chunk { 127 | color: #aaa 128 | } 129 | 130 | .tex .hljs-formula { 131 | opacity: 0.5; 132 | } 133 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/far.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | FAR Style (c) MajestiC 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | background: #000080; 10 | } 11 | 12 | .hljs, 13 | .hljs-subst { 14 | color: #0FF; 15 | } 16 | 17 | .hljs-string, 18 | .ruby .hljs-string, 19 | .haskell .hljs-type, 20 | .hljs-tag .hljs-value, 21 | .css .hljs-rules .hljs-value, 22 | .css .hljs-rules .hljs-value .hljs-number, 23 | .hljs-preprocessor, 24 | .hljs-pragma, 25 | .ruby .hljs-symbol, 26 | .ruby .hljs-symbol .hljs-string, 27 | .hljs-built_in, 28 | .sql .hljs-aggregate, 29 | .django .hljs-template_tag, 30 | .django .hljs-variable, 31 | .smalltalk .hljs-class, 32 | .hljs-addition, 33 | .apache .hljs-tag, 34 | .apache .hljs-cbracket, 35 | .tex .hljs-command, 36 | .clojure .hljs-title, 37 | .coffeescript .hljs-attribute { 38 | color: #FF0; 39 | } 40 | 41 | .hljs-keyword, 42 | .css .hljs-id, 43 | .hljs-title, 44 | .haskell .hljs-type, 45 | .vbscript .hljs-built_in, 46 | .sql .hljs-aggregate, 47 | .rsl .hljs-built_in, 48 | .smalltalk .hljs-class, 49 | .xml .hljs-tag .hljs-title, 50 | .hljs-winutils, 51 | .hljs-flow, 52 | .hljs-change, 53 | .hljs-envvar, 54 | .bash .hljs-variable, 55 | .tex .hljs-special, 56 | .clojure .hljs-built_in { 57 | color: #FFF; 58 | } 59 | 60 | .hljs-comment, 61 | .hljs-phpdoc, 62 | .hljs-javadoc, 63 | .java .hljs-annotation, 64 | .hljs-template_comment, 65 | .hljs-deletion, 66 | .apache .hljs-sqbracket, 67 | .tex .hljs-formula { 68 | color: #888; 69 | } 70 | 71 | .hljs-number, 72 | .hljs-date, 73 | .hljs-regexp, 74 | .hljs-literal, 75 | .smalltalk .hljs-symbol, 76 | .smalltalk .hljs-char, 77 | .clojure .hljs-attribute { 78 | color: #0F0; 79 | } 80 | 81 | .python .hljs-decorator, 82 | .django .hljs-filter .hljs-argument, 83 | .smalltalk .hljs-localvars, 84 | .smalltalk .hljs-array, 85 | .hljs-attr_selector, 86 | .hljs-pseudo, 87 | .xml .hljs-pi, 88 | .diff .hljs-header, 89 | .hljs-chunk, 90 | .hljs-shebang, 91 | .nginx .hljs-built_in, 92 | .hljs-prompt { 93 | color: #008080; 94 | } 95 | 96 | .hljs-keyword, 97 | .css .hljs-id, 98 | .hljs-title, 99 | .haskell .hljs-type, 100 | .vbscript .hljs-built_in, 101 | .sql .hljs-aggregate, 102 | .rsl .hljs-built_in, 103 | .smalltalk .hljs-class, 104 | .hljs-winutils, 105 | .hljs-flow, 106 | .apache .hljs-tag, 107 | .nginx .hljs-built_in, 108 | .tex .hljs-command, 109 | .tex .hljs-special, 110 | .hljs-request, 111 | .hljs-status { 112 | font-weight: bold; 113 | } 114 | -------------------------------------------------------------------------------- /web/view/post/detail.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

<%-post.title%>

6 | 11 |
12 |
13 | <%-post.content%> 14 |
15 |
16 |
17 |
18 |
19 |
20 | 21 | 22 | <%=post.author.display_name%> 23 | 24 |

<%=post.author.desc || "作者暂时没有描述"%>

25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
35 |
36 |

作者其他文章

37 |
38 |
39 | <%if(other_posts && other_posts.length > 0){ 40 | %> 41 |
    42 | <%if(other_posts && other_posts.length > 0){ 43 | for(var i = 0;i < other_posts.length;i++) 44 | { 45 | %> 46 |
  • <%-other_posts[i].title%>
  • 47 | <% 48 | } 49 | }%> 50 |
51 | <% 52 | }else{ 53 | %> 54 |
作者暂无其他文章。
55 | <% 56 | }%> 57 |
58 |
59 |
60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/magula.css: -------------------------------------------------------------------------------- 1 | /* 2 | Description: Magula style for highligh.js 3 | Author: Ruslan Keba 4 | Website: http://rukeba.com/ 5 | Version: 1.0 6 | Date: 2009-01-03 7 | Music: Aphex Twin / Xtal 8 | */ 9 | 10 | .hljs { 11 | display: block; padding: 0.5em; 12 | background-color: #f4f4f4; 13 | } 14 | 15 | .hljs, 16 | .hljs-subst, 17 | .lisp .hljs-title, 18 | .clojure .hljs-built_in { 19 | color: black; 20 | } 21 | 22 | .hljs-string, 23 | .hljs-title, 24 | .hljs-parent, 25 | .hljs-tag .hljs-value, 26 | .hljs-rules .hljs-value, 27 | .hljs-rules .hljs-value .hljs-number, 28 | .hljs-preprocessor, 29 | .hljs-pragma, 30 | .ruby .hljs-symbol, 31 | .ruby .hljs-symbol .hljs-string, 32 | .hljs-aggregate, 33 | .hljs-template_tag, 34 | .django .hljs-variable, 35 | .smalltalk .hljs-class, 36 | .hljs-addition, 37 | .hljs-flow, 38 | .hljs-stream, 39 | .bash .hljs-variable, 40 | .apache .hljs-cbracket, 41 | .coffeescript .hljs-attribute { 42 | color: #050; 43 | } 44 | 45 | .hljs-comment, 46 | .hljs-annotation, 47 | .hljs-template_comment, 48 | .diff .hljs-header, 49 | .hljs-chunk { 50 | color: #777; 51 | } 52 | 53 | .hljs-number, 54 | .hljs-date, 55 | .hljs-regexp, 56 | .hljs-literal, 57 | .smalltalk .hljs-symbol, 58 | .smalltalk .hljs-char, 59 | .hljs-change, 60 | .tex .hljs-special { 61 | color: #800; 62 | } 63 | 64 | .hljs-label, 65 | .hljs-javadoc, 66 | .ruby .hljs-string, 67 | .hljs-decorator, 68 | .hljs-filter .hljs-argument, 69 | .hljs-localvars, 70 | .hljs-array, 71 | .hljs-attr_selector, 72 | .hljs-pseudo, 73 | .hljs-pi, 74 | .hljs-doctype, 75 | .hljs-deletion, 76 | .hljs-envvar, 77 | .hljs-shebang, 78 | .apache .hljs-sqbracket, 79 | .nginx .hljs-built_in, 80 | .tex .hljs-formula, 81 | .hljs-prompt, 82 | .clojure .hljs-attribute { 83 | color: #00e; 84 | } 85 | 86 | .hljs-keyword, 87 | .hljs-id, 88 | .hljs-phpdoc, 89 | .hljs-title, 90 | .hljs-built_in, 91 | .hljs-aggregate, 92 | .smalltalk .hljs-class, 93 | .hljs-winutils, 94 | .bash .hljs-variable, 95 | .apache .hljs-tag, 96 | .xml .hljs-tag, 97 | .tex .hljs-command, 98 | .hljs-request, 99 | .hljs-status { 100 | font-weight: bold; 101 | color: navy; 102 | } 103 | 104 | .nginx .hljs-built_in { 105 | font-weight: normal; 106 | } 107 | 108 | .coffeescript .javascript, 109 | .javascript .xml, 110 | .tex .hljs-formula, 111 | .xml .javascript, 112 | .xml .vbscript, 113 | .xml .css, 114 | .xml .hljs-cdata { 115 | opacity: 0.5; 116 | } 117 | 118 | /* --- */ 119 | .apache .hljs-tag { 120 | font-weight: bold; 121 | color: blue; 122 | } 123 | 124 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/school_book.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | School Book style from goldblog.com.ua (c) Zaripov Yura 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 15px 0.5em 0.5em 30px; 9 | font-size: 11px !important; 10 | line-height:16px !important; 11 | } 12 | 13 | pre{ 14 | background:#f6f6ae url(./school_book.png); 15 | border-top: solid 2px #d2e8b9; 16 | border-bottom: solid 1px #d2e8b9; 17 | } 18 | 19 | .hljs-keyword, 20 | .hljs-literal, 21 | .hljs-change, 22 | .hljs-winutils, 23 | .hljs-flow, 24 | .lisp .hljs-title, 25 | .clojure .hljs-built_in, 26 | .nginx .hljs-title, 27 | .tex .hljs-special { 28 | color:#005599; 29 | font-weight:bold; 30 | } 31 | 32 | .hljs, 33 | .hljs-subst, 34 | .hljs-tag .hljs-keyword { 35 | color: #3E5915; 36 | } 37 | 38 | .hljs-string, 39 | .hljs-title, 40 | .haskell .hljs-type, 41 | .hljs-tag .hljs-value, 42 | .css .hljs-rules .hljs-value, 43 | .hljs-preprocessor, 44 | .hljs-pragma, 45 | .ruby .hljs-symbol, 46 | .ruby .hljs-symbol .hljs-string, 47 | .ruby .hljs-class .hljs-parent, 48 | .hljs-built_in, 49 | .sql .hljs-aggregate, 50 | .django .hljs-template_tag, 51 | .django .hljs-variable, 52 | .smalltalk .hljs-class, 53 | .hljs-javadoc, 54 | .ruby .hljs-string, 55 | .django .hljs-filter .hljs-argument, 56 | .smalltalk .hljs-localvars, 57 | .smalltalk .hljs-array, 58 | .hljs-attr_selector, 59 | .hljs-pseudo, 60 | .hljs-addition, 61 | .hljs-stream, 62 | .hljs-envvar, 63 | .apache .hljs-tag, 64 | .apache .hljs-cbracket, 65 | .nginx .hljs-built_in, 66 | .tex .hljs-command, 67 | .coffeescript .hljs-attribute { 68 | color: #2C009F; 69 | } 70 | 71 | .hljs-comment, 72 | .java .hljs-annotation, 73 | .python .hljs-decorator, 74 | .hljs-template_comment, 75 | .hljs-pi, 76 | .hljs-doctype, 77 | .hljs-deletion, 78 | .hljs-shebang, 79 | .apache .hljs-sqbracket { 80 | color: #E60415; 81 | } 82 | 83 | .hljs-keyword, 84 | .hljs-literal, 85 | .css .hljs-id, 86 | .hljs-phpdoc, 87 | .hljs-title, 88 | .haskell .hljs-type, 89 | .vbscript .hljs-built_in, 90 | .sql .hljs-aggregate, 91 | .rsl .hljs-built_in, 92 | .smalltalk .hljs-class, 93 | .xml .hljs-tag .hljs-title, 94 | .diff .hljs-header, 95 | .hljs-chunk, 96 | .hljs-winutils, 97 | .bash .hljs-variable, 98 | .apache .hljs-tag, 99 | .tex .hljs-command, 100 | .hljs-request, 101 | .hljs-status { 102 | font-weight: bold; 103 | } 104 | 105 | .coffeescript .javascript, 106 | .javascript .xml, 107 | .tex .hljs-formula, 108 | .xml .javascript, 109 | .xml .vbscript, 110 | .xml .css, 111 | .xml .hljs-cdata { 112 | opacity: 0.5; 113 | } 114 | -------------------------------------------------------------------------------- /server/kits/utils.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'), 2 | uuid = require("node-uuid"), 3 | moment = require("moment"), 4 | marked = require("marked"), 5 | paginator = require("../lib/paginator"); 6 | 7 | /** 8 | * encrypt 9 | * @param str 10 | * @param secret 11 | * @returns {*} 12 | */ 13 | exports.encrypt = function (str, secret) { 14 | var cipher = crypto.createCipher('aes192', secret); 15 | var enc = cipher.update(str, 'utf8', 'hex'); 16 | enc += cipher.final('hex'); 17 | return enc; 18 | }; 19 | 20 | /** 21 | * decrypt 22 | * @param str 23 | * @param secret 24 | * @returns {*} 25 | */ 26 | exports.decrypt = function (str, secret) { 27 | var decipher = crypto.createDecipher('aes192', secret); 28 | var dec = decipher.update(str, 'hex', 'utf8'); 29 | dec += decipher.final('utf8'); 30 | return dec; 31 | }; 32 | 33 | /** 34 | * MD5 35 | * @param input 36 | * @returns {*} 37 | */ 38 | exports.md5 = function (input) { 39 | var md5sum = crypto.createHash('md5'); 40 | md5sum.update(input); 41 | return md5sum.digest('hex'); 42 | }; 43 | 44 | /** 45 | * 生成 GUID 46 | * @returns {*} 47 | */ 48 | exports.guid = function () { 49 | var str = uuid.v4(); 50 | var regex = new RegExp('-', 'g'); 51 | str = str.replace(regex, ''); 52 | 53 | return str; 54 | }; 55 | 56 | /** 57 | * 生成 短GUID 58 | * @returns {string} 59 | */ 60 | exports.short_guid = function () { 61 | var str = exports.guid(); 62 | var val = 1; 63 | for (var i = 0; i < str.length; i++) { 64 | val *= (parseInt(str.charCodeAt(i).toString(16)) + 1); 65 | } 66 | val = val - (new Date()).getTime(); 67 | return val.toString(16).substring(0, 14); 68 | }; 69 | 70 | exports.date_format = { 71 | fullDateTime: function (input) { 72 | return moment(input).format("YYYY-MM-DD HH:ss") 73 | } 74 | }; 75 | 76 | exports.markdown_to_html = function (input) { 77 | return marked(input); 78 | }; 79 | 80 | exports.pager_render = function (page, total, per_count) { 81 | var pagination = new paginator.SearchPaginator({ 82 | prelink : '', 83 | current : page, 84 | rowsPerPage: per_count, 85 | totalResult: total 86 | }); 87 | return pagination.render(); 88 | }; 89 | 90 | marked.setOptions({ 91 | renderer : new marked.Renderer(), 92 | gfm : true, 93 | tables : true, 94 | breaks : true, 95 | pedantic : false, 96 | sanitize : true, 97 | smartLists : true, 98 | smartypants: false 99 | }); 100 | 101 | 102 | -------------------------------------------------------------------------------- /gruntfile.js: -------------------------------------------------------------------------------- 1 | /*global grunt*/ 2 | module.exports = function (grunt) { 3 | 4 | var config = require("./server/config"); 5 | var siteScripts = []; 6 | for (var i = 0; i < config.siteScripts.length; i++) { 7 | siteScripts.push("web/static/" + config.siteScripts[i]); 8 | } 9 | // Project configuration. 10 | grunt.initConfig({ 11 | pkg : grunt.file.readJSON('package.json'), 12 | concat: { 13 | js: { 14 | //['res/lib/jquery/1.11.0/jquery.js','res/lib/bootstrap/3.1.1/js/bootstrap.js', 'res/js/main.js'], 15 | // 这里的site_scripts是从配置文件读取的,因为layout也需要读取site_scripts,如果仅仅是这个地方使用到,可以按照上面的方式写死 16 | src : siteScripts, 17 | dest: 'web/static/js/<%= pkg.name %>.js' 18 | } 19 | }, 20 | uglify: { 21 | options: { 22 | banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' 23 | }, 24 | build : { 25 | src : 'web/static/js/<%= pkg.name %>.js', 26 | dest: 'web/static/js/<%= pkg.name %>.min.js' 27 | } 28 | }, 29 | less : { 30 | compile: { 31 | files: { 32 | "web/static/css/css.css" : "web/static/css/css.less" 33 | } 34 | } 35 | }, 36 | jsdoc : { 37 | basic: { 38 | src : ['core/api/user.js', 'core/api/post.js'], 39 | options: { 40 | destination: 'docs/basic' 41 | } 42 | }, 43 | docstrap : { 44 | src : ['core/api/user.js', 'core/api/post.js'], 45 | options : { 46 | destination : 'docs/docstrap', 47 | template : "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template", 48 | configure : "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template/jsdoc.conf.json" 49 | } 50 | } 51 | } 52 | }); 53 | 54 | // 从node_modules目录加载模块文件 55 | grunt.loadNpmTasks('grunt-contrib-jshint'); 56 | grunt.loadNpmTasks('grunt-contrib-concat'); 57 | grunt.loadNpmTasks('grunt-contrib-uglify'); 58 | grunt.loadNpmTasks('grunt-jsdoc'); 59 | grunt.loadNpmTasks('grunt-contrib-less'); 60 | //grunt.loadNpmTasks('grunt-contrib-watch'); 61 | 62 | // 每行registerTask定义一个任务 63 | grunt.registerTask('default', ['concat', 'uglify']); 64 | grunt.registerTask('check', ['jshint']); 65 | grunt.registerTask('lessc', ['less']); 66 | grunt.registerTask('doc', ['jsdoc']); 67 | 68 | }; -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/monokai.css: -------------------------------------------------------------------------------- 1 | /* 2 | Monokai style - ported by Luigi Maselli - http://grigio.org 3 | */ 4 | 5 | .hljs { 6 | display: block; padding: 0.5em; 7 | background: #272822; 8 | } 9 | 10 | .hljs-tag, 11 | .hljs-tag .hljs-title, 12 | .hljs-keyword, 13 | .hljs-literal, 14 | .hljs-strong, 15 | .hljs-change, 16 | .hljs-winutils, 17 | .hljs-flow, 18 | .lisp .hljs-title, 19 | .clojure .hljs-built_in, 20 | .nginx .hljs-title, 21 | .tex .hljs-special { 22 | color: #F92672; 23 | } 24 | 25 | .hljs { 26 | color: #DDD; 27 | } 28 | 29 | .hljs .hljs-constant, 30 | .asciidoc .hljs-code { 31 | color: #66D9EF; 32 | } 33 | 34 | .hljs-code, 35 | .hljs-class .hljs-title, 36 | .hljs-header { 37 | color: white; 38 | } 39 | 40 | .hljs-link_label, 41 | .hljs-attribute, 42 | .hljs-symbol, 43 | .hljs-symbol .hljs-string, 44 | .hljs-value, 45 | .hljs-regexp { 46 | color: #BF79DB; 47 | } 48 | 49 | .hljs-link_url, 50 | .hljs-tag .hljs-value, 51 | .hljs-string, 52 | .hljs-bullet, 53 | .hljs-subst, 54 | .hljs-title, 55 | .hljs-emphasis, 56 | .haskell .hljs-type, 57 | .hljs-preprocessor, 58 | .hljs-pragma, 59 | .ruby .hljs-class .hljs-parent, 60 | .hljs-built_in, 61 | .sql .hljs-aggregate, 62 | .django .hljs-template_tag, 63 | .django .hljs-variable, 64 | .smalltalk .hljs-class, 65 | .hljs-javadoc, 66 | .django .hljs-filter .hljs-argument, 67 | .smalltalk .hljs-localvars, 68 | .smalltalk .hljs-array, 69 | .hljs-attr_selector, 70 | .hljs-pseudo, 71 | .hljs-addition, 72 | .hljs-stream, 73 | .hljs-envvar, 74 | .apache .hljs-tag, 75 | .apache .hljs-cbracket, 76 | .tex .hljs-command, 77 | .hljs-prompt { 78 | color: #A6E22E; 79 | } 80 | 81 | .hljs-comment, 82 | .java .hljs-annotation, 83 | .smartquote, 84 | .hljs-blockquote, 85 | .hljs-horizontal_rule, 86 | .python .hljs-decorator, 87 | .hljs-template_comment, 88 | .hljs-pi, 89 | .hljs-doctype, 90 | .hljs-deletion, 91 | .hljs-shebang, 92 | .apache .hljs-sqbracket, 93 | .tex .hljs-formula { 94 | color: #75715E; 95 | } 96 | 97 | .hljs-keyword, 98 | .hljs-literal, 99 | .css .hljs-id, 100 | .hljs-phpdoc, 101 | .hljs-title, 102 | .hljs-header, 103 | .haskell .hljs-type, 104 | .vbscript .hljs-built_in, 105 | .sql .hljs-aggregate, 106 | .rsl .hljs-built_in, 107 | .smalltalk .hljs-class, 108 | .diff .hljs-header, 109 | .hljs-chunk, 110 | .hljs-winutils, 111 | .bash .hljs-variable, 112 | .apache .hljs-tag, 113 | .tex .hljs-special, 114 | .hljs-request, 115 | .hljs-status { 116 | font-weight: bold; 117 | } 118 | 119 | .coffeescript .javascript, 120 | .javascript .xml, 121 | .tex .hljs-formula, 122 | .xml .javascript, 123 | .xml .vbscript, 124 | .xml .css, 125 | .xml .hljs-cdata { 126 | opacity: 0.5; 127 | } 128 | -------------------------------------------------------------------------------- /server/data/user.js: -------------------------------------------------------------------------------- 1 | var util = require("util"), BaseData = require("./base"), mongoose = require('mongoose'), kits = require("../kits"); function UserData(schema) { this.Schema = schema; BaseData.call(this, mongoose.model("user", schema)); /** * add user * @param name * @param email * @param password * @param callback */ this.add = function (name, email, password, callback) { var salt = kits.utils.short_guid(); var db_password = kits.utils.md5(password + salt); var user = new this.model({ id : kits.utils.short_guid(), name : name, email : email, password: db_password, salt : salt, role : kits.constant.user.role.supper_admin }); user.save(function (err) { return callback(err); }); }; this.update = function (uid, name, desc, callback) { var update = { $set: { name : name, desc : desc, update_date: new Date().getTime() } }; this.model.update({id: uid}, update, callback); }; this.update_avatar = function (uid, type, path, callback) { var update = { $set: { avatar : { type: type, path: path }, update_date: new Date().getTime() } }; this.model.update({id: uid}, update, callback); }; this.update_passowrd = function (uid, password, callback) { var update = { $set: { password : password, update_date: new Date().getTime() } }; this.model.update({id: uid}, update, callback); }; /** * check user by name and email * @param name * @param email * @param callback */ this.check = function (name, email, callback) { var name_pattern = '^' + name + '$'; var email_pattern = '^' + email + '$'; if (email.indexOf("+") >= 0) { email_pattern = email_pattern.replace(/\+/i, "\\+"); } var query = { "$or" : [ { name: {$regex: name_pattern, $options: 'i'}}, { email: {$regex: email_pattern, $options: 'i'}} ], is_deleted: 0 }; this.model.findOne(query, function (err, user) { return callback(err, user); }); }; this.get_list_by_uids = function (uids, callback) { this.model.find({id: {$in: uids}, is_deleted: kits.constant.is_deleted.no}, callback); }; this.get_or_create = function (profile, callback) { callback(null, profile); } }; util.inherits(UserData, BaseData); module.exports = UserData; -------------------------------------------------------------------------------- /web/view/post/post_edit.html: -------------------------------------------------------------------------------- 1 |
2 |
4 | 5 |
6 |
7 | 9 | 12 | 13 | 16 | 17 |
18 |
19 |
20 |
21 |
22 | 23 | 45 |
46 |
47 | -------------------------------------------------------------------------------- /server/api/index.js: -------------------------------------------------------------------------------- 1 | /*global exports,require*/ (function () { "use strict"; var config = require("../config"), kits = require("../kits"), data = require("../data"), uuid = require('node-uuid'); module.exports = { user: require("./user"), post: require("./post"), book: { get_list: function (req, res) { var page = req.param("page"), size = req.param("size"); if (!page) { page = 1; } else { page = parseInt(page, 10); } if (size) { size = parseInt(size, 10); } else { size = 20; } res.setHeader("Access-Control-Allow-Origin", "*"); var books = []; for (var i = (page - 1) * size; i < page * size; i++) { books.push({ id : i + 1, name: "Book Name " + i + 1 }); } res.setHeader("x-item-count", 1000000); res.send(books); }, add_list: function (req, res) { res.setHeader("Access-Control-Allow-Origin", "*"); var body = req.body; if (!body.books) { body.books = []; } _.each(body.books, function (book, index) { book.id = 1000000 + index + 1; }); res.send(body.books); }, add : function (req, res) { res.setHeader("Access-Control-Allow-Origin", "*"); var name = req.param("name"); res.send({name: name, id: 1000001}); }, update : function (req, res) { res.setHeader("Access-Control-Allow-Origin", "*"); var name = req.param("name"), bid = req.param("bid"); res.send({name: name, id: bid}); }, delete : function (req, res) { var bid = req.param("bid"); res.send(200); }, upload : function (req, res) { res.setHeader("Access-Control-Allow-Origin", "*"); var formidable = require('formidable'), util = require('util'); var form = new formidable.IncomingForm(); form.maxFieldsSize = 2 * 1024 * 1024; form.parse(req, function(err, fields, files) { res.status(200); res.json({'success': true}); }); }, check:function(req,res){ res.setHeader("Access-Control-Allow-Origin", "*"); var name = req.param("name"); if(name === "why520crazy"){ return res.send(true); } return res.send(false); } } } })(); -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/googlecode.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Google Code style (c) Aahan Krish 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | background: white; color: black; 10 | } 11 | 12 | .hljs-comment, 13 | .hljs-template_comment, 14 | .hljs-javadoc, 15 | .hljs-comment * { 16 | color: #800; 17 | } 18 | 19 | .hljs-keyword, 20 | .method, 21 | .hljs-list .hljs-title, 22 | .clojure .hljs-built_in, 23 | .nginx .hljs-title, 24 | .hljs-tag .hljs-title, 25 | .setting .hljs-value, 26 | .hljs-winutils, 27 | .tex .hljs-command, 28 | .http .hljs-title, 29 | .hljs-request, 30 | .hljs-status { 31 | color: #008; 32 | } 33 | 34 | .hljs-envvar, 35 | .tex .hljs-special { 36 | color: #660; 37 | } 38 | 39 | .hljs-string, 40 | .hljs-tag .hljs-value, 41 | .hljs-cdata, 42 | .hljs-filter .hljs-argument, 43 | .hljs-attr_selector, 44 | .apache .hljs-cbracket, 45 | .hljs-date, 46 | .hljs-regexp, 47 | .coffeescript .hljs-attribute { 48 | color: #080; 49 | } 50 | 51 | .hljs-sub .hljs-identifier, 52 | .hljs-pi, 53 | .hljs-tag, 54 | .hljs-tag .hljs-keyword, 55 | .hljs-decorator, 56 | .ini .hljs-title, 57 | .hljs-shebang, 58 | .hljs-prompt, 59 | .hljs-hexcolor, 60 | .hljs-rules .hljs-value, 61 | .css .hljs-value .hljs-number, 62 | .hljs-literal, 63 | .hljs-symbol, 64 | .ruby .hljs-symbol .hljs-string, 65 | .hljs-number, 66 | .css .hljs-function, 67 | .clojure .hljs-attribute { 68 | color: #066; 69 | } 70 | 71 | .hljs-class .hljs-title, 72 | .haskell .hljs-type, 73 | .smalltalk .hljs-class, 74 | .hljs-javadoctag, 75 | .hljs-yardoctag, 76 | .hljs-phpdoc, 77 | .hljs-typename, 78 | .hljs-tag .hljs-attribute, 79 | .hljs-doctype, 80 | .hljs-class .hljs-id, 81 | .hljs-built_in, 82 | .setting, 83 | .hljs-params, 84 | .hljs-variable, 85 | .clojure .hljs-title { 86 | color: #606; 87 | } 88 | 89 | .css .hljs-tag, 90 | .hljs-rules .hljs-property, 91 | .hljs-pseudo, 92 | .hljs-subst { 93 | color: #000; 94 | } 95 | 96 | .css .hljs-class, 97 | .css .hljs-id { 98 | color: #9B703F; 99 | } 100 | 101 | .hljs-value .hljs-important { 102 | color: #ff7700; 103 | font-weight: bold; 104 | } 105 | 106 | .hljs-rules .hljs-keyword { 107 | color: #C5AF75; 108 | } 109 | 110 | .hljs-annotation, 111 | .apache .hljs-sqbracket, 112 | .nginx .hljs-built_in { 113 | color: #9B859D; 114 | } 115 | 116 | .hljs-preprocessor, 117 | .hljs-preprocessor *, 118 | .hljs-pragma { 119 | color: #444; 120 | } 121 | 122 | .tex .hljs-formula { 123 | background-color: #EEE; 124 | font-style: italic; 125 | } 126 | 127 | .diff .hljs-header, 128 | .hljs-chunk { 129 | color: #808080; 130 | font-weight: bold; 131 | } 132 | 133 | .diff .hljs-change { 134 | background-color: #BCCFF9; 135 | } 136 | 137 | .hljs-addition { 138 | background-color: #BAEEBA; 139 | } 140 | 141 | .hljs-deletion { 142 | background-color: #FFC8BD; 143 | } 144 | 145 | .hljs-comment .hljs-yardoctag { 146 | font-weight: bold; 147 | } 148 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/tooltip.less: -------------------------------------------------------------------------------- 1 | // 2 | // Tooltips 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .tooltip { 8 | position: absolute; 9 | z-index: @zindex-tooltip; 10 | display: block; 11 | visibility: visible; 12 | font-size: @font-size-small; 13 | line-height: 1.4; 14 | .opacity(0); 15 | 16 | &.in { .opacity(@tooltip-opacity); } 17 | &.top { margin-top: -3px; padding: @tooltip-arrow-width 0; } 18 | &.right { margin-left: 3px; padding: 0 @tooltip-arrow-width; } 19 | &.bottom { margin-top: 3px; padding: @tooltip-arrow-width 0; } 20 | &.left { margin-left: -3px; padding: 0 @tooltip-arrow-width; } 21 | } 22 | 23 | // Wrapper for the tooltip content 24 | .tooltip-inner { 25 | max-width: @tooltip-max-width; 26 | padding: 3px 8px; 27 | color: @tooltip-color; 28 | text-align: center; 29 | text-decoration: none; 30 | background-color: @tooltip-bg; 31 | border-radius: @border-radius-base; 32 | } 33 | 34 | // Arrows 35 | .tooltip-arrow { 36 | position: absolute; 37 | width: 0; 38 | height: 0; 39 | border-color: transparent; 40 | border-style: solid; 41 | } 42 | .tooltip { 43 | &.top .tooltip-arrow { 44 | bottom: 0; 45 | left: 50%; 46 | margin-left: -@tooltip-arrow-width; 47 | border-width: @tooltip-arrow-width @tooltip-arrow-width 0; 48 | border-top-color: @tooltip-arrow-color; 49 | } 50 | &.top-left .tooltip-arrow { 51 | bottom: 0; 52 | left: @tooltip-arrow-width; 53 | border-width: @tooltip-arrow-width @tooltip-arrow-width 0; 54 | border-top-color: @tooltip-arrow-color; 55 | } 56 | &.top-right .tooltip-arrow { 57 | bottom: 0; 58 | right: @tooltip-arrow-width; 59 | border-width: @tooltip-arrow-width @tooltip-arrow-width 0; 60 | border-top-color: @tooltip-arrow-color; 61 | } 62 | &.right .tooltip-arrow { 63 | top: 50%; 64 | left: 0; 65 | margin-top: -@tooltip-arrow-width; 66 | border-width: @tooltip-arrow-width @tooltip-arrow-width @tooltip-arrow-width 0; 67 | border-right-color: @tooltip-arrow-color; 68 | } 69 | &.left .tooltip-arrow { 70 | top: 50%; 71 | right: 0; 72 | margin-top: -@tooltip-arrow-width; 73 | border-width: @tooltip-arrow-width 0 @tooltip-arrow-width @tooltip-arrow-width; 74 | border-left-color: @tooltip-arrow-color; 75 | } 76 | &.bottom .tooltip-arrow { 77 | top: 0; 78 | left: 50%; 79 | margin-left: -@tooltip-arrow-width; 80 | border-width: 0 @tooltip-arrow-width @tooltip-arrow-width; 81 | border-bottom-color: @tooltip-arrow-color; 82 | } 83 | &.bottom-left .tooltip-arrow { 84 | top: 0; 85 | left: @tooltip-arrow-width; 86 | border-width: 0 @tooltip-arrow-width @tooltip-arrow-width; 87 | border-bottom-color: @tooltip-arrow-color; 88 | } 89 | &.bottom-right .tooltip-arrow { 90 | top: 0; 91 | right: @tooltip-arrow-width; 92 | border-width: 0 @tooltip-arrow-width @tooltip-arrow-width; 93 | border-bottom-color: @tooltip-arrow-color; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /web/static/lib/bootstrap/3.1.1/less/scaffolding.less: -------------------------------------------------------------------------------- 1 | // 2 | // Scaffolding 3 | // -------------------------------------------------- 4 | 5 | 6 | // Reset the box-sizing 7 | // 8 | // Heads up! This reset may cause conflicts with some third-party widgets. 9 | // For recommendations on resolving such conflicts, see 10 | // http://getbootstrap.com/getting-started/#third-box-sizing 11 | * { 12 | .box-sizing(border-box); 13 | } 14 | *:before, 15 | *:after { 16 | .box-sizing(border-box); 17 | } 18 | 19 | 20 | // Body reset 21 | 22 | html { 23 | font-size: 62.5%; 24 | -webkit-tap-highlight-color: rgba(0,0,0,0); 25 | } 26 | 27 | body { 28 | font-family: @font-family-base; 29 | font-size: @font-size-base; 30 | line-height: @line-height-base; 31 | color: @text-color; 32 | background-color: @body-bg; 33 | } 34 | 35 | // Reset fonts for relevant elements 36 | input, 37 | button, 38 | select, 39 | textarea { 40 | font-family: inherit; 41 | font-size: inherit; 42 | line-height: inherit; 43 | } 44 | 45 | 46 | // Links 47 | 48 | a { 49 | color: @link-color; 50 | text-decoration: none; 51 | 52 | &:hover, 53 | &:focus { 54 | color: @link-hover-color; 55 | text-decoration: underline; 56 | } 57 | 58 | &:focus { 59 | .tab-focus(); 60 | } 61 | } 62 | 63 | 64 | // Figures 65 | // 66 | // We reset this here because previously Normalize had no `figure` margins. This 67 | // ensures we don't break anyone's use of the element. 68 | 69 | figure { 70 | margin: 0; 71 | } 72 | 73 | 74 | // Images 75 | 76 | img { 77 | vertical-align: middle; 78 | } 79 | 80 | // Responsive images (ensure images don't scale beyond their parents) 81 | .img-responsive { 82 | .img-responsive(); 83 | } 84 | 85 | // Rounded corners 86 | .img-rounded { 87 | border-radius: @border-radius-large; 88 | } 89 | 90 | // Image thumbnails 91 | // 92 | // Heads up! This is mixin-ed into thumbnails.less for `.thumbnail`. 93 | .img-thumbnail { 94 | padding: @thumbnail-padding; 95 | line-height: @line-height-base; 96 | background-color: @thumbnail-bg; 97 | border: 1px solid @thumbnail-border; 98 | border-radius: @thumbnail-border-radius; 99 | .transition(all .2s ease-in-out); 100 | 101 | // Keep them at most 100% wide 102 | .img-responsive(inline-block); 103 | } 104 | 105 | // Perfect circle 106 | .img-circle { 107 | border-radius: 50%; // set radius in percents 108 | } 109 | 110 | 111 | // Horizontal rules 112 | 113 | hr { 114 | margin-top: @line-height-computed; 115 | margin-bottom: @line-height-computed; 116 | border: 0; 117 | border-top: 1px solid @hr-border; 118 | } 119 | 120 | 121 | // Only display content to screen readers 122 | // 123 | // See: http://a11yproject.com/posts/how-to-hide-content/ 124 | 125 | .sr-only { 126 | position: absolute; 127 | width: 1px; 128 | height: 1px; 129 | margin: -1px; 130 | padding: 0; 131 | overflow: hidden; 132 | clip: rect(0,0,0,0); 133 | border: 0; 134 | } 135 | -------------------------------------------------------------------------------- /web/static/js/main.js: -------------------------------------------------------------------------------- 1 | /*global ngNice*/ 2 | (function () { 3 | 4 | var requires = ['ui.bootstrap', 'w5c.validator']; 5 | var ngApp = ngNice.ngApp = angular.module("app", requires); 6 | 7 | ngApp.config(['$httpProvider', 'w5cValidatorProvider', function ($httpProvider, w5cValidatorProvider) { 8 | w5cValidatorProvider.config({ 9 | blurTrig : false, 10 | showError : function () { 11 | }, 12 | removeError: function () { 13 | } 14 | }); 15 | w5cValidatorProvider.setRules({ 16 | user_name : { 17 | required: "输入的用户名不能为空", 18 | pattern : "用户名必须输入字母、数字、下划线,以字母开头" 19 | }, 20 | user_password : { 21 | required: "输入的密码不能为空" 22 | }, 23 | user_email : { 24 | required: "输入的用邮箱地址不能为空", 25 | email : "邮箱格式不正确" 26 | }, 27 | repeat_password : { 28 | repeat: "两次填写的密码不一致" 29 | }, 30 | user_original_pwd: { 31 | required: "输入的原始密码不能为空" 32 | }, 33 | user_new_pwd : { 34 | required: "输入的新密码不能为空" 35 | } 36 | }); 37 | 38 | marked.setOptions({ 39 | renderer : new marked.Renderer(), 40 | gfm : true, 41 | tables : true, 42 | breaks : true, 43 | pedantic : false, 44 | sanitize : true, 45 | smartLists : true, 46 | smartypants: false 47 | }); 48 | 49 | $httpProvider.responseInterceptors.push(["$q", function ($q) { 50 | return function (promise) { 51 | return promise.then(function (response) { 52 | if (response.config.url.toLowerCase().indexOf("/api/") >= 0 && (!response.data || response.data.code !== ngNice.status.ok)) { 53 | return $q.reject(response); 54 | } 55 | return response; 56 | }, function (response) { 57 | return $q.reject(response); 58 | }); 59 | }; 60 | }]); 61 | }]).value("config", { 62 | pageSize : 20, 63 | categories: [ 64 | {name: "默认", value: 0}, 65 | {name: "AngularJS", value: 1}, 66 | {name: "NodeJS", value: 2}, 67 | {name: "Javascript", value: 3}, 68 | {name: "技术架构", value: 4} 69 | ] 70 | }).run(['$rootScope', function ($rootScope) { 71 | $rootScope.global = { 72 | loading_done: false 73 | }; 74 | $('pre code').each(function (i, block) { 75 | hljs.highlightBlock(block); 76 | }); 77 | $('.height-no-header').height($(window).height() - 70); 78 | $('[data-height]').each(function () { 79 | var exHeight = parseInt($(window).height() - $(this).attr('data-height'), 10); 80 | $(this).css('height', exHeight); 81 | }); 82 | }]); 83 | })(); -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | /*global require,process,__dirname,console*/ 2 | (function () { 3 | "use strict"; 4 | var express = require('express'), 5 | morgan = require('morgan'), 6 | bodyParser = require('body-parser'), 7 | methodOverride = require('method-override'), 8 | cookieParser = require('cookie-parser'), 9 | expressLayout = require('express3-ejs-layout'), 10 | compression = require('compression'), 11 | app = express(), 12 | route = require("./server/route"), 13 | config = require("./server/config"), 14 | kits = require("./server/kits"), 15 | appPackage = require("./package.json"), 16 | localsApp = { 17 | title : config.title, 18 | version: appPackage.version, 19 | env : config.env, 20 | baseUrl: config.baseUrl 21 | }; 22 | app.use(compression()); 23 | app.use(bodyParser()); 24 | app.use(methodOverride()); 25 | app.use(cookieParser(config.cookieSecret)); 26 | app.set('views', __dirname + '/web/view'); 27 | app.use(express.static(__dirname + '/web/static'));// {maxAge: 31557600000} 28 | app.set('view engine', 'html'); 29 | app.engine('html', require('ejs').renderFile); 30 | app.use(expressLayout); 31 | app.set('layout', 'layout'); 32 | app.set("env", config.env); 33 | app.disable("x-powered-by"); 34 | //启用反向代理 35 | app.enable('trust proxy'); 36 | 37 | morgan.token('data', function (req) { 38 | return "params:" + JSON.stringify(req.params) + ",query:" + JSON.stringify(req.query) + ",body:" + JSON.stringify(req.body); 39 | }); 40 | morgan.token('date', function () { 41 | var now = new Date(); 42 | return now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate() + " " + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(); 43 | }); 44 | morgan.token('operationId', function (req) { 45 | return req.context ? req.context.operationId : "null"; 46 | }); 47 | if ('development' === config.env) { 48 | app.use(morgan({ 49 | format: ':method :url :status :remote-addr [:date][:response-time ms] [:operationId]', 50 | stream: { 51 | write: kits.logger.info 52 | } 53 | })); 54 | localsApp.siteScripts = config.siteScripts; 55 | } else { 56 | app.use(morgan({ 57 | format: ':method :url :status :remote-addr [:date][:response-time ms] [:operationId]', 58 | stream: { 59 | write: kits.logger.info 60 | } 61 | })); 62 | } 63 | 64 | app.locals.app = localsApp; 65 | 66 | //初始化路由 67 | route(app); 68 | 69 | //create server 70 | app.listen(config.port, function () { 71 | kits.logger.info('ng-nice server listening on port ' + config.port + " in env " + config.env); 72 | }); 73 | 74 | if (config.env === 'production') { 75 | process.on("uncaughtException", function (err) { 76 | kits.logger.info("process uncaughtException:" + err); 77 | }); 78 | } 79 | })(); 80 | 81 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/sunburst.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Sunburst-like style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | background: #000; color: #f8f8f8; 10 | } 11 | 12 | .hljs-comment, 13 | .hljs-template_comment, 14 | .hljs-javadoc { 15 | color: #aeaeae; 16 | font-style: italic; 17 | } 18 | 19 | .hljs-keyword, 20 | .ruby .hljs-function .hljs-keyword, 21 | .hljs-request, 22 | .hljs-status, 23 | .nginx .hljs-title { 24 | color: #E28964; 25 | } 26 | 27 | .hljs-function .hljs-keyword, 28 | .hljs-sub .hljs-keyword, 29 | .method, 30 | .hljs-list .hljs-title { 31 | color: #99CF50; 32 | } 33 | 34 | .hljs-string, 35 | .hljs-tag .hljs-value, 36 | .hljs-cdata, 37 | .hljs-filter .hljs-argument, 38 | .hljs-attr_selector, 39 | .apache .hljs-cbracket, 40 | .hljs-date, 41 | .tex .hljs-command, 42 | .coffeescript .hljs-attribute { 43 | color: #65B042; 44 | } 45 | 46 | .hljs-subst { 47 | color: #DAEFA3; 48 | } 49 | 50 | .hljs-regexp { 51 | color: #E9C062; 52 | } 53 | 54 | .hljs-title, 55 | .hljs-sub .hljs-identifier, 56 | .hljs-pi, 57 | .hljs-tag, 58 | .hljs-tag .hljs-keyword, 59 | .hljs-decorator, 60 | .hljs-shebang, 61 | .hljs-prompt { 62 | color: #89BDFF; 63 | } 64 | 65 | .hljs-class .hljs-title, 66 | .haskell .hljs-type, 67 | .smalltalk .hljs-class, 68 | .hljs-javadoctag, 69 | .hljs-yardoctag, 70 | .hljs-phpdoc { 71 | text-decoration: underline; 72 | } 73 | 74 | .hljs-symbol, 75 | .ruby .hljs-symbol .hljs-string, 76 | .hljs-number { 77 | color: #3387CC; 78 | } 79 | 80 | .hljs-params, 81 | .hljs-variable, 82 | .clojure .hljs-attribute { 83 | color: #3E87E3; 84 | } 85 | 86 | .css .hljs-tag, 87 | .hljs-rules .hljs-property, 88 | .hljs-pseudo, 89 | .tex .hljs-special { 90 | color: #CDA869; 91 | } 92 | 93 | .css .hljs-class { 94 | color: #9B703F; 95 | } 96 | 97 | .hljs-rules .hljs-keyword { 98 | color: #C5AF75; 99 | } 100 | 101 | .hljs-rules .hljs-value { 102 | color: #CF6A4C; 103 | } 104 | 105 | .css .hljs-id { 106 | color: #8B98AB; 107 | } 108 | 109 | .hljs-annotation, 110 | .apache .hljs-sqbracket, 111 | .nginx .hljs-built_in { 112 | color: #9B859D; 113 | } 114 | 115 | .hljs-preprocessor, 116 | .hljs-pragma { 117 | color: #8996A8; 118 | } 119 | 120 | .hljs-hexcolor, 121 | .css .hljs-value .hljs-number { 122 | color: #DD7B3B; 123 | } 124 | 125 | .css .hljs-function { 126 | color: #DAD085; 127 | } 128 | 129 | .diff .hljs-header, 130 | .hljs-chunk, 131 | .tex .hljs-formula { 132 | background-color: #0E2231; 133 | color: #F8F8F8; 134 | font-style: italic; 135 | } 136 | 137 | .diff .hljs-change { 138 | background-color: #4A410D; 139 | color: #F8F8F8; 140 | } 141 | 142 | .hljs-addition { 143 | background-color: #253B22; 144 | color: #F8F8F8; 145 | } 146 | 147 | .hljs-deletion { 148 | background-color: #420E09; 149 | color: #F8F8F8; 150 | } 151 | 152 | .coffeescript .javascript, 153 | .javascript .xml, 154 | .tex .hljs-formula, 155 | .xml .javascript, 156 | .xml .vbscript, 157 | .xml .css, 158 | .xml .hljs-cdata { 159 | opacity: 0.5; 160 | } 161 | -------------------------------------------------------------------------------- /web/static/lib/highlight/8.0/styles/monokai_sublime.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/ 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | padding: 0.5em; 10 | background: #23241f; 11 | } 12 | 13 | .hljs, 14 | .hljs-tag, 15 | .css .hljs-rules, 16 | .css .hljs-value, 17 | .css .hljs-function 18 | .hljs-preprocessor, 19 | .hljs-pragma { 20 | color: #f8f8f2; 21 | } 22 | 23 | .hljs-strongemphasis, 24 | .hljs-strong, 25 | .hljs-emphasis { 26 | color: #a8a8a2; 27 | } 28 | 29 | .hljs-bullet, 30 | .hljs-blockquote, 31 | .hljs-horizontal_rule, 32 | .hljs-number, 33 | .hljs-regexp, 34 | .alias .hljs-keyword, 35 | .hljs-literal, 36 | .hljs-hexcolor { 37 | color: #ae81ff; 38 | } 39 | 40 | .hljs-tag .hljs-value, 41 | .hljs-code, 42 | .hljs-title, 43 | .css .hljs-class, 44 | .hljs-class .hljs-title:last-child { 45 | color: #a6e22e; 46 | } 47 | 48 | .hljs-link_url { 49 | font-size: 80%; 50 | } 51 | 52 | .hljs-strong, 53 | .hljs-strongemphasis { 54 | font-weight: bold; 55 | } 56 | 57 | .hljs-emphasis, 58 | .hljs-strongemphasis, 59 | .hljs-class .hljs-title:last-child { 60 | font-style: italic; 61 | } 62 | 63 | .hljs-keyword, 64 | .hljs-function, 65 | .hljs-change, 66 | .hljs-winutils, 67 | .hljs-flow, 68 | .lisp .hljs-title, 69 | .clojure .hljs-built_in, 70 | .nginx .hljs-title, 71 | .tex .hljs-special, 72 | .hljs-header, 73 | .hljs-attribute, 74 | .hljs-symbol, 75 | .hljs-symbol .hljs-string, 76 | .hljs-tag .hljs-title, 77 | .hljs-value, 78 | .alias .hljs-keyword:first-child, 79 | .css .hljs-tag, 80 | .css .unit, 81 | .css .hljs-important { 82 | color: #F92672; 83 | } 84 | 85 | .hljs-function .hljs-keyword, 86 | .hljs-class .hljs-keyword:first-child, 87 | .hljs-constant, 88 | .css .hljs-attribute { 89 | color: #66d9ef; 90 | } 91 | 92 | .hljs-variable, 93 | .hljs-params, 94 | .hljs-class .hljs-title { 95 | color: #f8f8f2; 96 | } 97 | 98 | .hljs-string, 99 | .css .hljs-id, 100 | .hljs-subst, 101 | .haskell .hljs-type, 102 | .ruby .hljs-class .hljs-parent, 103 | .hljs-built_in, 104 | .sql .hljs-aggregate, 105 | .django .hljs-template_tag, 106 | .django .hljs-variable, 107 | .smalltalk .hljs-class, 108 | .django .hljs-filter .hljs-argument, 109 | .smalltalk .hljs-localvars, 110 | .smalltalk .hljs-array, 111 | .hljs-attr_selector, 112 | .hljs-pseudo, 113 | .hljs-addition, 114 | .hljs-stream, 115 | .hljs-envvar, 116 | .apache .hljs-tag, 117 | .apache .hljs-cbracket, 118 | .tex .hljs-command, 119 | .hljs-prompt, 120 | .hljs-link_label, 121 | .hljs-link_url { 122 | color: #e6db74; 123 | } 124 | 125 | .hljs-comment, 126 | .hljs-javadoc, 127 | .java .hljs-annotation, 128 | .python .hljs-decorator, 129 | .hljs-template_comment, 130 | .hljs-pi, 131 | .hljs-doctype, 132 | .hljs-deletion, 133 | .hljs-shebang, 134 | .apache .hljs-sqbracket, 135 | .tex .hljs-formula { 136 | color: #75715e; 137 | } 138 | 139 | .coffeescript .javascript, 140 | .javascript .xml, 141 | .tex .hljs-formula, 142 | .xml .javascript, 143 | .xml .vbscript, 144 | .xml .css, 145 | .xml .hljs-cdata, 146 | .xml .php, 147 | .php .xml { 148 | opacity: 0.5; 149 | } 150 | --------------------------------------------------------------------------------