├── README.md
├── app.js
├── bin
└── www
├── controllers
├── commentControllers.js
├── postControllers.js
└── userControllers.js
├── package-lock.json
├── package.json
├── public
├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ └── glyphicons-halflings-regular.woff
├── images
│ ├── info.png
│ ├── info2.png
│ ├── info3.png
│ └── member.jpg
├── javascripts
│ ├── app.js
│ ├── bootstrap.js
│ ├── bootstrap.min.js
│ ├── controllers.js
│ ├── directive.js
│ ├── encryption.js
│ ├── npm.js
│ ├── service.js
│ └── validdata.js
├── stylesheets
│ ├── style.css
│ └── textAngular.css
└── template
│ ├── listPost.html
│ ├── myblog.html
│ ├── noSignin.html
│ ├── paging.html
│ ├── postDetail.html
│ ├── signin.html
│ ├── signup.html
│ └── writePost.html
├── routes
├── comments.js
├── index.js
├── post.js
└── users.js
└── views
└── index.html
/README.md:
--------------------------------------------------------------------------------
1 | # angular_blog
2 | This is Mean Stack Blog.
3 | You can insert blog and show this.
4 | admin can permit display blog.
5 |
6 | # How to install Blog
7 |
8 | ## 1).Install mongodb-win32-x86_64-2008plus-ssl-3.4.6-signed
9 | ## 2).Select db file in CMD or terminal.
10 | Create Falder C:/db.
11 | and write fallow command in CMD or terminal.
12 | C:\Program Files\MongoDB\Server\3.4\bin>mongod --dbpath c:\db
13 | ## 3).install node_modules
14 | npm install
15 | npm install express
16 | npm install path
17 | npm install serve-favicon
18 | npm install morgan
19 | npm install cookie-parser
20 | npm install body-parser
21 | npm install mongod
22 | npm start
23 |
24 | ## 4).you can show this result.
25 | localhost: 5000
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var path = require('path');
3 | var favicon = require('serve-favicon');
4 | var logger = require('morgan');
5 | var cookieParser = require('cookie-parser');
6 | var bodyParser = require('body-parser');
7 | module.exports = function(db) {
8 |
9 | var index = require('./routes/index')(db);
10 | var users = require('./routes/users')(db);
11 | var post = require('./routes/post')(db);
12 | var comments = require('./routes/comments')(db);
13 | var app = express();
14 |
15 | // view engine setup
16 | app.set('views', path.join(__dirname, 'views'));
17 | app.set('view engine', 'jade');
18 |
19 | // uncomment after placing your favicon in /public
20 | //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
21 | app.use(logger('dev'));
22 | app.use(bodyParser.json());
23 | app.use(bodyParser.urlencoded({ extended: false }));
24 | app.use(cookieParser());
25 | app.use(express.static(path.join(__dirname, 'public')));
26 |
27 | app.use('/', index);
28 | app.use('/users', users);
29 | app.use('/posts', post);
30 | app.use('/comments', comments);
31 | // catch 404 and forward to error handler
32 | app.use(function(req, res, next) {
33 | var err = new Error('Not Found');
34 | err.status = 404;
35 | next(err);
36 | });
37 |
38 | // error handler
39 | app.use(function(err, req, res, next) {
40 | // set locals, only providing error in development
41 | res.locals.message = err.message;
42 | res.locals.error = req.app.get('env') === 'development' ? err : {};
43 | console.log(err.message);
44 | // render the error page
45 | res.status(err.status || 500);
46 | res.send(err.message);
47 | });
48 | return app;
49 | };
--------------------------------------------------------------------------------
/bin/www:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /**
4 | * Module dependencies.
5 | */
6 | var debug = require('debug')('blog:server');
7 | var http = require('http');
8 | var mongoClient = require('mongodb').MongoClient;
9 | var mongoUrl = 'mongodb://localhost:27017/zlfData';
10 | /**
11 | * Get port from environment and store in Express.
12 | */
13 | mongoClient.connect(mongoUrl).catch(function(error) {
14 | console.log('请先开mongodb');
15 | debug("Connect to mongodb " + mongoUrl + " failed with error: ", error);
16 | }).then(function(db) {
17 | var app = require('../app')(db);
18 | var port = normalizePort(process.env.PORT || '5000');
19 | app.set('port', port);
20 | console.log('已启动, 端口: 5000');
21 | console.log('管理员账号密码为 admin');
22 | /**
23 | * Create HTTP server.
24 | */
25 |
26 | var server = http.createServer(app);
27 |
28 | /**
29 | * Listen on provided port, on all network interfaces.
30 | */
31 |
32 | server.listen(port);
33 | server.on('error', onError);
34 | server.on('listening', onListening);
35 |
36 | /**
37 | * Normalize a port into a number, string, or false.
38 | */
39 |
40 | function normalizePort(val) {
41 | var port = parseInt(val, 10);
42 |
43 | if (isNaN(port)) {
44 | // named pipe
45 | return val;
46 | }
47 |
48 | if (port >= 0) {
49 | // port number
50 | return port;
51 | }
52 |
53 | return false;
54 | }
55 |
56 | /**
57 | * Event listener for HTTP server "error" event.
58 | */
59 |
60 | function onError(error) {
61 | if (error.syscall !== 'listen') {
62 | throw error;
63 | }
64 |
65 | var bind = typeof port === 'string'
66 | ? 'Pipe ' + port
67 | : 'Port ' + port;
68 |
69 | // handle specific listen errors with friendly messages
70 | switch (error.code) {
71 | case 'EACCES':
72 | console.error(bind + ' requires elevated privileges');
73 | process.exit(1);
74 | break;
75 | case 'EADDRINUSE':
76 | console.error(bind + ' is already in use');
77 | process.exit(1);
78 | break;
79 | default:
80 | throw error;
81 | }
82 | }
83 |
84 | /**
85 | * Event listener for HTTP server "listening" event.
86 | */
87 |
88 | function onListening() {
89 | var addr = server.address();
90 | var bind = typeof addr === 'string'
91 | ? 'pipe ' + addr
92 | : 'port ' + addr.port;
93 | debug('Listening on ' + bind);
94 | }
95 |
96 | });
97 |
--------------------------------------------------------------------------------
/controllers/commentControllers.js:
--------------------------------------------------------------------------------
1 | var ObjectID = require('mongodb').ObjectID;
2 |
3 |
4 | module.exports = function (db) {
5 | var comments = db.collection('comments');
6 | var commentController = {
7 | getComment: function(dataJson) {
8 | return comments.find(dataJson).toArray().then(function(CommentArr) {
9 | return Promise.resolve(CommentArr);
10 | }).catch(function(err) {
11 | return Promise.reject(err);
12 | });
13 | },
14 | addComment: function(dataJson) {
15 | return new Promise(function(resolve, reject) {
16 | if (dataJson.content !== '') {
17 | comments.insert(dataJson);
18 | resolve();
19 | } else {
20 | reject("请从评论框输入评论,并不能为空");
21 | }
22 | });
23 | },
24 | deleteComment: function(dataJson) {
25 | return new Promise(function(resolve, reject) {
26 | comments.findOne({_id: ObjectID(dataJson._id)}).then(function(foundComment) {
27 | comments.remove(foundComment);
28 | resolve();
29 | }).catch(function(error) {
30 | reject();
31 | });
32 | });
33 | },
34 | editCommentstatus: function(dataJson) {
35 | return makeisEditfalse().then(function() {
36 | comments.findOne({_id: ObjectID(dataJson._id)}).then(function(foundComment) {
37 | comments.update({"_id" : ObjectID(dataJson._id)}, {$set: {"isEdit" : true}});
38 | return Promise.resolve();
39 | }).catch(function(err) {
40 | return Promise.reject(err);
41 | });
42 | });
43 | },
44 | editComment: function(dataJson) {
45 | return new Promise(function(resolve, reject) {
46 | if (dataJson.content !== '') {
47 | comments.findOne({_id: ObjectID(dataJson._id)}).then(function() {
48 | comments.update({"_id" : ObjectID(dataJson._id)}, {$set: {"content": dataJson.content, "isEdit": false}});
49 | resolve();
50 | }).catch(function(err) {
51 | reject(err);
52 | });
53 | } else {
54 | reject('请从评论框输入评论,并不能为空');
55 | }
56 | });
57 | },
58 | cancel: function(dataJson) {
59 | return new Promise(function(resolve, reject) {
60 | comments.update({isEdit: true}, {$set: {"isEdit" : false}});
61 | resolve();
62 | });
63 | },
64 | hideComment: function(dataJson) {
65 | return new Promise(function(resolve, reject) {
66 | comments.findOne({_id: ObjectID(dataJson._id)}).then(function(foundUser) {
67 | comments.update({"_id" : ObjectID(dataJson._id)}, {$set: {"isHide" : true}});
68 | resolve();
69 | }).catch(function(err) {
70 | reject(err);
71 | });
72 | });
73 | },
74 | showComment: function(dataJson) {
75 | return new Promise(function(resolve, reject) {
76 | comments.findOne({_id: ObjectID(dataJson._id)}).then(function() {
77 | comments.update({"_id" : ObjectID(dataJson._id)}, {$set: {"isHide" : false}});
78 | resolve();
79 | }).catch(function(err) {
80 | reject(err);
81 | });
82 | });
83 | },
84 | cancelAll: function() {
85 | return makeisEditfalse();
86 | },
87 | deleteCommentByPost: function(dataJson) {
88 | comments.remove({id: dataJson});
89 | }
90 | };
91 |
92 | function makeisEditfalse() {
93 | return new Promise(function(resolve, reject) {
94 | comments.update({isEdit: true}, {$set: {"isEdit" : false}});
95 | resolve();
96 | });
97 | }
98 | return commentController;
99 | };
100 |
--------------------------------------------------------------------------------
/controllers/postControllers.js:
--------------------------------------------------------------------------------
1 | var ObjectID = require('mongodb').ObjectID;
2 |
3 | module.exports = function(db) {
4 | var post = db.collection('post');
5 | var commentCtrl = require('./commentControllers.js')(db);
6 | post.find({}).toArray().then(function(postArr) {
7 | if (postArr.length === 0) {
8 | post.save({
9 | _id: ObjectID(2222),
10 | title: '示例文章',
11 | content: '示例内容',
12 | date: '2017-01-18 23:59',
13 | author: 'admin',
14 | authorUsername: 'admin',
15 | isHide: false
16 | });
17 | }
18 | });
19 |
20 |
21 | var postController = {
22 | addnewPost: function (newPost) {
23 | if (newPost._id) newPost._id = ObjectID(newPost._id);
24 | return post.save(newPost).then(function() {
25 | return Promise.resolve('success');
26 | }).catch(function() {
27 | return Promise.reject('fail');
28 | });
29 | },
30 | getAllPost: function() {
31 | return new Promise(function(resolve, reject) {
32 | post.find({}, {'content': 0}).sort({"date": -1}).toArray().then(function(PostArr) {
33 | resolve(PostArr);
34 | }).catch(function(err) {
35 | reject(err);
36 | });
37 | });
38 | },
39 | getPostById: function(dataJson) {
40 | return new Promise(function(resolve, reject) {
41 | post.findOne({_id: ObjectID(dataJson._id)}, {'content': 0}).then(function(foundPost) {
42 | resolve(foundPost);
43 | }).catch(function() {
44 | reject("no exist");
45 | });
46 | });
47 | },
48 | getPostByAuthor: function(dataJson) {
49 | return new Promise(function(resolve, reject) {
50 | post.find({'authorUsername': dataJson}, {'content': 0}).sort({"date": -1}).toArray().then(function(PostArr) {
51 | resolve(PostArr);
52 | }).catch(function(err) {
53 | rejecte(err);
54 | });
55 | });
56 | },
57 | deletePost: function (dataJson) {
58 | return new Promise(function(resolve, reject) {
59 | post.findOne({_id: ObjectID(dataJson._id)}).then(function(foundPost) {
60 | post.remove(foundPost);
61 | commentCtrl.deleteCommentByPost(dataJson._id);
62 | resolve();
63 | }).catch(function(err) {
64 | reject(err);
65 | });
66 | });
67 | },
68 | getPostByKeyWord: function(dataJson) {
69 | return new Promise(function(resolve, reject) {
70 | post.find({"title": {$regex: dataJson.keyWord, $options: "i"}}).sort({"date": -1}).toArray().then(function(PostArr) {
71 | resolve(PostArr);
72 | }).catch(function(err) {
73 | reject("Not Found");
74 | });
75 | });
76 | },
77 | getPostContent: function(dataJson) {
78 | return new Promise(function(resolve, reject) {
79 | post.findOne({_id: ObjectID(dataJson._id)}, {'content': 1}).then(function(foundPost) {
80 | resolve(foundPost);
81 | }).catch(function() {
82 | reject("no exist");
83 | });
84 | });
85 | },
86 | getPostByKeyWordAndAuthor: function(dataJson) {
87 | return new Promise(function(resolve, reject) {
88 | post.find({"authorUsername": dataJson.authorUsername, "title": {$regex: dataJson.keyWord, $options: "i"}}).sort({"date": -1}).toArray().then(function(PostArr) {
89 | resolve(PostArr);
90 | }).catch(function(err) {
91 | reject("Not Found");
92 | });
93 | });
94 | },
95 | showPost: function(dataJson) {
96 | return new Promise(function(resolve, reject) {
97 | post.findOne({_id: ObjectID(dataJson._id)}).then(function(foundPost) {
98 | post.update({"_id" : ObjectID(dataJson._id)}, {$set: {"isHide" : false}});
99 | resolve();
100 | }).catch(function() {
101 | reject();
102 | });
103 | });
104 | },
105 | hidePost: function(dataJson) {
106 | return new Promise(function(resolve, reject) {
107 | post.findOne({_id: ObjectID(dataJson._id)}).then(function(foundPost) {
108 | post.update({"_id" : ObjectID(dataJson._id)}, {$set: {"isHide" : true}});
109 | resolve();
110 | }).catch(function() {
111 | reject();
112 | });
113 | });
114 | }
115 | };
116 |
117 |
118 | return postController;
119 | };
--------------------------------------------------------------------------------
/controllers/userControllers.js:
--------------------------------------------------------------------------------
1 | var validdata = require("../public/javascripts/validdata.js");
2 |
3 | module.exports = function(db) {
4 | var users = db.collection('users');
5 | var admin = {
6 | _id: 11111,
7 | username: "admin",
8 | password: "d033e22ae348aeb5660fc2140aec35850c4da997",
9 | nikiname: 'admin',
10 | email: "admin@qq.com",
11 | isAdmin: true
12 | };
13 | users.find({}).toArray().then(function(userArr) {
14 | if (userArr.length === 0) {
15 | users.insert(admin);
16 | }
17 | });
18 | var userController = {
19 | signupCheck: function(user) {
20 | return checkUser(user).then(function() {
21 | if (user.repassword) delete user.repassword;
22 | users.insert(user);
23 | return new Promise(function(resolve, reject) {
24 | resolve(user);
25 | });
26 | }).catch(function(error) {
27 | return new Promise(function(resolve, reject) {
28 | reject(error);
29 | });
30 | });
31 | },
32 | signinCheck: function(user) {
33 | return new Promise(function(resolve, reject) {
34 | users.findOne({username:user.username}).then(function(foundUser) {
35 | if (foundUser) {
36 | if (foundUser.password == user.password) {
37 | resolve(foundUser);
38 | }
39 | else reject("password");
40 | } else {
41 | reject("username");
42 | }
43 | });
44 | });
45 | },
46 | checkDataUnique: function(value) {
47 | return new Promise(function(resolve, reject) {
48 | users.findOne(value).then(function(foundvalue) {
49 | if (foundvalue) {
50 | reject("no");
51 | } else {
52 | resolve("ok");
53 | }
54 | });
55 | });
56 | },
57 | getUserByName: function(value) {
58 | return new Promise(function(resolve, reject) {
59 | users.findOne({username:value}).then(function(foundUser) {
60 | resolve(foundUser);
61 | }).catch(function() {
62 | reject("该用户不存在");
63 | });
64 | });
65 | }
66 | };
67 | var checkUser = function(user) {
68 | return new Promise(function(resolve, reject) {
69 | var flag = false;
70 | if (validdata.username(user.username) == "ok" && validdata.nikiname(user.nikiname) == "ok" &&
71 | validdata.email(user.email) == "ok" && user.password.length === 40
72 | && user.password != 'da39a3ee5e6b4b0d3255bfef95601890afd80709' && user.password === user.repassword) {
73 | flag = true;
74 | } else {
75 | reject("CheckUser:invalid");
76 | }
77 | if (flag) {
78 | users.findOne({ $or: [
79 | { username: user.username },
80 | { nikiname: user.nikiname },
81 | { email: user.email }
82 | ]}).then(function(foundUser) {
83 | foundUser ? reject('CheckUser:some attributes has been taken by others') : resolve();
84 | });
85 | }
86 | });
87 | };
88 | return userController;
89 | };
90 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "blog",
3 | "version": "0.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "accepts": {
8 | "version": "1.3.3",
9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz",
10 | "integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=",
11 | "requires": {
12 | "mime-types": "2.1.16",
13 | "negotiator": "0.6.1"
14 | }
15 | },
16 | "acorn": {
17 | "version": "2.7.0",
18 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz",
19 | "integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc="
20 | },
21 | "acorn-globals": {
22 | "version": "1.0.9",
23 | "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz",
24 | "integrity": "sha1-VbtemGkVB7dFedBRNBMhfDgMVM8=",
25 | "requires": {
26 | "acorn": "2.7.0"
27 | }
28 | },
29 | "align-text": {
30 | "version": "0.1.4",
31 | "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
32 | "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
33 | "requires": {
34 | "kind-of": "3.2.2",
35 | "longest": "1.0.1",
36 | "repeat-string": "1.6.1"
37 | }
38 | },
39 | "amdefine": {
40 | "version": "1.0.1",
41 | "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
42 | "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU="
43 | },
44 | "array-flatten": {
45 | "version": "1.1.1",
46 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
47 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
48 | },
49 | "asap": {
50 | "version": "1.0.0",
51 | "resolved": "https://registry.npmjs.org/asap/-/asap-1.0.0.tgz",
52 | "integrity": "sha1-sqRdpf36ILBJb8N2jMJ8EvqRan0="
53 | },
54 | "basic-auth": {
55 | "version": "1.0.4",
56 | "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.0.4.tgz",
57 | "integrity": "sha1-Awk1sB3nyblKgksp8/zLdQ06UpA="
58 | },
59 | "body-parser": {
60 | "version": "1.15.2",
61 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.15.2.tgz",
62 | "integrity": "sha1-11eM9PHRHV9uqATO813Hp/9trmc=",
63 | "requires": {
64 | "bytes": "2.4.0",
65 | "content-type": "1.0.2",
66 | "debug": "2.2.0",
67 | "depd": "1.1.1",
68 | "http-errors": "1.5.1",
69 | "iconv-lite": "0.4.13",
70 | "on-finished": "2.3.0",
71 | "qs": "6.2.0",
72 | "raw-body": "2.1.7",
73 | "type-is": "1.6.15"
74 | }
75 | },
76 | "bson": {
77 | "version": "1.0.4",
78 | "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.4.tgz",
79 | "integrity": "sha1-k8ENOeqltYQVy8QFLz5T5WKwtyw="
80 | },
81 | "buffer-shims": {
82 | "version": "1.0.0",
83 | "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz",
84 | "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E="
85 | },
86 | "bytes": {
87 | "version": "2.4.0",
88 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-2.4.0.tgz",
89 | "integrity": "sha1-fZcZb51br39pNeJZhVSe3SpsIzk="
90 | },
91 | "camelcase": {
92 | "version": "1.2.1",
93 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
94 | "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk="
95 | },
96 | "center-align": {
97 | "version": "0.1.3",
98 | "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz",
99 | "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=",
100 | "requires": {
101 | "align-text": "0.1.4",
102 | "lazy-cache": "1.0.4"
103 | }
104 | },
105 | "character-parser": {
106 | "version": "1.2.1",
107 | "resolved": "https://registry.npmjs.org/character-parser/-/character-parser-1.2.1.tgz",
108 | "integrity": "sha1-wN3kqxgnE7kZuXCVmhI+zBow/NY="
109 | },
110 | "clean-css": {
111 | "version": "3.4.28",
112 | "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-3.4.28.tgz",
113 | "integrity": "sha1-vxlF6C/ICPVWlebd6uwBQA79A/8=",
114 | "requires": {
115 | "commander": "2.8.1",
116 | "source-map": "0.4.4"
117 | },
118 | "dependencies": {
119 | "commander": {
120 | "version": "2.8.1",
121 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz",
122 | "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=",
123 | "requires": {
124 | "graceful-readlink": "1.0.1"
125 | }
126 | }
127 | }
128 | },
129 | "cliui": {
130 | "version": "2.1.0",
131 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",
132 | "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=",
133 | "requires": {
134 | "center-align": "0.1.3",
135 | "right-align": "0.1.3",
136 | "wordwrap": "0.0.2"
137 | },
138 | "dependencies": {
139 | "wordwrap": {
140 | "version": "0.0.2",
141 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz",
142 | "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8="
143 | }
144 | }
145 | },
146 | "commander": {
147 | "version": "2.6.0",
148 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.6.0.tgz",
149 | "integrity": "sha1-nfflL7Kgyw+4kFjugMMQQiXzfh0="
150 | },
151 | "constantinople": {
152 | "version": "3.0.2",
153 | "resolved": "https://registry.npmjs.org/constantinople/-/constantinople-3.0.2.tgz",
154 | "integrity": "sha1-S5RdmTeQe82Y7ldRIsOBdRZUQUE=",
155 | "requires": {
156 | "acorn": "2.7.0"
157 | }
158 | },
159 | "content-disposition": {
160 | "version": "0.5.2",
161 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
162 | "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
163 | },
164 | "content-type": {
165 | "version": "1.0.2",
166 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.2.tgz",
167 | "integrity": "sha1-t9ETrueo3Se9IRM8TcJSnfFyHu0="
168 | },
169 | "cookie": {
170 | "version": "0.3.1",
171 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
172 | "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
173 | },
174 | "cookie-parser": {
175 | "version": "1.4.3",
176 | "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.3.tgz",
177 | "integrity": "sha1-D+MfoZ0AC5X0qt8fU/3CuKIDuqU=",
178 | "requires": {
179 | "cookie": "0.3.1",
180 | "cookie-signature": "1.0.6"
181 | }
182 | },
183 | "cookie-signature": {
184 | "version": "1.0.6",
185 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
186 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
187 | },
188 | "core-util-is": {
189 | "version": "1.0.2",
190 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
191 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
192 | },
193 | "css": {
194 | "version": "1.0.8",
195 | "resolved": "https://registry.npmjs.org/css/-/css-1.0.8.tgz",
196 | "integrity": "sha1-k4aBHKgrzMnuf7WnMrHioxfIo+c=",
197 | "requires": {
198 | "css-parse": "1.0.4",
199 | "css-stringify": "1.0.5"
200 | }
201 | },
202 | "css-parse": {
203 | "version": "1.0.4",
204 | "resolved": "https://registry.npmjs.org/css-parse/-/css-parse-1.0.4.tgz",
205 | "integrity": "sha1-OLBQP7+dqfVOnB29pg4UXHcRe90="
206 | },
207 | "css-stringify": {
208 | "version": "1.0.5",
209 | "resolved": "https://registry.npmjs.org/css-stringify/-/css-stringify-1.0.5.tgz",
210 | "integrity": "sha1-sNBClG2ylTu50pKQCmy19tASIDE="
211 | },
212 | "debug": {
213 | "version": "2.2.0",
214 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
215 | "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
216 | "requires": {
217 | "ms": "0.7.1"
218 | }
219 | },
220 | "decamelize": {
221 | "version": "1.2.0",
222 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
223 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
224 | },
225 | "depd": {
226 | "version": "1.1.1",
227 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz",
228 | "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k="
229 | },
230 | "destroy": {
231 | "version": "1.0.4",
232 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
233 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
234 | },
235 | "ee-first": {
236 | "version": "1.1.1",
237 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
238 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
239 | },
240 | "encodeurl": {
241 | "version": "1.0.1",
242 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz",
243 | "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA="
244 | },
245 | "es6-promise": {
246 | "version": "3.2.1",
247 | "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz",
248 | "integrity": "sha1-7FYjOGgDKQkgcXDDlEjiREndH8Q="
249 | },
250 | "escape-html": {
251 | "version": "1.0.3",
252 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
253 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
254 | },
255 | "etag": {
256 | "version": "1.7.0",
257 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.7.0.tgz",
258 | "integrity": "sha1-A9MLX2fdbmMtKUXTDWZScxo01dg="
259 | },
260 | "express": {
261 | "version": "4.14.1",
262 | "resolved": "https://registry.npmjs.org/express/-/express-4.14.1.tgz",
263 | "integrity": "sha1-ZGwjf3ZvFIwhIK/wc4F7nk1+DTM=",
264 | "requires": {
265 | "accepts": "1.3.3",
266 | "array-flatten": "1.1.1",
267 | "content-disposition": "0.5.2",
268 | "content-type": "1.0.2",
269 | "cookie": "0.3.1",
270 | "cookie-signature": "1.0.6",
271 | "debug": "2.2.0",
272 | "depd": "1.1.1",
273 | "encodeurl": "1.0.1",
274 | "escape-html": "1.0.3",
275 | "etag": "1.7.0",
276 | "finalhandler": "0.5.1",
277 | "fresh": "0.3.0",
278 | "merge-descriptors": "1.0.1",
279 | "methods": "1.1.2",
280 | "on-finished": "2.3.0",
281 | "parseurl": "1.3.1",
282 | "path-to-regexp": "0.1.7",
283 | "proxy-addr": "1.1.5",
284 | "qs": "6.2.0",
285 | "range-parser": "1.2.0",
286 | "send": "0.14.2",
287 | "serve-static": "1.11.2",
288 | "type-is": "1.6.15",
289 | "utils-merge": "1.0.0",
290 | "vary": "1.1.1"
291 | },
292 | "dependencies": {
293 | "debug": {
294 | "version": "2.2.0",
295 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
296 | "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
297 | "requires": {
298 | "ms": "0.7.1"
299 | }
300 | }
301 | }
302 | },
303 | "finalhandler": {
304 | "version": "0.5.1",
305 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-0.5.1.tgz",
306 | "integrity": "sha1-LEANjUUwk1vCMlScX6OF7Afeb80=",
307 | "requires": {
308 | "debug": "2.2.0",
309 | "escape-html": "1.0.3",
310 | "on-finished": "2.3.0",
311 | "statuses": "1.3.1",
312 | "unpipe": "1.0.0"
313 | },
314 | "dependencies": {
315 | "debug": {
316 | "version": "2.2.0",
317 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
318 | "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
319 | "requires": {
320 | "ms": "0.7.1"
321 | }
322 | }
323 | }
324 | },
325 | "forwarded": {
326 | "version": "0.1.0",
327 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.0.tgz",
328 | "integrity": "sha1-Ge+YdMSuHCl7zweP3mOgm2aoQ2M="
329 | },
330 | "fresh": {
331 | "version": "0.3.0",
332 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.3.0.tgz",
333 | "integrity": "sha1-ZR+DjiJCTnVm3hYdg1jKoZn4PU8="
334 | },
335 | "graceful-readlink": {
336 | "version": "1.0.1",
337 | "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
338 | "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU="
339 | },
340 | "http-errors": {
341 | "version": "1.5.1",
342 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.5.1.tgz",
343 | "integrity": "sha1-eIwNLB3iyBuebowBhDtrl+uSB1A=",
344 | "requires": {
345 | "inherits": "2.0.3",
346 | "setprototypeof": "1.0.2",
347 | "statuses": "1.3.1"
348 | }
349 | },
350 | "iconv-lite": {
351 | "version": "0.4.13",
352 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.13.tgz",
353 | "integrity": "sha1-H4irpKsLFQjoMSrMOTRfNumS4vI="
354 | },
355 | "inherits": {
356 | "version": "2.0.3",
357 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
358 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
359 | },
360 | "ipaddr.js": {
361 | "version": "1.4.0",
362 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.4.0.tgz",
363 | "integrity": "sha1-KWrKh4qCGBbluF0KKFqZvP9FgvA="
364 | },
365 | "is-buffer": {
366 | "version": "1.1.5",
367 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz",
368 | "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw="
369 | },
370 | "is-promise": {
371 | "version": "2.1.0",
372 | "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
373 | "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o="
374 | },
375 | "isarray": {
376 | "version": "1.0.0",
377 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
378 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
379 | },
380 | "jade": {
381 | "version": "1.11.0",
382 | "resolved": "https://registry.npmjs.org/jade/-/jade-1.11.0.tgz",
383 | "integrity": "sha1-nIDlOMEtP7lcjZu5VZ+gzAQEBf0=",
384 | "requires": {
385 | "character-parser": "1.2.1",
386 | "clean-css": "3.4.28",
387 | "commander": "2.6.0",
388 | "constantinople": "3.0.2",
389 | "jstransformer": "0.0.2",
390 | "mkdirp": "0.5.1",
391 | "transformers": "2.1.0",
392 | "uglify-js": "2.8.29",
393 | "void-elements": "2.0.1",
394 | "with": "4.0.3"
395 | }
396 | },
397 | "jstransformer": {
398 | "version": "0.0.2",
399 | "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-0.0.2.tgz",
400 | "integrity": "sha1-eq4pqQPRls+glz2IXT5HlH7Ndqs=",
401 | "requires": {
402 | "is-promise": "2.1.0",
403 | "promise": "6.1.0"
404 | }
405 | },
406 | "kind-of": {
407 | "version": "3.2.2",
408 | "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
409 | "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
410 | "requires": {
411 | "is-buffer": "1.1.5"
412 | }
413 | },
414 | "lazy-cache": {
415 | "version": "1.0.4",
416 | "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz",
417 | "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4="
418 | },
419 | "longest": {
420 | "version": "1.0.1",
421 | "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
422 | "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc="
423 | },
424 | "media-typer": {
425 | "version": "0.3.0",
426 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
427 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
428 | },
429 | "merge-descriptors": {
430 | "version": "1.0.1",
431 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
432 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
433 | },
434 | "methods": {
435 | "version": "1.1.2",
436 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
437 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
438 | },
439 | "mime": {
440 | "version": "1.3.4",
441 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz",
442 | "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM="
443 | },
444 | "mime-db": {
445 | "version": "1.29.0",
446 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz",
447 | "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg="
448 | },
449 | "mime-types": {
450 | "version": "2.1.16",
451 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.16.tgz",
452 | "integrity": "sha1-K4WKUuXs1RbbiXrCvodIeDBpjiM=",
453 | "requires": {
454 | "mime-db": "1.29.0"
455 | }
456 | },
457 | "minimist": {
458 | "version": "0.0.8",
459 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
460 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
461 | },
462 | "mkdirp": {
463 | "version": "0.5.1",
464 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
465 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
466 | "requires": {
467 | "minimist": "0.0.8"
468 | }
469 | },
470 | "mongodb": {
471 | "version": "2.2.31",
472 | "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.31.tgz",
473 | "integrity": "sha1-GUBEXGYeGSF7s7+CRdmFSq71SNs=",
474 | "requires": {
475 | "es6-promise": "3.2.1",
476 | "mongodb-core": "2.1.15",
477 | "readable-stream": "2.2.7"
478 | }
479 | },
480 | "mongodb-core": {
481 | "version": "2.1.15",
482 | "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.1.15.tgz",
483 | "integrity": "sha1-hB9TuH//9MdFgYnDXIroJ+EWl2Q=",
484 | "requires": {
485 | "bson": "1.0.4",
486 | "require_optional": "1.0.1"
487 | }
488 | },
489 | "morgan": {
490 | "version": "1.7.0",
491 | "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.7.0.tgz",
492 | "integrity": "sha1-6xDKjlDRq+D409rVwCAdBS2YHGI=",
493 | "requires": {
494 | "basic-auth": "1.0.4",
495 | "debug": "2.2.0",
496 | "depd": "1.1.1",
497 | "on-finished": "2.3.0",
498 | "on-headers": "1.0.1"
499 | }
500 | },
501 | "ms": {
502 | "version": "0.7.1",
503 | "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
504 | "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg="
505 | },
506 | "negotiator": {
507 | "version": "0.6.1",
508 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
509 | "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
510 | },
511 | "on-finished": {
512 | "version": "2.3.0",
513 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
514 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
515 | "requires": {
516 | "ee-first": "1.1.1"
517 | }
518 | },
519 | "on-headers": {
520 | "version": "1.0.1",
521 | "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz",
522 | "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c="
523 | },
524 | "optimist": {
525 | "version": "0.3.7",
526 | "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz",
527 | "integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=",
528 | "requires": {
529 | "wordwrap": "0.0.3"
530 | }
531 | },
532 | "parseurl": {
533 | "version": "1.3.1",
534 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.1.tgz",
535 | "integrity": "sha1-yKuMkiO6NIiKpkopeyiFO+wY2lY="
536 | },
537 | "path-to-regexp": {
538 | "version": "0.1.7",
539 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
540 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
541 | },
542 | "process-nextick-args": {
543 | "version": "1.0.7",
544 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
545 | "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M="
546 | },
547 | "promise": {
548 | "version": "6.1.0",
549 | "resolved": "https://registry.npmjs.org/promise/-/promise-6.1.0.tgz",
550 | "integrity": "sha1-LOcp9rlLRcJoka0GAsXJDgTG7vY=",
551 | "requires": {
552 | "asap": "1.0.0"
553 | }
554 | },
555 | "proxy-addr": {
556 | "version": "1.1.5",
557 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.5.tgz",
558 | "integrity": "sha1-ccDuOxAt4/IC87ZPYI0XP8uhqRg=",
559 | "requires": {
560 | "forwarded": "0.1.0",
561 | "ipaddr.js": "1.4.0"
562 | }
563 | },
564 | "qs": {
565 | "version": "6.2.0",
566 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.0.tgz",
567 | "integrity": "sha1-O3hIwDwt7OaalSKw+ujEEm10Xzs="
568 | },
569 | "range-parser": {
570 | "version": "1.2.0",
571 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
572 | "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
573 | },
574 | "raw-body": {
575 | "version": "2.1.7",
576 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.1.7.tgz",
577 | "integrity": "sha1-rf6s4uT7MJgFgBTQjActzFl1h3Q=",
578 | "requires": {
579 | "bytes": "2.4.0",
580 | "iconv-lite": "0.4.13",
581 | "unpipe": "1.0.0"
582 | }
583 | },
584 | "readable-stream": {
585 | "version": "2.2.7",
586 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.7.tgz",
587 | "integrity": "sha1-BwV6y+JGeyIELTb5jFrVBwVOlbE=",
588 | "requires": {
589 | "buffer-shims": "1.0.0",
590 | "core-util-is": "1.0.2",
591 | "inherits": "2.0.3",
592 | "isarray": "1.0.0",
593 | "process-nextick-args": "1.0.7",
594 | "string_decoder": "1.0.3",
595 | "util-deprecate": "1.0.2"
596 | }
597 | },
598 | "repeat-string": {
599 | "version": "1.6.1",
600 | "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
601 | "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc="
602 | },
603 | "require_optional": {
604 | "version": "1.0.1",
605 | "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz",
606 | "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==",
607 | "requires": {
608 | "resolve-from": "2.0.0",
609 | "semver": "5.4.1"
610 | }
611 | },
612 | "resolve-from": {
613 | "version": "2.0.0",
614 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz",
615 | "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c="
616 | },
617 | "right-align": {
618 | "version": "0.1.3",
619 | "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
620 | "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=",
621 | "requires": {
622 | "align-text": "0.1.4"
623 | }
624 | },
625 | "safe-buffer": {
626 | "version": "5.1.1",
627 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
628 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
629 | },
630 | "semver": {
631 | "version": "5.4.1",
632 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
633 | "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg=="
634 | },
635 | "send": {
636 | "version": "0.14.2",
637 | "resolved": "https://registry.npmjs.org/send/-/send-0.14.2.tgz",
638 | "integrity": "sha1-ObBDiz9RC+Xcb2Z6EfcWiTaM3u8=",
639 | "requires": {
640 | "debug": "2.2.0",
641 | "depd": "1.1.1",
642 | "destroy": "1.0.4",
643 | "encodeurl": "1.0.1",
644 | "escape-html": "1.0.3",
645 | "etag": "1.7.0",
646 | "fresh": "0.3.0",
647 | "http-errors": "1.5.1",
648 | "mime": "1.3.4",
649 | "ms": "0.7.2",
650 | "on-finished": "2.3.0",
651 | "range-parser": "1.2.0",
652 | "statuses": "1.3.1"
653 | },
654 | "dependencies": {
655 | "debug": {
656 | "version": "2.2.0",
657 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
658 | "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
659 | "requires": {
660 | "ms": "0.7.1"
661 | },
662 | "dependencies": {
663 | "ms": {
664 | "version": "0.7.1",
665 | "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
666 | "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg="
667 | }
668 | }
669 | },
670 | "ms": {
671 | "version": "0.7.2",
672 | "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
673 | "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U="
674 | }
675 | }
676 | },
677 | "serve-favicon": {
678 | "version": "2.3.2",
679 | "resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.3.2.tgz",
680 | "integrity": "sha1-3UGeJo3gEqtysxnTN/IQUBP5OB8=",
681 | "requires": {
682 | "etag": "1.7.0",
683 | "fresh": "0.3.0",
684 | "ms": "0.7.2",
685 | "parseurl": "1.3.1"
686 | },
687 | "dependencies": {
688 | "ms": {
689 | "version": "0.7.2",
690 | "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
691 | "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U="
692 | }
693 | }
694 | },
695 | "serve-static": {
696 | "version": "1.11.2",
697 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.11.2.tgz",
698 | "integrity": "sha1-LPmIm9RDWjIMw2iVyapXvWYuasc=",
699 | "requires": {
700 | "encodeurl": "1.0.1",
701 | "escape-html": "1.0.3",
702 | "parseurl": "1.3.1",
703 | "send": "0.14.2"
704 | }
705 | },
706 | "setprototypeof": {
707 | "version": "1.0.2",
708 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.2.tgz",
709 | "integrity": "sha1-gaVSFB7BBLiOic44MQOtXGZWTQg="
710 | },
711 | "source-map": {
712 | "version": "0.4.4",
713 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
714 | "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=",
715 | "requires": {
716 | "amdefine": "1.0.1"
717 | }
718 | },
719 | "statuses": {
720 | "version": "1.3.1",
721 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz",
722 | "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4="
723 | },
724 | "string_decoder": {
725 | "version": "1.0.3",
726 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
727 | "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
728 | "requires": {
729 | "safe-buffer": "5.1.1"
730 | }
731 | },
732 | "transformers": {
733 | "version": "2.1.0",
734 | "resolved": "https://registry.npmjs.org/transformers/-/transformers-2.1.0.tgz",
735 | "integrity": "sha1-XSPLNVYd2F3Gf7hIIwm0fVPM6ac=",
736 | "requires": {
737 | "css": "1.0.8",
738 | "promise": "2.0.0",
739 | "uglify-js": "2.2.5"
740 | },
741 | "dependencies": {
742 | "is-promise": {
743 | "version": "1.0.1",
744 | "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-1.0.1.tgz",
745 | "integrity": "sha1-MVc3YcBX4zwukaq56W2gjO++duU="
746 | },
747 | "promise": {
748 | "version": "2.0.0",
749 | "resolved": "https://registry.npmjs.org/promise/-/promise-2.0.0.tgz",
750 | "integrity": "sha1-RmSKqdYFr10ucMMCS/WUNtoCuA4=",
751 | "requires": {
752 | "is-promise": "1.0.1"
753 | }
754 | },
755 | "source-map": {
756 | "version": "0.1.43",
757 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz",
758 | "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=",
759 | "requires": {
760 | "amdefine": "1.0.1"
761 | }
762 | },
763 | "uglify-js": {
764 | "version": "2.2.5",
765 | "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.2.5.tgz",
766 | "integrity": "sha1-puAqcNg5eSuXgEiLe4sYTAlcmcc=",
767 | "requires": {
768 | "optimist": "0.3.7",
769 | "source-map": "0.1.43"
770 | }
771 | }
772 | }
773 | },
774 | "type-is": {
775 | "version": "1.6.15",
776 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz",
777 | "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=",
778 | "requires": {
779 | "media-typer": "0.3.0",
780 | "mime-types": "2.1.16"
781 | }
782 | },
783 | "uglify-js": {
784 | "version": "2.8.29",
785 | "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz",
786 | "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=",
787 | "requires": {
788 | "source-map": "0.5.6",
789 | "uglify-to-browserify": "1.0.2",
790 | "yargs": "3.10.0"
791 | },
792 | "dependencies": {
793 | "source-map": {
794 | "version": "0.5.6",
795 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz",
796 | "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI="
797 | }
798 | }
799 | },
800 | "uglify-to-browserify": {
801 | "version": "1.0.2",
802 | "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz",
803 | "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=",
804 | "optional": true
805 | },
806 | "unpipe": {
807 | "version": "1.0.0",
808 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
809 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
810 | },
811 | "util-deprecate": {
812 | "version": "1.0.2",
813 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
814 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
815 | },
816 | "utils-merge": {
817 | "version": "1.0.0",
818 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz",
819 | "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg="
820 | },
821 | "vary": {
822 | "version": "1.1.1",
823 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.1.tgz",
824 | "integrity": "sha1-Z1Neu2lMHVIldFeYRmUyP1h+jTc="
825 | },
826 | "void-elements": {
827 | "version": "2.0.1",
828 | "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz",
829 | "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w="
830 | },
831 | "window-size": {
832 | "version": "0.1.0",
833 | "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz",
834 | "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0="
835 | },
836 | "with": {
837 | "version": "4.0.3",
838 | "resolved": "https://registry.npmjs.org/with/-/with-4.0.3.tgz",
839 | "integrity": "sha1-7v0VTp550sjTQXtkeo8U2f7M4U4=",
840 | "requires": {
841 | "acorn": "1.2.2",
842 | "acorn-globals": "1.0.9"
843 | },
844 | "dependencies": {
845 | "acorn": {
846 | "version": "1.2.2",
847 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz",
848 | "integrity": "sha1-yM4n3grMdtiW0rH6099YjZ6C8BQ="
849 | }
850 | }
851 | },
852 | "wordwrap": {
853 | "version": "0.0.3",
854 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
855 | "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc="
856 | },
857 | "yargs": {
858 | "version": "3.10.0",
859 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",
860 | "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=",
861 | "requires": {
862 | "camelcase": "1.2.1",
863 | "cliui": "2.1.0",
864 | "decamelize": "1.2.0",
865 | "window-size": "0.1.0"
866 | }
867 | }
868 | }
869 | }
870 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "blog",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "body-parser": "~1.15.2",
10 | "cookie-parser": "~1.4.3",
11 | "debug": "~2.2.0",
12 | "express": "~4.14.0",
13 | "jade": "~1.11.0",
14 | "mongodb": "^2.2.14",
15 | "morgan": "~1.7.0",
16 | "serve-favicon": "~2.3.0"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/public/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tiger0409/angular_blog/c674417d5dd3af3b0ee8609d0689c8d297c7065c/public/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/public/fonts/glyphicons-halflings-regular.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/public/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tiger0409/angular_blog/c674417d5dd3af3b0ee8609d0689c8d297c7065c/public/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/public/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tiger0409/angular_blog/c674417d5dd3af3b0ee8609d0689c8d297c7065c/public/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/public/images/info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tiger0409/angular_blog/c674417d5dd3af3b0ee8609d0689c8d297c7065c/public/images/info.png
--------------------------------------------------------------------------------
/public/images/info2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tiger0409/angular_blog/c674417d5dd3af3b0ee8609d0689c8d297c7065c/public/images/info2.png
--------------------------------------------------------------------------------
/public/images/info3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tiger0409/angular_blog/c674417d5dd3af3b0ee8609d0689c8d297c7065c/public/images/info3.png
--------------------------------------------------------------------------------
/public/images/member.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tiger0409/angular_blog/c674417d5dd3af3b0ee8609d0689c8d297c7065c/public/images/member.jpg
--------------------------------------------------------------------------------
/public/javascripts/app.js:
--------------------------------------------------------------------------------
1 | var app = angular.module('Blog', ['ngRoute', 'myService', 'myController', 'myDirective', 'ngCookies']);
2 |
3 |
4 |
5 | //route->get different page
6 | app.config(function ($routeProvider) {
7 | $routeProvider
8 | .when('/', {
9 | controller: 'postCtrl',
10 | templateUrl: '/template/listPost.html'
11 | })
12 | .when('/signup', {
13 | controller: 'registCtrl',
14 | templateUrl: '/template/signup.html'
15 | })
16 | .when('/signin', {
17 | controller: 'signinCtrl',
18 | templateUrl: '/template/signin.html'
19 | })
20 | .when('/myblog', {
21 | controller: 'myblogCtrl',
22 | templateUrl: '/template/myblog.html'
23 | })
24 | .when('/nosignin', {
25 | controller: 'noSigninCtrl',
26 | templateUrl: '/template/noSignin.html'
27 | })
28 | .when('/writePost', {
29 | controller: 'writeBlogCtrl',
30 | templateUrl: '/template/writePost.html'
31 | })
32 | .when('/detailPost', {
33 | controller: 'detailCtrl',
34 | templateUrl: '/template/postDetail.html'
35 | })
36 | .otherwise({
37 | redirectTo: '/'
38 | });
39 | });
40 |
41 |
42 |
--------------------------------------------------------------------------------
/public/javascripts/bootstrap.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.3.0 (http://getbootstrap.com)
3 | * Copyright 2011-2014 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.0",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus","focus"==b.type)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.0",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c="prev"==a?-1:1,d=this.getItemIndex(b),e=(d+c)%this.$items.length;return this.$items.eq(e)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i="next"==b?"first":"last",j=this;if(!f.length){if(!this.options.wrap)return;f=this.$element.find(".item")[i]()}if(f.hasClass("active"))return this.sliding=!1;var k=f[0],l=a.Event("slide.bs.carousel",{relatedTarget:k,direction:h});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var m=a(this.$indicators.children()[this.getItemIndex(f)]);m&&m.addClass("active")}var n=a.Event("slid.bs.carousel",{relatedTarget:k,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),j.sliding=!1,setTimeout(function(){j.$element.trigger(n)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(n)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a(this.options.trigger).filter('[href="#'+b.id+'"], [data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.0",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0,trigger:'[data-toggle="collapse"]'},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.find("> .panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":a.extend({},e.data(),{trigger:this});c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=c(d),f={relatedTarget:this};e.hasClass("open")&&(e.trigger(b=a.Event("hide.bs.dropdown",f)),b.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f)))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('
').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27|32)/.test(b.which)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g&&27!=b.which||g&&27==b.which)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(b.target);38==b.which&&j>0&&j--,40==b.which&&j').prependTo(this.$element).on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.checkScrollbar=function(){this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){if(document.body.clientWidth>=window.innerWidth)return 0;var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b,g=f&&f.selector;(e||"destroy"!=b)&&(g?(e||d.data("bs.tooltip",e={}),e[g]||(e[g]=new c(this,f))):e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.3.0",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c&&c.$tip&&c.$tip.is(":visible")?void(c.hoverState="in"):(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.options.container?a(this.options.container):this.$element.parent(),p=this.getPosition(o);h="bottom"==h&&k.bottom+m>p.bottom?"top":"top"==h&&k.top-mp.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type)})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b,g=f&&f.selector;(e||"destroy"!=b)&&(g?(e||d.data("bs.popover",e={}),e[g]||(e[g]=new c(this,f))):e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.0",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)
7 | }(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=i?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=a("body").height();"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
--------------------------------------------------------------------------------
/public/javascripts/controllers.js:
--------------------------------------------------------------------------------
1 | var myController = angular.module('myController', ['textAngular', 'myService', 'myDirective', 'ngCookies']);
2 |
3 | //Parent Ctrl
4 | myController.controller("parentCtrl", ['$scope', function($scope) {
5 | $scope.$on("homesearch-to-parentCtrl", function(d, data) {
6 | $scope.$broadcast("parentCtrl-to-postCtrl", 'true');
7 | });
8 |
9 | $scope.$on("myblogsearch-to-parentCtrl", function(d, data) {
10 | $scope.$broadcast("parentCtrl-to-myblogCtrl", 'true');
11 | });
12 | }]);
13 |
14 | //HomeCtrl
15 | myController.controller("homepageCtrl",['$scope', '$location', 'User', 'Post', function($scope, $location, User, Post) {
16 | $scope.checkIfsignin = function() {
17 | $scope.website = User.getSignin() ? "myblog" : "nosignin";
18 | };
19 | $scope._checkIfsignin = function() {
20 | $scope._website = User.getSignin() ? "writePost" : "nosignin";
21 | };
22 | $scope.loadHtmlcheck = function() {
23 | User.checkIfsignin().then(function(resJson) {
24 | User.setUser(resJson);
25 | User.setSignin(true);
26 | }).catch(function() {
27 | User.setSignin(false);
28 | });
29 | };
30 | $scope.canShow= function() {
31 | return User.getSignin();
32 | };
33 | $scope.logOut = function() {
34 | User.logOut().then(function() {
35 | User.setUser({});
36 | User.setSignin(false);
37 | $location.path('/');
38 | }).catch(function(err) {
39 | console.log(err);
40 | });
41 | };
42 | $scope.loadHtmlcheck();
43 |
44 | }]);
45 |
46 | //signupCtrl
47 | myController.controller("registCtrl",['$scope', '$http', '$location', 'DataCheck', 'User', function($scope, $http, $location, DataCheck, User) {
48 | $scope.user = {
49 | username: '',
50 | password: '',
51 | repassword: '',
52 | nikiname: '',
53 | email: '',
54 | isAdmin: false
55 | };
56 | $scope.error = {
57 | username: '',
58 | password: '',
59 | repassword: '',
60 | nikiname: '',
61 | email: ''
62 | };
63 | $scope.show = {
64 | username: '',
65 | password: '',
66 | repassword: '',
67 | nikiname: '',
68 | email: ''
69 | };
70 | $scope.close = function() {
71 | $location.path('/');
72 | };
73 | $scope.clear = function() {
74 | $scope.user.username = $scope.user.password = $scope.user.repassword = $scope.user.nikiname = $scope.user.email = '';
75 | $scope.error.username = $scope.error.password = $scope.error.repassword = $scope.error.nikiname = $scope.error.email = '';
76 | $scope.show.username = $scope.show.password = $scope.show.repassword = $scope.show.nikiname = $scope.show.email = '';
77 | };
78 | $scope.formatInfo = function($event) {
79 | var info = DataCheck.registInfo;
80 | var name = $event.target.name;
81 | $scope.show[name] = 'show';
82 | $scope.error[name] = info[name];
83 | };
84 | $scope.checkInput = function($event) {
85 | var name = $event.target.name;
86 | var res = DataCheck.regist[name]($scope.user[name]);
87 | if ("ok" !== res || name === 'password' || name === 'repassword') {
88 | $scope.error[name] = res;
89 | } else {
90 | var str = '{"' + name + '":"' + $scope.user[name] + '"}';
91 | var _json = JSON.parse(str);
92 | User.checkDuplicate(_json).then(function(message) {
93 | $scope.error[name] = message;
94 | }).catch(function(err) {
95 | console.log(err);
96 | });
97 | }
98 | $scope.show[name] = 'show';
99 | };
100 | $scope.postFrom = function() {
101 | var flag = true;
102 | for (var key in DataCheck.regist) {
103 | if ($scope.error[key] !== 'ok') flag = false;
104 | }
105 | if (flag) {
106 | $scope.user.password = hex_sha1($scope.user.password);
107 | $scope.user.repassword = $scope.user.password;
108 | $scope.user.isAdmin = false;
109 | User.postUser($scope.user).then(function(resJson) {
110 | User.setUser(resJson);
111 | $location.path('/');
112 | }).catch(function(err) {
113 | console.log(err);
114 | });
115 | } else {
116 | for (var key in $scope.show) {
117 | if ($scope.show[key] === '') {
118 | $scope.show[key] = 'show';
119 | $scope.error[key] = '不能为空';
120 | }
121 | }
122 | }
123 | };
124 | }]);
125 |
126 |
127 | //signin Ctrl
128 | myController.controller("signinCtrl", ['$scope', '$http', '$location', 'User', 'DataCheck', function($scope, $http, $location, User, DataCheck) {
129 | $scope.show = {
130 | username: '',
131 | password: ''
132 | };
133 | $scope.error = {
134 | username: '',
135 | password: ''
136 | };
137 | $scope.initInfo = function() {
138 | $scope.error.username = $scope.error.password = '';
139 | $scope.show.username = $scope.show.password = '';
140 | };
141 | $scope.checkData = function() {
142 | var flag = true;
143 | if (!$scope.username || $scope.username === '') {
144 | $scope.error.username = DataCheck.signinInfo['empty'];
145 | $scope.show.username = 'show';
146 | flag = false;
147 | }
148 | if (!$scope.password || $scope.password === '') {
149 | $scope.error.password = DataCheck.signinInfo['empty'];
150 | $scope.show.password = 'show';
151 | flag = false;
152 | }
153 | if (flag) {
154 | var user = {username: $scope.username, password: hex_sha1($scope.password)};
155 | User.signinPost(user).then(function(resJson) {
156 | User.setUser(resJson);
157 | $location.path('/');
158 | }).catch(function(message) {
159 | $scope.error[message] = DataCheck.signinInfo[message];
160 | $scope.show[message] = 'show';
161 | });
162 | }
163 | };
164 | $scope.close = function() {
165 | $location.path('/');
166 | };
167 | }]);
168 |
169 |
170 | //Post Ctrl
171 | myController.controller("postCtrl", ['$scope', '$location', '$cookies', '$cookieStore', 'Post', function($scope, $location, $cookies, $cookieStore, Post) {
172 | $scope.loadPost = function() {
173 | Post.loadPost().then(function(resJson) {
174 | $scope.posts = resJson;
175 | $scope.amount = Post.getPostNumbers();
176 | $scope.$broadcast('postCtrl to pagingDir', 'true');
177 | }).catch(function(err) {
178 | console.log(err);
179 | });
180 | };
181 | $scope.getTargetpost = function(item) {
182 | Post.getPostById(item).then(function() {
183 | $location.path('/detailPost');
184 | }).catch(function(err) {
185 | console.log(err);
186 | });
187 | };
188 | $scope.$on("parentCtrl-to-postCtrl", function(d, data) {
189 | $scope.isSearch = true;
190 | $scope.loadPost();
191 | });
192 | $scope.$on("paging-to-postCtr", function(d, data) {
193 | $scope.posts = data;
194 | });
195 | $scope.amount = 1;
196 | $scope.isSearch = false;
197 | $cookieStore.put('ifEdit', false);
198 | $scope.loadPost();
199 | }]);
200 | //NoSignIn Ctrl
201 | myController.controller("noSigninCtrl", ['$scope', '$http', '$location', function($scope, $http, $location) {
202 | $scope.close = function() {
203 | $location.path('/');
204 | };
205 | }]);
206 |
207 | //MyBlog Ctrl
208 | myController.controller("myblogCtrl", ['$scope', '$location', '$cookies', '$cookieStore', 'Post', function($scope, $location, $cookies, $cookieStore,Post) {
209 | $scope.loadPost = function() {
210 | Post.loadPostByauthor().then(function(resJson) {
211 | $scope.posts = resJson;
212 | $scope.amount = Post.getPostNumbers();
213 | $scope.$broadcast('postCtrl to pagingDir', 'true');
214 | }).catch(function(err) {
215 | console.log(err);
216 | });
217 | };
218 | $scope.getTargetpost = function(item) {
219 | Post.getPostById(item).then(function() {
220 | $location.path('/detailPost');
221 | });
222 | };
223 | $scope.$on("parentCtrl-to-myblogCtrl", function(d, data) {
224 | $scope.isSearch = true;
225 | $scope.loadPost();
226 | });
227 | $scope.$on("paging-to-postCtr", function(d, data) {
228 | $scope.posts = data;
229 | });
230 | $scope.amount = 1;
231 | $cookieStore.put('ifEdit', false);
232 | $scope.loadPost();
233 | }]);
234 |
235 | //WriteBlog Ctrl
236 | myController.controller("writeBlogCtrl", ['$scope', 'Post', '$location', '$cookies', '$cookieStore', 'User', function($scope, Post, $location, $cookies, $cookieStore,User) {
237 | var id;
238 | $scope.addPost = function() {
239 | var dataJson;
240 | if ($scope.postTitle === '' && $scope.htmlVariable === '') $scope.AlertInfo = '标题和内容不能空';
241 | else if ($scope.postTitle === '' && $scope.htmlVariable !== '') $scope.AlertInfo = '标题不能空';
242 | else if ($scope.postTitle !== '' && $scope.htmlVariable === '') $scope.AlertInfo = '内容不能空';
243 | else {
244 | console.log($scope.htmlVariable);
245 | if (!id)
246 | dataJson = {title: $scope.postTitle, content: $scope.htmlVariable, date: new Date(), author: User.getUser().nikiname, authorUsername: User.getUser().username, isHide: false};
247 | else
248 | dataJson = {_id: id, title: $scope.postTitle, content: $scope.htmlVariable, date: new Date(), author: User.getUser().nikiname, authorUsername: User.getUser().username, isHide: false};
249 | id = "";
250 | Post.submitPost(dataJson).then(function() {
251 | $cookieStore.put('ifEdit', false);
252 | $location.path('/myblog');
253 | });
254 | }
255 | };
256 | $scope.clear = function() {
257 | $scope.AlertInfo = '';
258 | };
259 | $scope.AlertInfo = '';
260 | var ifEdit = $cookieStore.get('ifEdit');
261 | if (ifEdit && ifEdit === true) {
262 | $scope.postTitle = $cookieStore.get('currentPost').title;
263 | Post.getPostBy_Id().then(function(resJson) {
264 | $scope.htmlVariable = resJson;
265 | });
266 | id = $cookieStore.get('currentPost')._id;
267 | } else {
268 | id = $scope.postTitle = $scope.htmlVariable = "";
269 |
270 | }
271 | }]);
272 | //Detail Ctr
273 | myController.controller("detailCtrl", ['$scope', '$location', '$sce', '$cookies', '$cookieStore', '$http', 'Post', 'User', 'Comment', function($scope, $location, $sce, $cookies, $cookieStore, $http, Post, User, Comment) {
274 | $scope.comments = [];
275 | $scope.content = '';
276 | $scope.AlertInfo = '';
277 | $scope.post = {
278 | _id: '',
279 | title: '',
280 | content: '',
281 | date: '',
282 | author: '',
283 | authorUsername: '',
284 | isHide: ''
285 | };
286 | $cookieStore.put('ifEdit', false);
287 | $scope.loadDetail = function() {
288 | $scope.post = $cookieStore.get('currentPost');
289 | Post.getPostBy_Id().then(function(resJson) {
290 | $scope.post.content = $sce.trustAsHtml(resJson);
291 | });
292 | $http.get('/comments/cancelAll').then(function() {
293 | $scope.loadComment();
294 | });
295 | };
296 | $scope.loadComment = function() {
297 | Comment.loadComment().then(function(resJson) {
298 | $scope.comments = resJson;
299 | }).catch(function(err) {
300 | console.log(err);
301 | });
302 | };
303 | $scope.backHome = function() {
304 | $location.path('/');
305 | };
306 | $scope.cancel = function(dataJson) {
307 | Comment.cancel(dataJson).then(function() {
308 | $scope.loadComment();
309 | });
310 | };
311 | $scope.editPost = function() {
312 | $cookieStore.put('ifEdit', true);
313 | $location.path('/writePost');
314 | };
315 | $scope.deletePost = function() {
316 | Post.deletePost().then(function() {
317 | $location.path('/');
318 | }).catch(function() {
319 | console.log('deletePost fail');
320 | });
321 | };
322 | $scope.deleteComment = function(item) {
323 | Comment.deleteComment(item).then(function() {
324 | $scope.loadComment();
325 | }).catch(function(err) {
326 | console.log(err);
327 | });
328 | };
329 | $scope.editCommentstatus = function(item) {
330 | Comment.editCommentstatus(item).then(function() {
331 | $scope.loadComment();
332 | }).catch(function(err) {
333 | console.log(err);
334 | });
335 | };
336 | $scope.editComment = function(item) {
337 | if (item.content !== '') {
338 | Comment.editComment(item).then(function() {
339 | $scope.loadComment();
340 | }).catch(function(err) {
341 | console.log(err);
342 | });
343 | }
344 | };
345 | $scope.submitComment = function(content) {
346 | if ($scope.content !== '') {
347 | $scope.comment1 = {
348 | content: $scope.content,
349 | time: new Date(),
350 | author: User.getUser().nikiname,
351 | authorUsername: User.getUser().username,
352 | id: $cookieStore.get('currentPost')._id,
353 | isEdit: false,
354 | isHide: false
355 | };
356 | $scope.content = '';
357 | Comment.addComment($scope.comment1).then(function() {
358 | $scope.loadComment();
359 | }).catch(function(err) {
360 | console.log(err);
361 | });
362 | } else {
363 | $scope.AlertInfo = '内容不能为空';
364 | }
365 | };
366 | $scope.operatorshowByauthor = function(dataJson) {
367 | if (dataJson.isHide)
368 | return false;
369 | return dataJson.authorUsername === User.getUser().username;
370 | };
371 | $scope.hidePost = function(item) {
372 | Post.hidePost(item).then(function() {
373 | $scope.loadDetail();
374 | }).catch(function(err) {
375 | console.log(err);
376 | });
377 | };
378 | $scope.showPost = function(item) {
379 | Post.showPost(item).then(function() {
380 | $scope.loadDetail();
381 | }).catch(function(err) {
382 | console.log(err);
383 | });
384 | };
385 | $scope.hideComment = function(item) {
386 | Comment.hideComment(item).then(function() {
387 | $scope.loadComment();
388 | }).catch(function(err) {
389 | console.log(err);
390 | });
391 | };
392 | $scope.showComment = function(item) {
393 | Comment.showComment(item).then(function() {
394 | $scope.loadComment();
395 | }).catch(function(err) {
396 | console.log(err);
397 | });
398 | };
399 | $scope.clear = function() {
400 | $scope.AlertInfo = '';
401 | };
402 | $scope.showByadmin = function() {
403 | return User.getUser().isAdmin;
404 | };
405 | $scope.checkIfhide = function() {
406 | return $cookieStore.get('currentPost').isHide;
407 | };
408 | $scope._checkIfhide = function(value) {
409 | return value;
410 | };
411 | $scope.showByauthor = function() {
412 | if ($scope.checkIfhide())
413 | return false;
414 | return User.getUser().nikiname == $scope.post.author;
415 | };
416 | $scope.showBycomments = function() {
417 | return Comment.getComments().length === 0 ? true : false;
418 | };
419 | $scope.showBysignin = function() {
420 | return User.getSignin();
421 | };
422 |
423 | $scope.loadDetail();
424 | }]);
425 |
426 | myController.controller("searchCtrl", ['$scope', '$location', '$cookies', '$cookieStore', 'Post', 'User', function($scope, $location, $cookies, $cookieStore, Post, User) {
427 | $scope.keyWord = "";
428 | $scope.search = function() {
429 | var mode = $location.path();
430 | if (mode === '/') {
431 | Post.getPostByKeyWord($scope.keyWord).then(function(resJson) {
432 | $scope.$emit("homesearch-to-parentCtrl", 'true');
433 | });
434 | }
435 |
436 | if (mode === '/myblog') {
437 | Post.getPostByKeyWordAndAuthor($scope.keyWord).then(function(resJson) {
438 | console.log(resJson);
439 | $scope.$emit("myblogsearch-to-parentCtrl", 'true');
440 | });
441 | }
442 | $scope.keyWord = "";
443 | };
444 | }]);
--------------------------------------------------------------------------------
/public/javascripts/directive.js:
--------------------------------------------------------------------------------
1 | var myDirective = angular.module('myDirective', ['myService', 'myController']);
2 |
3 | myDirective.directive('paging', function () {
4 | return {
5 | restrict: 'E',
6 | templateUrl: '/template/paging.html',
7 | replace: true,
8 | scope: {},
9 | controller: function($scope, Post) {
10 | $scope.currentPage = 1;
11 | $scope.itemsOfPrePage = 7;
12 | $scope.pageNums = 0;
13 | $scope.pageNumsLimit = 9;
14 | $scope.loadPaging = function() {
15 | var num = Post.getPostNumbers() / $scope.itemsOfPrePage;
16 | var num1 = Post.getPostNumbers() % $scope.itemsOfPrePage;
17 | if (num1 !== 0) num += 1;
18 | $scope.pageNums = parseInt(num);
19 | var _nums = [];
20 | if ($scope.pageNums > $scope.pageNumsLimit) {
21 | for (var i = 0; i < $scope.pageNumsLimit; i++) {
22 | if (i !== $scope.pageNumsLimit - 2 && i !== $scope.pageNumsLimit - 1)
23 | _nums[i] = i + 1;
24 | else if (i === $scope.pageNumsLimit - 1)
25 | _nums[i] = $scope.pageNums;
26 | else _nums[i] = 99999;
27 | }
28 | } else {
29 | for (var j = 0; j < $scope.pageNums; j++)
30 | _nums[j] = j + 1;
31 | }
32 | $scope.nums = _nums;
33 | };
34 |
35 | $scope.getClickPageItems = function(item) {
36 | if (item === 99999 || item === 99998) return;
37 | $scope.currentPage = item;
38 | Post.getPostByClickPage(item).then(function(resJson) {
39 | $scope.reset();
40 | $scope.$emit('paging-to-postCtr', resJson);
41 | }).catch(function(err) {
42 | console.log(err);
43 | });
44 | };
45 | $scope.getItemsByPrePage = function() {
46 | if (($scope.currentPage - 1) < 1)
47 | return;
48 | else {
49 | $scope.currentPage--;
50 | $scope.getClickPageItems($scope.currentPage);
51 | }
52 | };
53 |
54 | $scope.getItemsByNextPage = function() {
55 | if (($scope.currentPage + 1) > $scope.pageNums)
56 | return;
57 | else {
58 | $scope.currentPage++;
59 | $scope.getClickPageItems($scope.currentPage);
60 | }
61 | };
62 | $scope.reset = function() {
63 | if ($scope.pageNums <= $scope.pageNumsLimit) return;
64 | var _nums = [];
65 | if ($scope.currentPage <= parseInt($scope.pageNumsLimit / 2)) {
66 | for (var j = 0; j < $scope.pageNumsLimit; j++) {
67 | if (j === $scope.pageNumsLimit - 1) {
68 | _nums[j] = $scope.pageNums;
69 | } else if (j === $scope.pageNumsLimit - 2) {
70 | _nums[j] = 99999;
71 | } else {
72 | _nums[j] = j + 1;
73 | }
74 | }
75 | } else if ($scope.currentPage >= $scope.pageNums - parseInt($scope.pageNumsLimit / 2) - 1) {
76 | for (var k = 0; k < $scope.pageNumsLimit; k++) {
77 | if (k === $scope.pageNumsLimit - 1) {
78 | _nums[k] = $scope.pageNums;
79 | } else if (k === 1) {
80 | _nums[k] = 99999;
81 | } else if (k === 0) {
82 | _nums[k] = 1;
83 | } else {
84 | _nums[k] = $scope.pageNums + k - $scope.pageNumsLimit;
85 | }
86 | }
87 | } else {
88 | _nums = [];
89 | for (var i = 0; i < $scope.pageNumsLimit; i++) {
90 | if (i === 0) {
91 | _nums[i] = 1;
92 | _nums[i + 1] = 99999;
93 | } else if (i === $scope.pageNumsLimit - 1) {
94 | _nums[i] = $scope.pageNums;
95 | _nums[i - 1] = 99998;
96 |
97 | } else {
98 | if (i !== 1 && i !== $scope.pageNumsLimit - 2)
99 | _nums[i] = $scope.currentPage + i - 4;
100 | }
101 | }
102 | }
103 | $scope.nums = _nums;
104 | };
105 | $scope.$on("postCtrl to pagingDir", function(d, data) {
106 | $scope.loadPaging();
107 | });
108 | $scope.$on("parentCtrl-to-postCtrl", function(d, data) {
109 | $scope.currentPage = 1;
110 | });
111 | $scope.$on("parentCtrl-to-myblogCtrl", function(d, data) {
112 | $scope.currentPage = 1;
113 | });
114 | }
115 | };
116 | });
--------------------------------------------------------------------------------
/public/javascripts/encryption.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
3 | * in FIPS PUB 180-1
4 | * Version 2.1-BETA Copyright Paul Johnston 2000 - 2002.
5 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
6 | * Distributed under the BSD License
7 | * See http://pajhome.org.uk/crypt/md5 for details.
8 | */
9 | /*
10 | * Configurable variables. You may need to tweak these to be compatible with
11 | * the server-side, but the defaults work in most cases.
12 | */
13 | var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
14 | var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
15 | var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
16 | /*
17 | * These are the functions you'll usually want to call
18 | * They take string arguments and return either hex or base-64 encoded strings
19 | */
20 | function hex_sha1(s) {
21 | return binb2hex(core_sha1(str2binb(s), s.length * chrsz));
22 | }
23 | function b64_sha1(s) {
24 | return binb2b64(core_sha1(str2binb(s), s.length * chrsz));
25 | }
26 | function str_sha1(s) {
27 | return binb2str(core_sha1(str2binb(s), s.length * chrsz));
28 | }
29 | function hex_hmac_sha1(key, data) {
30 | return binb2hex(core_hmac_sha1(key, data));
31 | }
32 | function b64_hmac_sha1(key, data) {
33 | return binb2b64(core_hmac_sha1(key, data));
34 | }
35 | function str_hmac_sha1(key, data) {
36 | return binb2str(core_hmac_sha1(key, data));
37 | }
38 | /*
39 | * Perform a simple self-test to see if the VM is working
40 | */
41 | function sha1_vm_test() {
42 | return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
43 | }
44 | /*
45 | * Calculate the SHA-1 of an array of big-endian words, and a bit length
46 | */
47 | function core_sha1(x, len) {
48 | /* append padding */
49 | x[len >> 5] |= 0x80 << (24 - len % 32);
50 | x[((len + 64 >> 9) << 4) + 15] = len;
51 | var w = Array(80);
52 | var a = 1732584193;
53 | var b = -271733879;
54 | var c = -1732584194;
55 | var d = 271733878;
56 | var e = -1009589776;
57 | for (var i = 0; i < x.length; i += 16) {
58 | var olda = a;
59 | var oldb = b;
60 | var oldc = c;
61 | var oldd = d;
62 | var olde = e;
63 | for (var j = 0; j < 80; j++) {
64 | if (j < 16) w[j] = x[i + j];
65 | else w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
66 | var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j)));
67 | e = d;
68 | d = c;
69 | c = rol(b, 30);
70 | b = a;
71 | a = t;
72 | }
73 | a = safe_add(a, olda);
74 | b = safe_add(b, oldb);
75 | c = safe_add(c, oldc);
76 | d = safe_add(d, oldd);
77 | e = safe_add(e, olde);
78 | }
79 | return Array(a, b, c, d, e);
80 | }
81 | /*
82 | * Perform the appropriate triplet combination function for the current
83 | * iteration
84 | */
85 | function sha1_ft(t, b, c, d) {
86 | if (t < 20) return (b & c) | ((~b) & d);
87 | if (t < 40) return b ^ c ^ d;
88 | if (t < 60) return (b & c) | (b & d) | (c & d);
89 | return b ^ c ^ d;
90 | }
91 | /*
92 | * Determine the appropriate additive constant for the current iteration
93 | */
94 | function sha1_kt(t) {
95 | return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : (t < 60) ? -1894007588 : -899497514;
96 | }
97 | /*
98 | * Calculate the HMAC-SHA1 of a key and some data
99 | */
100 | function core_hmac_sha1(key, data) {
101 | var bkey = str2binb(key);
102 | if (bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz);
103 | var ipad = Array(16),
104 | opad = Array(16);
105 | for (var i = 0; i < 16; i++) {
106 | ipad[i] = bkey[i] ^ 0x36363636;
107 | opad[i] = bkey[i] ^ 0x5C5C5C5C;
108 | }
109 | var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz);
110 | return core_sha1(opad.concat(hash), 512 + 160);
111 | }
112 | /*
113 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally
114 | * to work around bugs in some JS interpreters.
115 | */
116 | function safe_add(x, y) {
117 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
118 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
119 | return (msw << 16) | (lsw & 0xFFFF);
120 | }
121 | /*
122 | * Bitwise rotate a 32-bit number to the left.
123 | */
124 | function rol(num, cnt) {
125 | return (num << cnt) | (num >>> (32 - cnt));
126 | }
127 | /*
128 | * Convert an 8-bit or 16-bit string to an array of big-endian words
129 | * In 8-bit function, characters >255 have their hi-byte silently ignored.
130 | */
131 | function str2binb(str) {
132 | var bin = Array();
133 | var mask = (1 << chrsz) - 1;
134 | for (var i = 0; i < str.length * chrsz; i += chrsz)
135 | bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i % 32);
136 | return bin;
137 | }
138 | /*
139 | * Convert an array of big-endian words to a string
140 | */
141 | function binb2str(bin) {
142 | var str = "";
143 | var mask = (1 << chrsz) - 1;
144 | for (var i = 0; i < bin.length * 32; i += chrsz)
145 | str += String.fromCharCode((bin[i >> 5] >>> (24 - i % 32)) & mask);
146 | return str;
147 | }
148 | /*
149 | * Convert an array of big-endian words to a hex string.
150 | */
151 | function binb2hex(binarray) {
152 | var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
153 | var str = "";
154 | for (var i = 0; i < binarray.length * 4; i++) {
155 | str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);
156 | }
157 | return str;
158 | }
159 | /*
160 | * Convert an array of big-endian words to a base-64 string
161 | */
162 | function binb2b64(binarray) {
163 | var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
164 | var str = "";
165 | for (var i = 0; i < binarray.length * 4; i += 3) {
166 | var triplet = (((binarray[i >> 2] >> 8 * (3 - i % 4)) & 0xFF) << 16) | (((binarray[i + 1 >> 2] >> 8 * (3 - (i + 1) % 4)) & 0xFF) << 8) | ((binarray[i + 2 >> 2] >> 8 * (3 - (i + 2) % 4)) & 0xFF);
167 | for (var j = 0; j < 4; j++) {
168 | if (i * 8 + j * 6 > binarray.length * 32) str += b64pad;
169 | else str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);
170 | }
171 | }
172 | return str;
173 | }
--------------------------------------------------------------------------------
/public/javascripts/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/public/javascripts/service.js:
--------------------------------------------------------------------------------
1 | var myService = angular.module('myService', ['ngCookies']);
2 |
3 |
4 |
5 | myService.factory("User", ['$http', '$location', '$q', function($http, $location, $q) {
6 | var signIn;
7 | var currentUser = {};
8 | var user = {};
9 | user.checkDuplicate = function(_json) {
10 | return $http.post('/users/checkDuplicate', _json).then(function(resJson) {
11 | return $q.resolve(resJson.data);
12 | }).catch(function(err) {
13 | return $q.reject(err);
14 | });
15 | };
16 | user.postUser = function(_json) {
17 | return $http.post('/users/signup', _json).then(function(resJson) {
18 | if (resJson.data.status) {
19 | signIn = true;
20 | return $q.resolve(resJson.data.res);
21 | } else {
22 | return $q.reject();
23 | }
24 | }).catch(function(err) {
25 | return $q.reject(err);
26 | });
27 | };
28 | user.signinPost = function(_json) {
29 | return $http.post('/users/signin', _json).then(function(resJson) {
30 | if (resJson.data.status) {
31 | signIn = true;
32 | return $q.resolve(resJson.data.res);
33 | } else {
34 | return $q.reject(resJson.data.res);
35 | }
36 | }).catch(function(err) {
37 | return $q.reject(err);
38 | });
39 | };
40 | user.logOut = function() {
41 | return $http.get('/users/logout').then(function() {
42 | return $q.resolve();
43 | }).catch(function(err) {
44 | return $q.reject(err);
45 | });
46 | };
47 | user.checkIfsignin = function() {
48 | return $http.get('/users/checkIfsignin').then(function(resJson) {
49 | return resJson.data.status ? $q.resolve(resJson.data.res) : $q.reject();
50 | }).catch(function(err) {
51 | return $q.reject(err);
52 | });
53 | };
54 | user.setSignin = function(value) {
55 | signIn = value;
56 | };
57 | user.getSignin = function() {
58 | return signIn;
59 | };
60 | user.setUser = function(_json) {
61 | currentUser = _json;
62 | };
63 | user.getUser = function() {
64 | return currentUser;
65 | };
66 |
67 | return user;
68 | }]);
69 |
70 | myService.factory("DataCheck", function() {
71 | var _password;
72 | var registInfo = {
73 | username: '6~18位英文字母、数字或下划线,必须以英文字母开头',
74 | password: '6~12位数字、大小写字母、中划线、下划线',
75 | repassword: '请重复输入密码',
76 | nikiname: '这个为昵称, 英文字母、数字或下划线',
77 | email: '请输入常用邮箱'
78 | };
79 | var signinInfo = {
80 | 'empty':'不能为空',
81 | 'username': '用户不存在',
82 | 'password': '密码错误'
83 | };
84 | var regist = {
85 | username: function(message) {
86 | if ("" === message) return "不能为空";
87 | else if (message.length < 6) return "不得少于6位";
88 | else if (message.length > 18) return "不得多于18位";
89 | else if (!/^[a-z]/i.test(message)) return "必须以英文字母开头";
90 | else if (!/^\w*$/.test(message)) return "只能是英文字母、数字或下划线";
91 | else return "ok";
92 | },
93 | password: function(message) {
94 | if ("" === message) return "不能为空";
95 | else if (message.length < 6 || message.length > 12) return "密码得6-12位";
96 | else if (!/^[a-z0-9_\-]*$/i.test(message)) return "密码得有数字,大小写字母,下划线,中划线构成";
97 | else {
98 | _password = message;
99 | return "ok";
100 | }
101 | },
102 | repassword: function(message) {
103 | if ("" === message) return "不能为空";
104 | else return _password == message ? "ok" : "两次输入密码不一致";
105 | },
106 | nikiname: function(message) {
107 | if ("" === message) return "不能为空";
108 | else return /^\w*$/.test(message) ? "ok" : "只能是英文字母、数字或下划线";
109 | },
110 | email: function(message) {
111 | if ("" === message) return "不能为空";
112 | else if (!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(message)) return "邮箱格式非法";
113 | else return "ok";
114 | }
115 | };
116 | return {
117 | regist: regist,
118 | registInfo: registInfo,
119 | signinInfo: signinInfo
120 | };
121 | });
122 |
123 |
124 | myService.factory("Comment", ['$http', '$location', '$q', '$cookies', '$cookieStore', 'Post', function($http, $location, $q, $cookies, $cookieStore, Post) {
125 | var comments = [];
126 | var comment = {};
127 | comment.loadComment = function() {
128 | return $http.post('/comments/getComment', {id: $cookieStore.get("currentPost")._id}).then(function(resJson) {
129 | if (resJson.data.status) {
130 | comments = resJson.data.comments;
131 | return $q.resolve(resJson.data.comments);
132 | }
133 | else return $q.reject(resJson.data.err);
134 | }).catch(function(err) {
135 | return $q.reject(err);
136 | });
137 | };
138 | comment.addComment = function(dataJson) {
139 | return $http.post('/comments/addComment', dataJson).then(function(resJson) {
140 | if (resJson.data.status) return $q.resolve();
141 | else return $q.reject(resJson.data.err);
142 | }).catch(function(err) {
143 | return $q.reject(err);
144 | });
145 | };
146 | comment.getComments = function() {
147 | return comments;
148 | };
149 | comment.setComments = function(dataJson) {
150 | comments = dataJson;
151 | };
152 | comment.deleteComment = function(dataJson) {
153 | return $http.post('/comments/deleteComment', {_id: dataJson}).then(function(resJson) {
154 | if (resJson.data.status) return $q.resolve();
155 | else return $q.reject();
156 | }).catch(function(err) {
157 | return $q.reject(err);
158 | });
159 | };
160 | comment.editCommentstatus = function(dataJson) {
161 | return $http.post('/comments/editCommentstatus', {_id: dataJson}).then(function(resJson) {
162 | if (resJson.data.status) return $q.resolve();
163 | return $q.reject();
164 | }).catch(function(err) {
165 | return $q.reject(err);
166 | });
167 | };
168 | comment.editComment = function(dataJson) {
169 | return $http.post('/comments/editComment', dataJson).then(function(resJson) {
170 | if (resJson.data.status) return $q.resolve();
171 | else return $q.reject();
172 | }).catch(function() {
173 | return $q.reject();
174 | });
175 | };
176 | comment.cancel = function(dataJson) {
177 | return $http.post('/comments/cancel', {_id: dataJson}).then(function() {
178 | return $q.resolve();
179 | }).catch(function(err) {
180 | return $q.reject(err);
181 | });
182 | };
183 | comment.showComment = function(dataJson) {
184 | return $http.post('/comments/showComment', {_id: dataJson}).then(function(resJson) {
185 | return resJson.data.status ? $q.resolve() : $q.reject();
186 | });
187 | };
188 | comment.hideComment = function(dataJson) {
189 | return $http.post('/comments/hideComment', {_id: dataJson}).then(function(resJson) {
190 | return resJson.data.status ? $q.resolve() : $q.reject();
191 | });
192 | };
193 | return comment;
194 | }]);
195 |
196 |
197 | app.factory("Post", ['$http', '$location', '$q', '$cookies', '$cookieStore', function($http, $location, $q, $cookies, $cookieStore) {
198 | var currentPost = {};
199 | var post = {};
200 | var posts = [];
201 | var editPost = {};
202 | var ifEdit = false;
203 | var isSearch = false;
204 | post.submitPost = function(dataJson) {
205 | return $http.post('/posts/addPost', dataJson).then(function(resJson) {
206 | if (resJson.data.status) return $q.resolve();
207 | else return $q.reject();
208 | }).catch(function(err) {
209 | return $q.reject(err);
210 | });
211 | };
212 |
213 | post.loadPost = function() {
214 | if (isSearch) {
215 | var temps = [];
216 | if (posts.length > 7)
217 | temps = posts.slice(0, 7);
218 | else
219 | temps = posts;
220 | isSearch = false;
221 | return $q.resolve(temps);
222 | } else {
223 | return $http.get('/posts/getAllPost').then(function(resJson) {
224 | if (!resJson.data.status) return $q.reject();
225 | var temps = [];
226 | posts = resJson.data.posts;
227 | if (posts.length > 7)
228 | temps = posts.slice(0, 7);
229 | else
230 | temps = posts;
231 | return $q.resolve(temps);
232 | }).catch(function(err) {
233 | return $q.reject(err);
234 | });
235 | }
236 | };
237 | post.getPostNumbers = function() {
238 | return posts.length;
239 | };
240 | post.getPostByClickPage = function(item) {
241 | var end = item * 7;
242 | var start = (item - 1) * 7;
243 | var temps = [];
244 | if (end > posts.length)
245 | temps = posts.slice(start, posts.length);
246 | else
247 | temps = posts.slice(start, end);
248 | return $q.resolve(temps);
249 | };
250 | post.getPostByKeyWord = function(dataJson) {
251 | return $http.post('/posts/getPostByKeyWord', {keyWord: dataJson}).then(function(resJson) {
252 | if (!resJson.data.status) return $q.reject();
253 | posts = resJson.data.posts;
254 | isSearch = true;
255 | return $q.resolve(posts);
256 | }).catch(function(err) {
257 | return $q.reject(err);
258 | });
259 | };
260 | post.getPostByKeyWordAndAuthor = function(dataJson) {
261 | return $http.post('/posts/getPostByKeyWordAndAuthor', {keyWord: dataJson}).then(function(resJson) {
262 | if (!resJson.data.status) return $q.reject();
263 | posts = resJson.data.posts;
264 | isSearch = true;
265 | return $q.resolve(posts);
266 | }).catch(function(err) {
267 | return $q.reject(err);
268 | });
269 | };
270 | post.loadPostByauthor = function() {
271 | if (isSearch) {
272 | var temps = [];
273 | if (posts.length > 7)
274 | temps = posts.slice(0, 7);
275 | else
276 | temps = posts;
277 | isSearch = false;
278 | return $q.resolve(temps);
279 | } else {
280 | return $http.get('/posts/getPostByauthor').then(function(resJson) {
281 | if (!resJson.data.status) return $q.reject();
282 | var temps = [];
283 | posts = resJson.data.post;
284 | if (posts.length > 7)
285 | temps = posts.slice(0, 7);
286 | else
287 | temps = posts;
288 | return $q.resolve(temps);
289 | }).catch(function(err) {
290 | return $q.reject(err);
291 | });
292 | }
293 | };
294 | post.deletePost = function() {
295 | var item = $cookieStore.get('currentPost')._id;
296 | return $http.post('/posts/deletePost', {_id: item}).then(function(resJson) {
297 | if (resJson.data.status)
298 | return $q.resolve();
299 | else
300 | return $q.reject();
301 | }).catch(function(err) {
302 | return $q.reject(err);
303 | });
304 | };
305 |
306 | post.getPostById = function(item) {
307 | return $http.post('/posts/getPostById', {_id: item}).then(function(resJson) {
308 | if (!resJson.data.status) return $q.reject();
309 | currentPost = resJson.data.post;
310 | $cookieStore.put('currentPost', resJson.data.post);
311 | return $q.resolve();
312 | }).catch(function(err) {
313 | return $q.reject(err);
314 | });
315 | };
316 | post.getPostBy_Id = function() {
317 | var item = $cookieStore.get('currentPost')._id;
318 | return $http.post('/posts/getPostContent', {_id: item}).then(function(resJson) {
319 | if (resJson.data.status)
320 | return $q.resolve(resJson.data.post.content);
321 | else
322 | return $q.reject();
323 | });
324 | };
325 | post.showPost = function(item) {
326 | return $http.post('/posts/showPost', {_id: item}).then(function(resJson) {
327 | if (resJson.data.status) {
328 | var cur = $cookieStore.get('currentPost');
329 | cur.isHide = false;
330 | $cookieStore.put('currentPost', cur);
331 | return $q.resolve();
332 | } else {
333 | return $q.reject();
334 | }
335 | }).catch(function(err) {
336 | return $q.reject(err);
337 | });
338 | };
339 | post.hidePost = function(item) {
340 | return $http.post('/posts/hidePost', {_id: item}).then(function(resJson) {
341 | if (resJson.data.status) {
342 | var cur = $cookieStore.get('currentPost');
343 | cur.isHide = true;
344 | $cookieStore.put('currentPost', cur);
345 | return $q.resolve();
346 | } else {
347 | return $q.reject();
348 | }
349 | }).catch(function(err) {
350 | return $q.reject(err);
351 | });
352 | };
353 |
354 | return post;
355 | }]);
--------------------------------------------------------------------------------
/public/javascripts/validdata.js:
--------------------------------------------------------------------------------
1 | var validdata = {
2 | username: function(message) {
3 | if ("" == message) return "不能为空";
4 | else if (message.length < 6) return "不得少于6位";
5 | else if (message.length > 18) return "不得多于18位";
6 | else if (!/^[a-z]/i.test(message)) return "必须以英文字母开头";
7 | else if (!/^\w*$/.test(message)) return "只能是英文字母、数字或下划线";
8 | else return "ok";
9 | },
10 | email: function(message) {
11 | if ("" == message) return "不能为空";
12 | else if (!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(message)) return "邮箱格式非法";
13 | else return "ok";
14 | },
15 | password: function(message) {
16 | if ("" == message) return "不能为空";
17 | else if (message.length < 6 || message.length > 12) return "密码得6-12位";
18 | else if (!/^[a-z0-9_\-]*$/i.test(message)) return "密码得有数字,大小写字母,下划线,中划线构成";
19 | else {
20 | _password = message;
21 | return "ok";
22 | }
23 | },
24 | repassword: function(message) {
25 | if ("" == message) return "不能为空";
26 | else return _password == message ? "ok" : "两次输入密码不一致";
27 | },
28 | nikiname: function(message) {
29 | if ("" == message) return "不能为空";
30 | else return /^\w*$/.test(message) ? "ok" : "只能是英文字母、数字或下划线";
31 | }
32 | };
33 |
34 |
35 | var _password;
36 |
37 |
38 | if (typeof module == 'object') {
39 | module.exports = validdata;
40 | }
--------------------------------------------------------------------------------
/public/stylesheets/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | font-family: "Arial";
3 | }
4 |
5 |
6 | html,
7 | body {
8 | padding: 0;
9 | margin: 0;
10 | height: 100%;
11 | }
12 |
13 | .parent {
14 | position: relative;
15 | width: 100%;
16 | min-height: 100%;
17 | height: auto !important;
18 | }
19 |
20 | .mainView {
21 | padding: 0;
22 | height: 5%;
23 | background-color: white;
24 | }
25 |
26 | .myblogView{
27 | padding: 0;
28 | height: 100%;
29 | background-color: white;
30 | }
31 |
32 | .footer {
33 | position: absolute;
34 | bottom: 0;
35 | width: 100%;
36 | height: 20px;
37 | background-color: rgb(248, 248, 248);
38 | text-align: center;
39 | color: #777;
40 | }
41 |
42 |
43 | .btn:active,
44 | .btn:focus {
45 | outline: none;
46 | }
47 |
48 | .btn-active {
49 | background-color: #00a1d6 !important;
50 | }
51 | #navbar {
52 | margin-bottom: 0;
53 | }
54 |
55 |
56 | .myblogView{
57 | padding: 0;
58 | height: 100%;
59 | background-color: white;
60 | }
61 |
62 | .paging {
63 | position: absolute;
64 | bottom: 13px;
65 | }
66 |
67 |
68 | .navView {
69 | width: 100%;
70 | }
71 |
72 | .writepostView,
73 | .contentView {
74 | position: relative;
75 | min-height: 900px;
76 | }
77 |
78 | .wirtepostviewsecondchild {
79 | position: relative;
80 | margin-top: 5%;
81 | height: 70px;
82 | width: 100%;
83 | }
84 |
85 | .writepostviewchildView>input {
86 | min-height: 30px;
87 | margin-top: 5%;
88 | margin-bottom: 5%;
89 | }
90 |
91 | .fadeView {
92 | position: absolute;
93 | left: 0;
94 | top: 0;
95 | z-index: 1;
96 | height: 100%;
97 | width: 100%;
98 | background-color: #595959;
99 | opacity: 0.5;
100 | }
101 |
102 | .postView {
103 | position: absolute;
104 | left: 0;
105 | top: 0;
106 | width: 100%;
107 | min-height: 100%;
108 | z-index: 3;
109 | background-color: white;
110 | }
111 | .postView>div {
112 | background-color: white;
113 | }
114 |
115 | .signinView,
116 | .signupView,
117 | .infoFrame {
118 | border-radius: 10px;
119 | }
120 |
121 | @keyframes myAnimate {
122 | from {top: 0%;}
123 | to {top: 20%;}
124 | }
125 |
126 | .signinView,
127 | .signupView {
128 | position: absolute;
129 | left: 50%;
130 | margin-left: -200px;
131 | z-index: 2;
132 | animation: myAnimate .8s;
133 | box-shadow: 0 0 2px #e7e7e7;
134 | background-color: white;
135 | }
136 |
137 | .signinView {
138 | top: 20%;
139 | width: 400px;
140 | height: 270px;
141 | }
142 |
143 | .signupView {
144 | top: 20%;
145 | width: 400px;
146 | height: 500px;
147 | }
148 |
149 | .infoFrame {
150 | position: absolute;
151 | top: 20%;
152 | left: 50%;
153 | z-index: 2;
154 | width: 400px;
155 | height: 270px;
156 | line-height: 200px;
157 | text-align: center;
158 | margin-left: -200px;
159 | animation: myAnimate .8s;
160 | box-shadow: 0 0 2px #e7e7e7;
161 | background-color: white;
162 | }
163 |
164 | .infoStyle {
165 | font-size: 18pt;
166 | }
167 |
168 | .signinButton {
169 | margin-top: 20px;
170 | width: 80%;
171 | height: 40px;
172 | }
173 |
174 | .signinBButton {
175 | width: 100%;
176 | }
177 |
178 | .myclose {
179 | position: absolute;
180 | right: 3px;
181 | top: 3px;
182 | color: #4A4A4A;
183 | }
184 |
185 | .myclose:hover {
186 | transform: scale(1.05);
187 | }
188 |
189 | .pointStyle {
190 | cursor: pointer;
191 | }
192 |
193 |
194 | .inputTitle {
195 | margin-bottom: 20px;
196 | width: 300px;
197 | }
198 |
199 | .buttonPost {
200 | position: absolute;
201 | top: 40px;
202 | right: 10%;
203 | }
204 |
205 | .list-title {
206 | color: black;
207 | }
208 | .list-foot {
209 | color: #999999;
210 | font-size: 14px;
211 | font-weight: normal;
212 | margin-top: 20px;
213 | }
214 |
215 | .list-foot .offset {
216 | margin-left: 10px;
217 | }
218 | .myListstyle {
219 | position: relative;
220 | height: 5%;
221 | margin-top: 5px;
222 | margin-bottom: 5px;
223 | }
224 | .myListstyle>h2 {
225 | border-left: 3px solid #404040;
226 | }
227 |
228 | .myListstyle a:link,
229 | .myListstyle a:visited {
230 | text-decoration: none;
231 | }
232 |
233 | .list-title,
234 | .list-foot {
235 | margin-left: 12px;
236 | }
237 |
238 | .btn-mystyle {
239 | position: absolute;
240 | right: 3%;
241 | top: 50%;
242 | margin-top: -10px;
243 | }
244 |
245 |
246 |
247 |
248 | /*文章详情*/
249 | .detail {
250 | position: relative;
251 | margin-left: auto;
252 | margin-right: auto;
253 | margin-top: 20px;
254 | min-height: 700px;
255 | width: 60%;
256 | border-radius: 10px;
257 | }
258 |
259 |
260 | .detail-title {
261 | position: relative;
262 | margin-right: auto;
263 | margin-left: auto;
264 | margin-top: 40px;
265 | text-align: center;
266 | width: 40%;
267 | }
268 |
269 | .detail-article {
270 | position: relative;
271 | margin-right: auto;
272 | margin-left: auto;
273 | font-size: 16px;
274 | width: 50%;
275 | }
276 | .detail-author {
277 | position: relative;
278 | margin-right: auto;
279 | margin-left: auto;
280 | width: 40%;
281 | color: #999999;
282 | font-size: 15px;
283 | text-align: center;
284 | }
285 |
286 |
287 | .detail-author>span {
288 | margin-left: 15px;
289 | }
290 |
291 | .detail-operator {
292 | position: absolute;
293 | font-size: 15px;
294 | color: #999999;
295 | right: 10%;
296 | top: -15px;
297 | }
298 |
299 | .detail-operator>span {
300 | margin-left: 15px;
301 | }
302 |
303 | .detail-comment {
304 | position: relative;
305 | margin-left: auto;
306 | margin-right: auto;
307 | margin-top: 50px;
308 | width: 60%;
309 | }
310 |
311 | .detail-comment>h4,
312 | .detail-comment>p,
313 | .detail-comment #commentWarn {
314 | text-align: center;
315 | margin-top: 15px;
316 | margin-bottom: 15px;
317 | }
318 |
319 | .detailButton {
320 | margin-left: 6px;
321 | }
322 |
323 | .detailButton>a:link,
324 | .detailButton>a:visited {
325 | color: white;
326 | text-decoration: none;
327 | }
328 | /*输入评论部分*/
329 | .detail-comment-input {
330 | position: relative;
331 | margin-left: auto;
332 | margin-right: auto;
333 | min-height: 60px;
334 | width: 95%;
335 | }
336 |
337 | .detail-comment-input>textarea {
338 | position: relative;
339 | width: 80%;
340 | height: 60px;
341 | margin-right: 10px;
342 | margin-left: 100px;
343 | resize: none;
344 | display: inline-block;
345 | }
346 | .detail-comment-input>button {
347 | position: absolute;
348 | margin-left: 10px;
349 | height: 60px;
350 | width: 60px;
351 | padding: 0;
352 | background-color: #00a1d5;
353 | border: 1px solid #00a1d6;
354 | border-radius: 2px;
355 | color: white;
356 | display: inline-block;
357 | }
358 |
359 | .detail-comment-input>img {
360 | position: absolute;
361 | left: 0;
362 | height: 60px;
363 | width: 60px;
364 | }
365 | /*评论列表*/
366 | .commentList {
367 | position: relative;
368 | margin-left: auto;
369 | margin-right: auto;
370 | min-height: 100px;
371 | width: 95%;
372 | margin-top: 20px;
373 | }
374 |
375 | .commentList p {
376 | position: relative;
377 | margin-left: 90px;
378 | min-height: 60px;
379 | width: 80%;
380 | font-size: 17px;
381 | }
382 |
383 | .comment-author {
384 | position: relative;
385 | margin-left: 80px;
386 | font-size: 16px;
387 | color: #6d757a;
388 | }
389 | .comment-content {
390 | margin-top: 10px;
391 | margin-left: 10px;
392 | }
393 | .commentList img {
394 | position: absolute;
395 | left: 0;
396 | width: 60px;
397 | height: 60px;
398 | }
399 |
400 | .comment-footer {
401 | position: relative;
402 | margin-left: 80px;
403 | font-size: 11px;
404 | color: #999999;
405 | }
406 |
407 | .comment-footer>span {
408 | margin-right: 5px;
409 | }
410 |
411 | .comment-footer>a:link,
412 | .comment-footer>a:visited {
413 | color: #999999;
414 | text-decoration: none;
415 | }
416 |
417 | .edit-comment-input {
418 | position: absolute;
419 | left: 80px;
420 | height: 60px;
421 | width: 90%;
422 | }
423 |
424 | .edit-comment-input>textarea {
425 | height: 60px;
426 | width: 80%;
427 | resize: none;
428 | }
429 | .edit-comment-button-group {
430 | position: absolute;
431 | margin-left: 20px;
432 | display: inline-block;
433 | }
434 | .edit-comment-button-group>button {
435 | margin-top: 2px;
436 | margin-bottom: 2px;
437 | height: 25px;
438 | width: 60px;
439 | border: 1px solid #00a1d6;
440 | border-radius: 2px;
441 | background-color: #00a1d5;
442 | color: white;
443 | display: block;
444 | }
445 |
446 | /*提示隐藏信息*/
447 | .hideInfo {
448 | font-size: 15px !important;
449 | margin-left: 10px;
450 | background-color: #e7e7e7;
451 | }
452 |
453 | /*信息提示框*/
454 | .errorAlert {
455 | opacity: 0;
456 | height: 20px;
457 | background-color: #E9967A;
458 | border-radius: 3px;
459 | color: white;
460 | padding-right: 5px;
461 | padding-left: 5px;
462 | }
463 |
464 | .arrow {
465 | position: absolute;
466 | bottom: -16px;
467 | width: 0px;
468 | height: 0px;
469 | border-width: 10px 10px 10px 10px;
470 | border-left-color: transparent;
471 | border-right-color: transparent;
472 | border-top-color: #E9967A;
473 | border-bottom-color: transparent;
474 | border-style: solid;
475 | }
476 |
477 | .AlertPosit-sign {
478 | position: absolute;
479 | left: 42px;
480 | margin-top: -58px;
481 | }
482 |
483 | .AlertPosit-wirte {
484 | position: absolute;
485 | left: 85%;
486 | top: 15px;
487 | }
488 |
489 | .AlertPosit-detail {
490 | position: absolute;
491 | left: 15%;
492 | top: -25px;
493 | }
494 |
495 | .show {
496 | opacity: 1 !important;
497 | transition: all .5s;
498 | }
499 |
500 | .lastPage {
501 | color: #999999;
502 | }
503 |
504 | .o {
505 | position: relative;
506 | top: 20px;
507 | }
--------------------------------------------------------------------------------
/public/stylesheets/textAngular.css:
--------------------------------------------------------------------------------
1 |
2 | .ta-hidden-input {
3 |
4 | width: 1px;
5 |
6 | height: 1px;
7 |
8 | border: none;
9 |
10 | margin: 0;
11 |
12 | padding: 0;
13 |
14 | position: absolute;
15 |
16 | top: -10000px;
17 |
18 | left: -10000px;
19 |
20 | opacity: 0;
21 |
22 | overflow: hidden;
23 |
24 | }
25 |
26 |
27 |
28 | /* add generic styling for the editor */
29 |
30 | .ta-root.focussed > .ta-scroll-window.form-control {
31 |
32 | border-color: #66afe9;
33 |
34 | outline: 0;
35 |
36 | -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
37 |
38 | -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
39 |
40 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
41 |
42 | }
43 |
44 |
45 |
46 | .ta-editor.ta-html, .ta-scroll-window.form-control {
47 |
48 | min-height: 300px;
49 |
50 | height: auto;
51 |
52 | overflow: auto;
53 |
54 | font-family: inherit;
55 |
56 | font-size: 100%;
57 |
58 | }
59 |
60 |
61 |
62 | .ta-scroll-window.form-control {
63 |
64 | position: relative;
65 |
66 | padding: 0;
67 |
68 | }
69 |
70 |
71 |
72 | .ta-scroll-window > .ta-bind {
73 |
74 | height: auto;
75 |
76 | min-height: 500px;
77 |
78 | padding: 6px 12px;
79 |
80 | }
81 |
82 |
83 |
84 | .ta-editor:focus {
85 |
86 | user-select: text;
87 |
88 | }
89 |
90 |
91 |
92 | /* add the styling for the awesomness of the resizer */
93 |
94 | .ta-resizer-handle-overlay {
95 |
96 | z-index: 100;
97 |
98 | position: absolute;
99 |
100 | display: none;
101 |
102 | }
103 |
104 |
105 |
106 | .ta-resizer-handle-overlay > .ta-resizer-handle-info {
107 |
108 | position: absolute;
109 |
110 | bottom: 16px;
111 |
112 | right: 16px;
113 |
114 | border: 1px solid black;
115 |
116 | background-color: #FFF;
117 |
118 | padding: 0 4px;
119 |
120 | opacity: 0.7;
121 |
122 | }
123 |
124 |
125 |
126 | .ta-resizer-handle-overlay > .ta-resizer-handle-background {
127 |
128 | position: absolute;
129 |
130 | bottom: 5px;
131 |
132 | right: 5px;
133 |
134 | left: 5px;
135 |
136 | top: 5px;
137 |
138 | border: 1px solid black;
139 |
140 | background-color: rgba(0, 0, 0, 0.2);
141 |
142 | }
143 |
144 |
145 |
146 | .ta-resizer-handle-overlay > .ta-resizer-handle-corner {
147 |
148 | width: 10px;
149 |
150 | height: 10px;
151 |
152 | position: absolute;
153 |
154 | }
155 |
156 |
157 |
158 | .ta-resizer-handle-overlay > .ta-resizer-handle-corner-tl{
159 |
160 | top: 0;
161 |
162 | left: 0;
163 |
164 | border-left: 1px solid black;
165 |
166 | border-top: 1px solid black;
167 |
168 | }
169 |
170 |
171 |
172 | .ta-resizer-handle-overlay > .ta-resizer-handle-corner-tr{
173 |
174 | top: 0;
175 |
176 | right: 0;
177 |
178 | border-right: 1px solid black;
179 |
180 | border-top: 1px solid black;
181 |
182 | }
183 |
184 |
185 |
186 | .ta-resizer-handle-overlay > .ta-resizer-handle-corner-bl{
187 |
188 | bottom: 0;
189 |
190 | left: 0;
191 |
192 | border-left: 1px solid black;
193 |
194 | border-bottom: 1px solid black;
195 |
196 | }
197 |
198 |
199 |
200 | .ta-resizer-handle-overlay > .ta-resizer-handle-corner-br{
201 |
202 | bottom: 0;
203 |
204 | right: 0;
205 |
206 | border: 1px solid black;
207 |
208 | cursor: se-resize;
209 |
210 | background-color: white;
211 |
212 | }
213 |
214 |
215 |
216 | /* copy the popover code from bootstrap so this will work even without it */
217 |
218 | .popover {
219 |
220 | position: absolute;
221 |
222 | top: 0;
223 |
224 | left: 0;
225 |
226 | z-index: 1060;
227 |
228 | display: none;
229 |
230 | max-width: 276px;
231 |
232 | padding: 1px;
233 |
234 | font-size: 14px;
235 |
236 | font-weight: normal;
237 |
238 | line-height: 1.42857143;
239 |
240 | text-align: left;
241 |
242 | white-space: normal;
243 |
244 | background-color: #fff;
245 |
246 | -webkit-background-clip: padding-box;
247 |
248 | background-clip: padding-box;
249 |
250 | border: 1px solid #ccc;
251 |
252 | border: 1px solid rgba(0, 0, 0, .2);
253 |
254 | border-radius: 6px;
255 |
256 | -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
257 |
258 | box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
259 |
260 | }
261 |
262 | .popover.top {
263 |
264 | margin-top: -10px;
265 |
266 | }
267 |
268 | .popover.bottom {
269 |
270 | margin-top: 10px;
271 |
272 | }
273 |
274 | .popover-title {
275 |
276 | padding: 8px 14px;
277 |
278 | margin: 0;
279 |
280 | font-size: 14px;
281 |
282 | background-color: #f7f7f7;
283 |
284 | border-bottom: 1px solid #ebebeb;
285 |
286 | border-radius: 5px 5px 0 0;
287 |
288 | }
289 |
290 | .popover-content {
291 |
292 | padding: 9px 14px;
293 |
294 | }
295 |
296 | .popover > .arrow,
297 |
298 | .popover > .arrow:after {
299 |
300 | position: absolute;
301 |
302 | display: block;
303 |
304 | width: 0;
305 |
306 | height: 0;
307 |
308 | border-color: transparent;
309 |
310 | border-style: solid;
311 |
312 | }
313 |
314 | .popover > .arrow {
315 |
316 | border-width: 11px;
317 |
318 | }
319 |
320 | .popover > .arrow:after {
321 |
322 | content: "";
323 |
324 | border-width: 10px;
325 |
326 | }
327 |
328 | .popover.top > .arrow {
329 |
330 | bottom: -11px;
331 |
332 | left: 50%;
333 |
334 | margin-left: -11px;
335 |
336 | border-top-color: #999;
337 |
338 | border-top-color: rgba(0, 0, 0, .25);
339 |
340 | border-bottom-width: 0;
341 |
342 | }
343 |
344 | .popover.top > .arrow:after {
345 |
346 | bottom: 1px;
347 |
348 | margin-left: -10px;
349 |
350 | content: " ";
351 |
352 | border-top-color: #fff;
353 |
354 | border-bottom-width: 0;
355 |
356 | }
357 |
358 | .popover.bottom > .arrow {
359 |
360 | top: -11px;
361 |
362 | left: 50%;
363 |
364 | margin-left: -11px;
365 |
366 | border-top-width: 0;
367 |
368 | border-bottom-color: #999;
369 |
370 | border-bottom-color: rgba(0, 0, 0, .25);
371 |
372 | }
373 |
374 | .popover.bottom > .arrow:after {
375 |
376 | top: 1px;
377 |
378 | margin-left: -10px;
379 |
380 | content: " ";
381 |
382 | border-top-width: 0;
383 |
384 | border-bottom-color: #fff;
385 |
386 | }
--------------------------------------------------------------------------------
/public/template/listPost.html:
--------------------------------------------------------------------------------
1 |
2 |
以下为文章列表
3 |
以下为搜索结果
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |

12 |

13 |
14 |
--------------------------------------------------------------------------------
/public/template/myblog.html:
--------------------------------------------------------------------------------
1 |
2 |
以下为您的博客列表
3 |
以下为您的博客搜索结果
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |

12 |

13 |
14 |
--------------------------------------------------------------------------------
/public/template/noSignin.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 请先登陆
6 |
7 |
--------------------------------------------------------------------------------
/public/template/paging.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 | ...
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/public/template/postDetail.html:
--------------------------------------------------------------------------------
1 |
2 |
返回主页
3 |
4 |
5 | 隐藏
6 | 显示
7 | 修改
8 | 删除
9 |
10 |
{{post.title}}
11 |
发布时间: {{post.date | date: 'yyyy-MM-dd HH:mm'}} 作者: {{post.author}}
12 |
13 |
14 |
15 |
该内容已被管理员隐藏
16 |
17 |
18 |
19 |
57 |
--------------------------------------------------------------------------------
/public/template/signin.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/template/signup.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/template/writePost.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/routes/comments.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 |
5 | module.exports = function (db) {
6 | var commentControllers = require('../controllers/commentControllers.js')(db);
7 |
8 |
9 | router.post('/getComment', function(req, res, next) {
10 | commentControllers.getComment(req.body).then(function(resJson) {
11 | res.json({status: true, comments: resJson});
12 | }).catch(function(err) {
13 | res.json({status: false, err: err});
14 | });
15 | });
16 | router.post('/addComment', function(req, res, next) {
17 | commentControllers.addComment(req.body).then(function() {
18 | res.json({status: true});
19 | }).catch(function(err) {
20 | res.json({status: false, err: err});
21 | });
22 | });
23 | router.post('/deleteComment', function(req, res, next) {
24 | commentControllers.deleteComment(req.body).then(function() {
25 | res.json({status: true});
26 | }).catch(function(err) {
27 | res.json({status: false});
28 | });
29 | });
30 | router.post('/editCommentstatus', function(req, res, next) {
31 | commentControllers.editCommentstatus(req.body).then(function() {
32 | res.json({status: true});
33 | }).catch(function(err) {
34 | res.json({status: false});
35 | });
36 |
37 | });
38 | router.post('/editComment', function(req, res, next) {
39 | commentControllers.editComment(req.body).then(function() {
40 | res.json({status: true});
41 | }).catch(function(err) {
42 | res.json({status: false});
43 | });
44 | });
45 | router.post('/cancel', function(req, res, next) {
46 | commentControllers.cancel().then(function() {
47 | res.json({status: true});
48 | });
49 | });
50 | router.get('/cancelAll', function(req, res, next) {
51 | commentControllers.cancelAll().then(function() {
52 | res.json({status: true});
53 | }).catch(function(err) {
54 | res.json({status: false});
55 | });
56 | });
57 | router.post('/hideComment', function(req, res, next) {
58 | if (req.cookies.username === 'admin') {
59 | commentControllers.hideComment(req.body).then(function() {
60 | res.json({status: true});
61 | }).catch(function(err) {
62 | res.json({status: false});
63 | });
64 | } else {
65 | res.json({status: false});
66 | }
67 | });
68 | router.post('/showComment', function(req, res, next) {
69 | if (req.cookies.username === 'admin') {
70 | commentControllers.showComment(req.body).then(function() {
71 | res.json({status: true});
72 | }).catch(function(err) {
73 | res.json({status: false});
74 | });
75 | } else {
76 | res.json({status: false});
77 | }
78 | });
79 | return router;
80 | };
--------------------------------------------------------------------------------
/routes/index.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | var path = require('path');
4 | /* GET home page. */
5 |
6 | module.exports = function(db) {
7 | router.get('/', function(req, res, next) {
8 | res.sendFile('index.html', { root: path.join(__dirname, '../views') });
9 | });
10 | router.get('/favicon.ico', function(req, res, next) {
11 | res.end();
12 | });
13 | return router;
14 | };
--------------------------------------------------------------------------------
/routes/post.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 |
5 | module.exports = function(db) {
6 | var postController = require("../controllers/postControllers.js")(db);
7 |
8 | router.get('/getAllPost', function (req, res, next) {
9 | postController.getAllPost().then(function(resJson) {
10 | res.json({status: true, posts: resJson});
11 | }).catch(function(err) {
12 | res.json({status: false});
13 | });
14 | });
15 |
16 | router.post('/getPostById', function(req, res, next) {
17 | postController.getPostById(req.body).then(function(resJson) {
18 | res.json({status: true, post: resJson});
19 | }).catch(function(err) {
20 | res.Json({status: false});
21 | });
22 | });
23 |
24 | router.get('/getPostByauthor', function(req, res, next) {
25 | if (typeof req.cookies.username !== 'undefined') {
26 | postController.getPostByAuthor(req.cookies.username).then(function(resJson) {
27 | res.json({status: true, post: resJson});
28 | }).catch(function(err) {
29 | res.json({status: false});
30 | });
31 | } else {
32 | res.json({status: false});
33 | }
34 | });
35 |
36 | router.post('/getPostByKeyWord', function(req, res, next) {
37 | postController.getPostByKeyWord(req.body).then(function(resJson) {
38 | res.json({status: true, posts: resJson});
39 | }).catch(function(err) {
40 | res.json({status: false});
41 | });
42 | });
43 |
44 | router.post('/getPostByKeyWordAndAuthor', function(req, res, next) {
45 | if (typeof req.cookies.username !== 'undefined') {
46 | postController.getPostByKeyWordAndAuthor({keyWord: req.body.keyWord, authorUsername: req.cookies.username}).then(function(resJson) {
47 | res.json({status: true, posts: resJson});
48 | }).catch(function(err) {
49 | res.json({status: false});
50 | });
51 | } else {
52 | res.json({status: false});
53 | }
54 | });
55 |
56 | router.post('/getPostContent', function(req, res, next) {
57 | postController.getPostContent(req.body).then(function(resJson) {
58 | res.json({status: true, post: resJson});
59 | }).catch(function(err) {
60 | res.json({status: false});
61 | });
62 | });
63 | router.post('/deletePost', function(req, res, next) {
64 | postController.deletePost(req.body).then(function() {
65 | res.json({status: true});
66 | }).catch(function(err) {
67 | res.json({status: false});
68 | });
69 | });
70 |
71 | router.post('/addPost', function(req, res, next) {
72 | postController.addnewPost(req.body).then(function() {
73 | res.json({status: true});
74 | }).catch(function(err) {
75 | res.json({status: false});
76 | });
77 | });
78 |
79 | router.post('/hidePost', function(req, res, next) {
80 | if (req.cookies.username === 'admin') {
81 | postController.hidePost(req.body).then(function() {
82 | res.json({status: true});
83 | }).catch(function() {
84 | res.json({status: false});
85 | });
86 | } else {
87 | res.json({status: false});
88 | }
89 | });
90 |
91 | router.post('/showPost', function(req, res, next) {
92 | if (req.cookies.username === 'admin') {
93 | postController.showPost(req.body).then(function() {
94 | res.json({status: true});
95 | }).catch(function() {
96 | res.json({status: false});
97 | });
98 | } else {
99 | res.json({status: false});
100 | }
101 | });
102 | return router;
103 | };
--------------------------------------------------------------------------------
/routes/users.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | module.exports = function(db) {
5 | var userController = require('../controllers/userControllers.js')(db);
6 |
7 | router.post('/signin', function(req, res, next) {
8 | userController.signinCheck(req.body).then(function(resJson) {
9 | res.cookie("username", req.body.username, {maxAge: 60000 * 60 * 24, httpOnly: true});
10 | res.json({status: true, res: resJson});
11 | }).catch(function(message) {
12 | res.json({status: false, res: message});
13 | });
14 | });
15 | router.post('/signup', function(req, res, next) {
16 | userController.signupCheck(req.body).then(function(resJson) {
17 | res.cookie("username", req.body.username, {maxAge: 60000 * 60 * 24, httpOnly: true});
18 | res.json({status: true, res: resJson});
19 | }).catch(function(message) {
20 | res.json({status: false, res: message});
21 | });
22 | });
23 | router.get('/logout', function(req, res, next) {
24 | res.clearCookie('username');
25 | res.end();
26 | });
27 | router.post('/checkDuplicate', function(req, res, next) {
28 | userController.checkDataUnique(req.body).then(function(message) {
29 | res.end('ok');
30 | }).catch(function(message) {
31 | res.end('已重复');
32 | });
33 | });
34 | router.get('/checkIfsignin', function(req, res, next) {
35 | if (typeof req.cookies.username != 'undefined') {
36 | userController.getUserByName(req.cookies.username).then(function(resJson) {
37 | res.json({status: true, res: resJson});
38 | }).catch(function() {
39 | res.json({status: false});
40 | });
41 | } else {
42 | res.json({status: false});
43 | }
44 | });
45 | return router;
46 | };
47 |
48 |
--------------------------------------------------------------------------------
/views/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Blog
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
评论区
21 |目前还没评论
29 |31 |
{{comment.content}}
35 |该内容已被管理员隐藏
36 |