├── client
├── index.html
├── json.html
├── plugin
│ ├── jquery-bootstrap-pagination.js
│ ├── jquery.qrcode.min.js
│ ├── pnotify.custom.min.css
│ └── pnotify.custom.min.js
├── single.html
└── templates
│ ├── header.html
│ ├── nav.html
│ ├── nav.js
│ ├── note.css
│ ├── note.html
│ ├── note.js
│ ├── noteEdit.html
│ ├── noteEdit.js
│ ├── notes.html
│ ├── notes.js
│ ├── singlenote.html
│ └── singlenote.js
├── dist
└── notes.tar.gz
├── dump
├── m-notes_meteor_com
│ ├── notes.bson
│ ├── notes.metadata.json
│ ├── system.indexes.bson
│ ├── users.bson
│ └── users.metadata.json
└── meteor
│ ├── notes.bson
│ ├── notes.metadata.json
│ ├── system.indexes.bson
│ ├── users.bson
│ └── users.metadata.json
├── lib
└── collection.js
├── readme.md
├── routes
└── route.js
└── server
├── publish.js
└── server.js
/client/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Notes
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{> nav }}
13 | {{> header }}
14 |
15 |
16 | {{> notes }}
17 |
18 |
19 |
--------------------------------------------------------------------------------
/client/json.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Notes-Export
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
21 |
22 |
--------------------------------------------------------------------------------
/client/plugin/jquery-bootstrap-pagination.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
3 | __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
4 |
5 | (function($) {
6 | /*
7 | $(".my-pagination").pagination();
8 |
9 | $(".my-pagination").pagination({total_pages: 3, current_page: 1});
10 |
11 | $(".my-pagination").pagination({
12 | total_pages: 3,
13 | current_page: 1,
14 | callback: function(event, page) {
15 | alert("Clicked: " + page);
16 | }
17 | });
18 | */
19 |
20 | var PaginationView;
21 |
22 | $.fn.pagination = function(options) {
23 | return this.each(function() {
24 | return new PaginationView($(this), options).render();
25 | });
26 | };
27 | return PaginationView = (function() {
28 | function PaginationView(el, options) {
29 | var defaults;
30 |
31 | this.el = el;
32 | this.change = __bind(this.change, this);
33 | this.clicked = __bind(this.clicked, this);
34 | this.isValidPage = __bind(this.isValidPage, this);
35 | this.render = __bind(this.render, this);
36 | this.pages = __bind(this.pages, this);
37 | this.buildLink = __bind(this.buildLink, this);
38 | this.buildLi = __bind(this.buildLi, this);
39 | this.buildLinks = __bind(this.buildLinks, this);
40 | defaults = {
41 | current_page: 1,
42 | total_pages: 1,
43 | next: ">",
44 | prev: "<",
45 | first: false,
46 | last: false,
47 | display_max: 8,
48 | ignore_single_page: true,
49 | no_turbolink: false
50 | };
51 | this.settings = $.extend(defaults, options);
52 | if ($(document).on) {
53 | $(this.el).on("click", "a", this.clicked);
54 | } else {
55 | $("a", this.el).live("click", this.clicked);
56 | }
57 | this.el.data("paginationView", this);
58 | }
59 |
60 | PaginationView.prototype.buildLinks = function() {
61 | var current_page, links, page, _i, _len, _ref;
62 |
63 | current_page = this.settings.current_page;
64 | links = [];
65 | if (this.settings.first) {
66 | links.push(this.buildLi(1, this.settings.first));
67 | }
68 | if (this.settings.prev) {
69 | links.push(this.buildLi(current_page - 1, this.settings.prev));
70 | }
71 | _ref = this.pages();
72 | for (_i = 0, _len = _ref.length; _i < _len; _i++) {
73 | page = _ref[_i];
74 | links.push(this.buildLi(page, page));
75 | }
76 | if (this.settings.next) {
77 | links.push(this.buildLi(current_page + 1, this.settings.next));
78 | }
79 | if (this.settings.last) {
80 | links.push(this.buildLi(this.settings.total_pages, this.settings.last));
81 | }
82 | return links;
83 | };
84 |
85 | PaginationView.prototype.buildLi = function(page, text) {
86 | if (text == null) {
87 | text = page;
88 | }
89 | return "
" + (this.buildLink(page, text)) + "";
90 | };
91 |
92 | PaginationView.prototype.buildLink = function(page, text) {
93 | var data_attr;
94 |
95 | if (text == null) {
96 | text = page;
97 | }
98 | if (this.settings.no_turbolink) {
99 | data_attr = " data-no-turbolink='1'";
100 | } else {
101 | data_attr = "";
102 | }
103 | return "" + text + "";
104 | };
105 |
106 | PaginationView.prototype.pages = function() {
107 | var buf, current_page, max, page, pages, total_pages, _i, _j, _k, _l, _m, _ref, _ref1, _ref2, _ref3;
108 |
109 | total_pages = this.settings.total_pages;
110 | current_page = this.settings.current_page;
111 | pages = [];
112 | max = this.settings.display_max;
113 | if (total_pages > 10) {
114 | pages.push(1);
115 | if (current_page > max - 1) {
116 | pages.push("..");
117 | }
118 | if (current_page === total_pages) {
119 | for (page = _i = _ref = total_pages - max; _ref <= total_pages ? _i <= total_pages : _i >= total_pages; page = _ref <= total_pages ? ++_i : --_i) {
120 | pages.push(page);
121 | }
122 | }
123 | if (total_pages - current_page < max - 1) {
124 | for (page = _j = _ref1 = total_pages - max; _ref1 <= total_pages ? _j <= total_pages : _j >= total_pages; page = _ref1 <= total_pages ? ++_j : --_j) {
125 | pages.push(page);
126 | }
127 | } else if (current_page > max - 1) {
128 | buf = max / 2;
129 | for (page = _k = _ref2 = current_page - buf, _ref3 = current_page + buf; _ref2 <= _ref3 ? _k <= _ref3 : _k >= _ref3; page = _ref2 <= _ref3 ? ++_k : --_k) {
130 | pages.push(page);
131 | }
132 | } else if (current_page <= max - 1) {
133 | for (page = _l = 2; 2 <= max ? _l <= max : _l >= max; page = 2 <= max ? ++_l : --_l) {
134 | pages.push(page);
135 | }
136 | }
137 | pages = $.grep(pages, function(v, k) {
138 | return $.inArray(v, pages) === k;
139 | });
140 | if (__indexOf.call(pages, total_pages) < 0) {
141 | if (!((total_pages - current_page) < max - 1)) {
142 | pages.push("..");
143 | }
144 | pages.push(total_pages);
145 | }
146 | } else {
147 | for (page = _m = 1; 1 <= total_pages ? _m <= total_pages : _m >= total_pages; page = 1 <= total_pages ? ++_m : --_m) {
148 | pages.push(page);
149 | }
150 | }
151 | return pages;
152 | };
153 |
154 | PaginationView.prototype.render = function() {
155 | var html, link, _i, _len, _ref;
156 |
157 | this.el.html("");
158 | if (this.settings.total_pages === 1 && this.settings.ignore_single_page) {
159 | return;
160 | }
161 | html = ["");
170 | this.el.html(html.join("\n"));
171 | $("[data-page=" + this.settings.current_page + "]", this.el).closest("li").addClass("active");
172 | $("[data-page='..']", this.el).closest("li").addClass("disabled");
173 | $("[data-page='0']", this.el).closest("li").addClass("disabled");
174 | $("[data-page='" + (this.settings.total_pages + 1) + "']", this.el).closest("li").addClass("disabled");
175 | if (this.settings.current_page === 1 && this.settings.first) {
176 | $("li:first", this.el).removeClass("active").addClass("disabled");
177 | }
178 | if (this.settings.current_page === this.settings.total_pages && this.settings.last) {
179 | return $("li:last", this.el).removeClass("active").addClass("disabled");
180 | }
181 | };
182 |
183 | PaginationView.prototype.isValidPage = function(page) {
184 | return page > 0 && page !== this.settings.current_page && page <= this.settings.total_pages;
185 | };
186 |
187 | PaginationView.prototype.clicked = function(event) {
188 | var page;
189 |
190 | page = parseInt($(event.target).attr("data-page"));
191 | if (!this.isValidPage(page)) {
192 | return;
193 | }
194 | if (this.settings.callback != null) {
195 | this.settings.callback(event, page);
196 | }
197 | return this.change(page);
198 | };
199 |
200 | PaginationView.prototype.change = function(page) {
201 | page = parseInt(page);
202 | if (!this.isValidPage(page)) {
203 | return;
204 | }
205 | this.settings.current_page = page;
206 | return this.render();
207 | };
208 |
209 | return PaginationView;
210 |
211 | })();
212 | })(jQuery);
213 |
214 | }).call(this);
--------------------------------------------------------------------------------
/client/plugin/jquery.qrcode.min.js:
--------------------------------------------------------------------------------
1 | (function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;da||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]=
5 | 0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c=
7 | j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount-
8 | b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0g;g++)if(null==this.modules[b][i-g]){var n=!1;f>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a,
9 | c),b=new t,e=0;e8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d=
10 | 0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+
14 | a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;dc)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+
15 | a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256),
17 | LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d
18 | this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b>>7-a%8&1)},put:function(a,c){for(var d=0;d>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,
26 | correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e").css("height",b+"px").appendTo(c);for(i=0;i").css("width",
28 | d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery);
29 |
--------------------------------------------------------------------------------
/client/plugin/pnotify.custom.min.css:
--------------------------------------------------------------------------------
1 | .ui-pnotify{top:25px;right:25px;position:absolute;height:auto;z-index:9999}html>body>.ui-pnotify{position:fixed}.ui-pnotify .ui-pnotify-shadow{-webkit-box-shadow:0 2px 10px rgba(50,50,50,.5);-moz-box-shadow:0 2px 10px rgba(50,50,50,.5);box-shadow:0 2px 10px rgba(50,50,50,.5)}.ui-pnotify-container{background-position:0 0;padding:.8em;height:100%;margin:0}.ui-pnotify-sharp{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.ui-pnotify-title{display:block;margin-bottom:.4em;margin-top:0}.ui-pnotify-text{display:block}.ui-pnotify-icon,.ui-pnotify-icon span{display:block;float:left;margin-right:.2em}.ui-pnotify.stack-bottomleft,.ui-pnotify.stack-topleft{left:25px;right:auto}.ui-pnotify.stack-bottomleft,.ui-pnotify.stack-bottomright{bottom:25px;top:auto}
--------------------------------------------------------------------------------
/client/plugin/pnotify.custom.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | PNotify 2.0.1 sciactive.com/pnotify/
3 | (C) 2014 Hunter Perrin
4 | license GPL/LGPL/MPL
5 | */
6 | (function(c){"function"===typeof define&&define.amd?define("pnotify",["jquery"],c):c(jQuery)})(function(c){var p={dir1:"down",dir2:"left",push:"bottom",spacing1:25,spacing2:25,context:c("body")},f,g,h=c(window),m=function(){g=c("body");PNotify.prototype.options.stack.context=g;h=c(window);h.bind("resize",function(){f&&clearTimeout(f);f=setTimeout(function(){PNotify.positionAll(!0)},10)})};PNotify=function(b){this.parseOptions(b);this.init()};c.extend(PNotify.prototype,{version:"2.0.1",options:{title:!1,
7 | title_escape:!1,text:!1,text_escape:!1,styling:"bootstrap3",addclass:"",cornerclass:"",auto_display:!0,width:"300px",min_height:"16px",type:"notice",icon:!0,opacity:1,animation:"fade",animate_speed:"slow",position_animate_speed:500,shadow:!0,hide:!0,delay:8E3,mouse_reset:!0,remove:!0,insert_brs:!0,destroy:!0,stack:p},modules:{},runModules:function(b,a){var c,e;for(e in this.modules)if(c="object"===typeof a&&e in a?a[e]:a,"function"===typeof this.modules[e][b])this.modules[e][b](this,"object"===typeof this.options[e]?
8 | this.options[e]:{},c)},state:"initializing",timer:null,styles:null,elem:null,container:null,title_container:null,text_container:null,animating:!1,timerHide:!1,init:function(){var b=this;this.modules={};c.extend(!0,this.modules,PNotify.prototype.modules);this.styles="object"===typeof this.options.styling?this.options.styling:PNotify.styling[this.options.styling];this.elem=c("",{"class":"ui-pnotify "+this.options.addclass,css:{display:"none"},mouseenter:function(a){if(b.options.mouse_reset&&
9 | "out"===b.animating){if(!b.timerHide)return;b.cancelRemove()}b.options.hide&&b.options.mouse_reset&&b.cancelRemove()},mouseleave:function(a){b.options.hide&&b.options.mouse_reset&&b.queueRemove();PNotify.positionAll()}});this.container=c("",{"class":this.styles.container+" ui-pnotify-container "+("error"===this.options.type?this.styles.error:"info"===this.options.type?this.styles.info:"success"===this.options.type?this.styles.success:this.styles.notice)}).appendTo(this.elem);""!==this.options.cornerclass&&
10 | this.container.removeClass("ui-corner-all").addClass(this.options.cornerclass);this.options.shadow&&this.container.addClass("ui-pnotify-shadow");!1!==this.options.icon&&c("",{"class":"ui-pnotify-icon"}).append(c("",{"class":!0===this.options.icon?"error"===this.options.type?this.styles.error_icon:"info"===this.options.type?this.styles.info_icon:"success"===this.options.type?this.styles.success_icon:this.styles.notice_icon:this.options.icon})).prependTo(this.container);this.title_container=
11 | c("",{"class":"ui-pnotify-title"}).appendTo(this.container);!1===this.options.title?this.title_container.hide():this.options.title_escape?this.title_container.text(this.options.title):this.title_container.html(this.options.title);this.text_container=c("",{"class":"ui-pnotify-text"}).appendTo(this.container);!1===this.options.text?this.text_container.hide():this.options.text_escape?this.text_container.text(this.options.text):this.text_container.html(this.options.insert_brs?String(this.options.text).replace(/\n/g,
12 | "
"):this.options.text);"string"===typeof this.options.width&&this.elem.css("width",this.options.width);"string"===typeof this.options.min_height&&this.container.css("min-height",this.options.min_height);PNotify.notices="top"===this.options.stack.push?c.merge([this],PNotify.notices):c.merge(PNotify.notices,[this]);"top"===this.options.stack.push&&this.queuePosition(!1,1);this.options.stack.animation=!1;this.runModules("init");this.options.auto_display&&this.open();return this},update:function(b){var a=
13 | this.options;this.parseOptions(a,b);this.options.cornerclass!==a.cornerclass&&this.container.removeClass("ui-corner-all "+a.cornerclass).addClass(this.options.cornerclass);this.options.shadow!==a.shadow&&(this.options.shadow?this.container.addClass("ui-pnotify-shadow"):this.container.removeClass("ui-pnotify-shadow"));!1===this.options.addclass?this.elem.removeClass(a.addclass):this.options.addclass!==a.addclass&&this.elem.removeClass(a.addclass).addClass(this.options.addclass);!1===this.options.title?
14 | this.title_container.slideUp("fast"):this.options.title!==a.title&&(this.options.title_escape?this.title_container.text(this.options.title):this.title_container.html(this.options.title),!1===a.title&&this.title_container.slideDown(200));!1===this.options.text?this.text_container.slideUp("fast"):this.options.text!==a.text&&(this.options.text_escape?this.text_container.text(this.options.text):this.text_container.html(this.options.insert_brs?String(this.options.text).replace(/\n/g,"
"):this.options.text),
15 | !1===a.text&&this.text_container.slideDown(200));this.options.type!==a.type&&this.container.removeClass(this.styles.error+" "+this.styles.notice+" "+this.styles.success+" "+this.styles.info).addClass("error"===this.options.type?this.styles.error:"info"===this.options.type?this.styles.info:"success"===this.options.type?this.styles.success:this.styles.notice);if(this.options.icon!==a.icon||!0===this.options.icon&&this.options.type!==a.type)this.container.find("div.ui-pnotify-icon").remove(),!1!==this.options.icon&&
16 | c("",{"class":"ui-pnotify-icon"}).append(c("",{"class":!0===this.options.icon?"error"===this.options.type?this.styles.error_icon:"info"===this.options.type?this.styles.info_icon:"success"===this.options.type?this.styles.success_icon:this.styles.notice_icon:this.options.icon})).prependTo(this.container);this.options.width!==a.width&&this.elem.animate({width:this.options.width});this.options.min_height!==a.min_height&&this.container.animate({minHeight:this.options.min_height});this.options.opacity!==
17 | a.opacity&&this.elem.fadeTo(this.options.animate_speed,this.options.opacity);this.options.hide?a.hide||this.queueRemove():this.cancelRemove();this.queuePosition(!0);this.runModules("update",a);return this},open:function(){this.state="opening";this.runModules("beforeOpen");var b=this;this.elem.parent().length||this.elem.appendTo(this.options.stack.context?this.options.stack.context:g);"top"!==this.options.stack.push&&this.position(!0);"fade"===this.options.animation||"fade"===this.options.animation.effect_in?
18 | this.elem.show().fadeTo(0,0).hide():1!==this.options.opacity&&this.elem.show().fadeTo(0,this.options.opacity).hide();this.animateIn(function(){b.queuePosition(!0);b.options.hide&&b.queueRemove();b.state="open";b.runModules("afterOpen")});return this},remove:function(b){this.state="closing";this.timerHide=!!b;this.runModules("beforeClose");var a=this;this.timer&&(window.clearTimeout(this.timer),this.timer=null);this.animateOut(function(){a.state="closed";a.runModules("afterClose");a.queuePosition(!0);
19 | a.options.remove&&a.elem.detach();a.runModules("beforeDestroy");if(a.options.destroy&&null!==PNotify.notices){var b=c.inArray(a,PNotify.notices);-1!==b&&PNotify.notices.splice(b,1)}a.runModules("afterDestroy")});return this},get:function(){return this.elem},parseOptions:function(b,a){this.options=c.extend(!0,{},PNotify.prototype.options);this.options.stack=PNotify.prototype.options.stack;var n=[b,a],e,f;for(f in n){e=n[f];if("undefined"==typeof e)break;if("object"!==typeof e)this.options.text=e;else for(var d in e)this.modules[d]?
20 | c.extend(!0,this.options[d],e[d]):this.options[d]=e[d]}},animateIn:function(b){this.animating="in";var a;a="undefined"!==typeof this.options.animation.effect_in?this.options.animation.effect_in:this.options.animation;"none"===a?(this.elem.show(),b()):"show"===a?this.elem.show(this.options.animate_speed,b):"fade"===a?this.elem.show().fadeTo(this.options.animate_speed,this.options.opacity,b):"slide"===a?this.elem.slideDown(this.options.animate_speed,b):"function"===typeof a?a("in",b,this.elem):this.elem.show(a,
21 | "object"===typeof this.options.animation.options_in?this.options.animation.options_in:{},this.options.animate_speed,b);this.elem.parent().hasClass("ui-effects-wrapper")&&this.elem.parent().css({position:"fixed",overflow:"visible"});"slide"!==a&&this.elem.css("overflow","visible");this.container.css("overflow","hidden")},animateOut:function(b){this.animating="out";var a;a="undefined"!==typeof this.options.animation.effect_out?this.options.animation.effect_out:this.options.animation;"none"===a?(this.elem.hide(),
22 | b()):"show"===a?this.elem.hide(this.options.animate_speed,b):"fade"===a?this.elem.fadeOut(this.options.animate_speed,b):"slide"===a?this.elem.slideUp(this.options.animate_speed,b):"function"===typeof a?a("out",b,this.elem):this.elem.hide(a,"object"===typeof this.options.animation.options_out?this.options.animation.options_out:{},this.options.animate_speed,b);this.elem.parent().hasClass("ui-effects-wrapper")&&this.elem.parent().css({position:"fixed",overflow:"visible"});"slide"!==a&&this.elem.css("overflow",
23 | "visible");this.container.css("overflow","hidden")},position:function(b){var a=this.options.stack,c=this.elem;c.parent().hasClass("ui-effects-wrapper")&&(c=this.elem.css({left:"0",top:"0",right:"0",bottom:"0"}).parent());"undefined"===typeof a.context&&(a.context=g);if(a){"number"!==typeof a.nextpos1&&(a.nextpos1=a.firstpos1);"number"!==typeof a.nextpos2&&(a.nextpos2=a.firstpos2);"number"!==typeof a.addpos2&&(a.addpos2=0);var e="none"===c.css("display");if(!e||b){var f,d={},k;switch(a.dir1){case "down":k=
24 | "top";break;case "up":k="bottom";break;case "left":k="right";break;case "right":k="left"}b=parseInt(c.css(k).replace(/(?:\..*|[^0-9.])/g,""));isNaN(b)&&(b=0);"undefined"!==typeof a.firstpos1||e||(a.firstpos1=b,a.nextpos1=a.firstpos1);var l;switch(a.dir2){case "down":l="top";break;case "up":l="bottom";break;case "left":l="right";break;case "right":l="left"}f=parseInt(c.css(l).replace(/(?:\..*|[^0-9.])/g,""));isNaN(f)&&(f=0);"undefined"!==typeof a.firstpos2||e||(a.firstpos2=f,a.nextpos2=a.firstpos2);
25 | if("down"===a.dir1&&a.nextpos1+c.height()>(a.context.is(g)?h.height():a.context.prop("scrollHeight"))||"up"===a.dir1&&a.nextpos1+c.height()>(a.context.is(g)?h.height():a.context.prop("scrollHeight"))||"left"===a.dir1&&a.nextpos1+c.width()>(a.context.is(g)?h.width():a.context.prop("scrollWidth"))||"right"===a.dir1&&a.nextpos1+c.width()>(a.context.is(g)?h.width():a.context.prop("scrollWidth")))a.nextpos1=a.firstpos1,a.nextpos2+=a.addpos2+("undefined"===typeof a.spacing2?25:a.spacing2),a.addpos2=0;if(a.animation&&
26 | a.nextpos2a.addpos2&&(a.addpos2=c.height());break;case "left":case "right":c.outerWidth(!0)>a.addpos2&&(a.addpos2=c.width())}if("number"===typeof a.nextpos1)if(a.animation&&(b>a.nextpos1||d.top||d.bottom||d.right||
27 | d.left))switch(a.dir1){case "down":d.top=a.nextpos1+"px";break;case "up":d.bottom=a.nextpos1+"px";break;case "left":d.right=a.nextpos1+"px";break;case "right":d.left=a.nextpos1+"px"}else c.css(k,a.nextpos1+"px");(d.top||d.bottom||d.right||d.left)&&c.animate(d,{duration:this.options.position_animate_speed,queue:!1});switch(a.dir1){case "down":case "up":a.nextpos1+=c.height()+("undefined"===typeof a.spacing1?25:a.spacing1);break;case "left":case "right":a.nextpos1+=c.width()+("undefined"===typeof a.spacing1?
28 | 25:a.spacing1)}}return this}},queuePosition:function(b,a){f&&clearTimeout(f);a||(a=10);f=setTimeout(function(){PNotify.positionAll(b)},a);return this},cancelRemove:function(){this.timer&&window.clearTimeout(this.timer);"closing"===this.state&&(this.elem.stop(!0),this.state="open",this.animating="in",this.elem.css("height","auto").animate({width:this.options.width,opacity:this.options.opacity},"fast"));return this},queueRemove:function(){var b=this;this.cancelRemove();this.timer=window.setTimeout(function(){b.remove(!0)},
29 | isNaN(this.options.delay)?0:this.options.delay);return this}});c.extend(PNotify,{notices:[],removeAll:function(){c.each(PNotify.notices,function(){this.remove&&this.remove()})},positionAll:function(b){f&&clearTimeout(f);f=null;c.each(PNotify.notices,function(){var a=this.options.stack;a&&(a.nextpos1=a.firstpos1,a.nextpos2=a.firstpos2,a.addpos2=0,a.animation=b)});c.each(PNotify.notices,function(){this.position()})},styling:{jqueryui:{container:"ui-widget ui-widget-content ui-corner-all",notice:"ui-state-highlight",
30 | notice_icon:"ui-icon ui-icon-info",info:"",info_icon:"ui-icon ui-icon-info",success:"ui-state-default",success_icon:"ui-icon ui-icon-circle-check",error:"ui-state-error",error_icon:"ui-icon ui-icon-alert"},bootstrap2:{container:"alert",notice:"",notice_icon:"icon-exclamation-sign",info:"alert-info",info_icon:"icon-info-sign",success:"alert-success",success_icon:"icon-ok-sign",error:"alert-error",error_icon:"icon-warning-sign"},bootstrap3:{container:"alert",notice:"alert-warning",notice_icon:"glyphicon glyphicon-exclamation-sign",
31 | info:"alert-info",info_icon:"glyphicon glyphicon-info-sign",success:"alert-success",success_icon:"glyphicon glyphicon-ok-sign",error:"alert-danger",error_icon:"glyphicon glyphicon-warning-sign"}}});PNotify.styling.fontawesome=c.extend({},PNotify.styling.bootstrap3);c.extend(PNotify.styling.fontawesome,{notice_icon:"fa fa-exclamation-circle",info_icon:"fa fa-info",success_icon:"fa fa-check",error_icon:"fa fa-warning"});document.body?m():c(m);return PNotify});
32 |
--------------------------------------------------------------------------------
/client/single.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Notes-single
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{> header }}
13 | {{> nav }}
14 |
15 | {{> singlenote}}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/client/templates/header.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/client/templates/nav.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
14 |
15 |
16 | - 查看全部
17 | |
18 | - 只看自己
19 |
20 | |
21 | -
22 | 标签:
23 |
30 |
31 |
34 |
35 |
36 | 管理
37 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | - 增加Note
49 | -
50 | {{> loginButtons }}
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/client/templates/nav.js:
--------------------------------------------------------------------------------
1 | Template.nav.helpers({
2 | status:function(){
3 | console.log("nav helper status...");
4 | return Session.get("status");
5 | }
6 | });
7 |
8 | Template.registerHelper('equals', function(value1, value2){
9 | return value1 === value2;
10 | })
11 |
12 |
13 | Template.nav.events({
14 | "click .add": function (event,template) {
15 |
16 | var usr = Meteor.user();
17 | if(!usr){
18 | alert("登录后才可以添加Note !!!");
19 | return false;
20 | }
21 |
22 | event.preventDefault();
23 | Session.set("current_edit", -1);
24 | $('#myModal').modal('show');
25 |
26 | return false;
27 | },
28 |
29 | "click .onlyme": function (event,template) {
30 | Router.go('/mypost');
31 | event.preventDefault();
32 | return false;
33 | },
34 |
35 | "click .allnotes": function (event,template) {
36 | Router.go('/allpost');
37 | event.preventDefault();
38 | return false;
39 | },
40 |
41 | "click .tags .all" : function(event,template){
42 | Router.go('/filter/all');
43 | $(".filter input").val('all');
44 | },
45 |
46 | "click .tags .src" : function(event,template){
47 | Router.go('/filter/src');
48 | $(".filter input").val('src');
49 | },
50 |
51 | "click .tags .tips" : function(event,template){
52 | Router.go('/filter/tips');
53 | $(".filter input").val('tips');
54 | },
55 |
56 | "click .tags .link" : function(event,template){
57 | Router.go('/filter/link');
58 | $(".filter input").val('link');
59 | },
60 |
61 | "click .tags .blog" : function(event,template){
62 | Router.go('/filter/');
63 | $(".filter input").val('');
64 | },
65 |
66 | "click .simple" : function(event,template){
67 | Router.go('/');
68 | var bool = Session.get('simple');
69 | Session.set("simple", !bool);
70 | },
71 |
72 | "click .manage .export" : function(event,template){
73 | event.preventDefault();
74 | Router.go('/exportJSON');
75 | },
76 |
77 | "submit .filter": function (event,template) {
78 | event.preventDefault();
79 | var filter = event.target.text.value;
80 | Router.go('/filter/'+filter);
81 | return false;
82 | }
83 |
84 | });
85 |
--------------------------------------------------------------------------------
/client/templates/note.css:
--------------------------------------------------------------------------------
1 | /* qingdou 2.1*/
2 |
3 | body .modal {
4 | width: 90%; /* desired relative width */
5 | max-width: 1000px;
6 | left: 5%; /* (100%-width)/2 */
7 | /* place center */
8 | margin-left:auto;
9 | margin-right:auto;
10 | }
11 |
12 | .modal-dialog {
13 | width:100%;
14 | }
15 | .modal-body {
16 | max-height: 600px;
17 | overflow-y: scroll;
18 | }
19 | .prettyprint,
20 | pre.prettyprint {
21 | font-size: 17px;
22 | background-color: #272822;
23 | border: 1px solid #272822;
24 | overflow: hidden;
25 | padding: 8px;
26 | }
27 | .prettyprint.linenums,
28 | pre.prettyprint.linenums {
29 | -webkit-box-shadow: inset 40px 0 0 #39382E, inset 41px 0 0 #464741;
30 | -moz-box-shadow: inset 40px 0 0 #39382E, inset 41px 0 0 #464741;
31 | box-shadow: inset 40px 0 0 #39382E, inset 41px 0 0 #464741;
32 | }
33 | .prettyprint.linenums ol,
34 | pre.prettyprint.linenums ol {
35 | margin: 0 0 0 33px;
36 | }
37 | .prettyprint.linenums ol li,
38 | pre.prettyprint.linenums ol li {
39 | padding-left: 12px;
40 | color: #bebec5;
41 | line-height: 20px;
42 | margin-left: 0;
43 | list-style: decimal;
44 | }
45 | .prettyprint .com { color: #93a1a1; }
46 | .prettyprint .lit { color: #AE81FF; }
47 | .prettyprint .pun,
48 | .prettyprint .opn,
49 | .prettyprint .clo { color: #F8F8F2; }
50 | .prettyprint .fun { color: #dc322f; }
51 | .prettyprint .str,
52 | .prettyprint .atv { color: #E6DB74; }
53 | .prettyprint .kwd,
54 | .prettyprint .tag { color: #F92659; }
55 | .prettyprint .typ,
56 | .prettyprint .atn,
57 | .prettyprint .dec,
58 | .prettyprint .var { color: #A6E22E; }
59 | .prettyprint .pln { color: #66D9EF; }
--------------------------------------------------------------------------------
/client/templates/note.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
{{title}}
46 |
{{author}} 写作于 {{createdAt}}
47 |
TAGS: {{filter}}
48 |
49 |
62 | {{#if useMarkdown}}
63 |
64 | {{#markdown}}{{contentThumb}}{{/markdown}}
65 |
66 | {{else}}
67 |
{{contentThumb}}
68 | {{/if}}
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | {{#if useMarkdown}}
77 | {{#markdown}}{{content}}{{/markdown}}
78 | {{else}}
79 |
{{content}}
80 | {{/if}}
81 |
82 |
83 | Edit This Note
84 | Delete Note
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | {{#each images}}
98 | {{#if this}}
99 |
104 | {{/if}}
105 | {{/each}}
106 |
107 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/client/templates/note.js:
--------------------------------------------------------------------------------
1 | Template.note.helpers({
2 | contentThumb: function () {
3 | console.log("note helper contentThumb...");
4 | return this.content.substring(0,150).concat(" \r\n\r\n... .... ... ");
5 | },
6 |
7 | simple:function(){
8 | return Session.get("simple");
9 | },
10 |
11 | expand:true,
12 |
13 | useMarkdown:function(){
14 | return this.markdown;
15 | },
16 |
17 | });
18 |
19 | Template.note.events({
20 | "click .collapseurl": function(event,template){
21 | template.$(".contentThumb").toggle();
22 | template.data.expand = $(".contentThumb").is(":hidden");
23 | //Template.note.codePretty();
24 | //template.$(".collapseurl").hide();
25 | },
26 |
27 | "click .delete": function (event,template) {
28 | var usr = Meteor.user();
29 | if(!usr){
30 | alert("登录后才可以删除Note !!!");
31 | return false;
32 | }
33 | var author = usr.emails[0].address;
34 | if(author !== this.author && author !== "meiroo@outlook.com"){
35 | alert("只能删除自己的Note!!!");
36 | return false;
37 | }
38 | $('#confirmDelete').modal('show');
39 | //Notes.remove( this._id );
40 | },
41 |
42 | "click #confirmDelete .confirmdelete": function (event,template) {
43 | var usr = Meteor.user();
44 | if(!usr){
45 | alert("登录后才可以删除Note !!!");
46 | return false;
47 | }
48 | var author = usr.emails[0].address;
49 | if(author !== this.author && author !== "meiroo@outlook.com"){
50 | alert("只能删除自己的Note!!!");
51 | return false;
52 | }
53 | //$('#confirmDelete').modal('show');
54 | Notes.remove( this._id );
55 | },
56 |
57 | "click .thumbnail":function(event,template){
58 |
59 | event.preventDefault();
60 | var imgsrc = event.target.src;
61 | $('#image').modal('show');
62 | $('#image').find('img').attr("src",imgsrc);
63 |
64 | },
65 |
66 | "click .edit": function (event,template) {
67 | event.preventDefault();
68 |
69 | var usr = Meteor.user();
70 | if(!usr){
71 | alert("登录后才可以编辑Note !!!");
72 | return false;
73 | }
74 | var author = usr.emails[0].address;
75 | if(author !== this.author && author !== "meiroo@outlook.com"){
76 | alert("只能编辑自己的Note!!!");
77 | return false;
78 | }
79 |
80 | Session.set("current_edit", this._id);
81 | $('#myModal').modal('show');
82 | }
83 | });
84 |
85 | Template.note.codePretty = function(){
86 | $('pre').addClass('prettyprint');
87 | prettyPrint();
88 | }
89 |
90 | Template.note.rendered = function () {
91 | console.log("note rendered...");
92 | Template.note.codePretty();
93 | };
94 |
95 |
--------------------------------------------------------------------------------
/client/templates/noteEdit.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
11 |
12 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/client/templates/noteEdit.js:
--------------------------------------------------------------------------------
1 |
2 | Template.noteEdit.helpers({
3 | note:function(){
4 | console.log("noteEdit helper note...");
5 | var _id = Session.get("current_edit");
6 | if(!_id || _id === -1)
7 | return;
8 | //alert(_id);
9 | var note = Notes.findOne({_id:_id});
10 | note.image1 = "";
11 | note.image2 = "";
12 | note.image3 = "";
13 | if(note.images){
14 | note.image1 = note.images[0];
15 | note.image2 = note.images[1];
16 | note.image3 = note.images[2];
17 | }
18 | return note;
19 | }
20 | });
21 |
22 |
23 | Template.noteEdit.events({
24 | "submit .note": function (event,template) {
25 | event.preventDefault();
26 |
27 | var usr = Meteor.user();
28 | var _id = Session.get("current_edit");
29 | var title = event.target.title.value;
30 | var author = usr.emails[0].address;
31 | var content = event.target.content.value;
32 | var filter = event.target.filter.value;
33 | var image1 = event.target.image1.value;
34 | var image2 = event.target.image2.value;
35 | var image3 = event.target.image3.value;
36 | var markdown = event.target.markdown.checked;
37 | if(!filter)
38 | filter = "默认";
39 |
40 | if( _id != -1){
41 |
42 | Notes.update( _id, { $set :{
43 | title: title,
44 | content:content,
45 | filter:filter,
46 | images:[image1,image2,image3],
47 | markdown:markdown
48 | } } );
49 | }else{
50 | Notes.insert({ title:title, content: content, author:author,
51 | filter:filter,images:[image1,image2,image3],markdown:markdown,createdAt: new Date() });
52 | }
53 |
54 | $('#myModal').modal('hide');
55 |
56 | return false;
57 | }
58 | });
59 |
--------------------------------------------------------------------------------
/client/templates/notes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{> noteEdit}}
4 | {{#each notes}}
5 | {{> note}}
6 | {{/each}}
7 |
8 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/client/templates/notes.js:
--------------------------------------------------------------------------------
1 | //Notes = new Meteor.Collection("notes");
2 | //Notes.insert({ title:"Title one test", content: "dsfasffffffffffffffffffsfdafda", createdAt: new Date() });
3 | //Notes.insert({ title:"Title two test", content: "dsfasffffffffffffffffffsfdafda", createdAt: new Date() });
4 | //Notes.insert({ title:"Title three test", content: "dsfasffffffffffffffffffsfdafda", createdAt: new Date() });
5 |
6 | //if (Meteor.isClient) {
7 | // counter starts at 0
8 | // Session.setDefault("counter", 0);
9 |
10 | alert = function(str){
11 | if(!str)
12 | return;
13 |
14 | var notice = new PNotify({
15 | type: 'notice',
16 | title: 'Notice',
17 | text: str,
18 | styling: 'bootstrap3',
19 | hide: true,
20 | delay: 4000
21 | /*buttons:{
22 | closer: true,
23 | closer_hover: true
24 | }*/
25 |
26 | });
27 | /*notice.get().click(function() {
28 | notice.remove();
29 | });*/
30 | }
31 | Template.notes.findHelper = function(){
32 | var find = {};
33 | //query... filter
34 | find.query = {};
35 | if(Session.get("filter")){
36 | var filter = Session.get("filter").toLowerCase();
37 | //alert(filter);
38 | filter = filter.replace(/\s/g,".*");
39 | if(filter==="all"){
40 |
41 | }
42 | else if(filter){
43 | find.query.filter = { $regex: ".*"+filter+".*", $options: "i" };
44 | // alert("输入以查询符合条件的文章,输入all 可以查询全部类型包含Blog, 代码, 技巧等。输入 src xxxxx 查询符合xxxxx的代码。 blog xxxxx查询文章。等等。");
45 |
46 | }else{
47 | find.query.filter = { $regex: ".*blog.*" , $options: "i"};
48 | }
49 | }else{
50 | find.query.filter = { $regex: ".*blog.*" , $options: "i"};
51 | }
52 |
53 |
54 | //find.query.op = "i";
55 | //query author
56 | if(Session.get("status") == "1"){
57 | var usr = Meteor.user();
58 | if(!usr || !usr.emails || !usr.emails[0].address){
59 | alert("登录后才能查看自己的文章");
60 | return false;
61 | }
62 | var author = usr.emails[0].address;
63 | find.query.author = author;
64 | }
65 | //page
66 | var page = Session.get("current_page") -1 ;
67 | find.page = page;
68 | return find;
69 | }
70 |
71 | Template.notes.helpers({
72 | notes:function(){
73 | console.log("body helper notes...");
74 | console.log("collection size = " + Notes.find({}).count());
75 | var notes = null;
76 | var find = Template.notes.findHelper();
77 | notes = Notes.find(find.query, { sort : { createdAt : -1 } , skip: find.page*5, limit: 5});
78 |
79 | //flush pagination
80 | Template.notes.pagecount = Notes.find(find.query).count();
81 | Template.notes.flushPage(Template.notes.pagecount);
82 |
83 | return notes;
84 | }
85 | });
86 |
87 | Template.notes.flushPage = function(pagenum){
88 | console.log("body flush...");
89 | console.log("pagenum size = " + pagenum);
90 |
91 | $("#pagination").pagination({
92 | total_pages: (pagenum-1)/5 + 1,
93 | current_page: Session.get("current_page"),
94 | first: "First",
95 | last:"Last",
96 | callback: function(event, page) {
97 | Session.set("current_page",page);
98 | }
99 | });
100 | }
101 |
102 |
103 | Template.notes.rendered = function () {
104 | //Template.body.flush();
105 |
106 | $.material.init();
107 | Template.notes.flushPage(Template.notes.pagecount);
108 | /*setTimeout(function(){
109 | alert("点击右上角的Sign区域,注册号码并登录可以发表自己的Notes。");
110 | },2000);
111 |
112 | setTimeout(function(){
113 | alert("默认只显示标签为blog的Notes,不显示src tips等等类型。可以在标签部分查询全部类型Notes。输入all 可以查询全部类型包含blog, src, tips等。输入 src xxxxx 查询符合xxxxx的代码。 blog xxxxx查询文章。等等。");
114 | },10000);
115 |
116 | setTimeout(function(){
117 | alert("点击只看自己可以只查看自己的文章,此时标签搜索也只在自己文章中搜索。在文章区域,点击learn more可以展开文章并编辑。");
118 | },18000);*/
119 |
120 | };
121 |
122 | Template.notes.created = function () {
123 | //Session.set("filter","");
124 | Session.set("simple",false);
125 | };
126 |
127 |
128 | //}
129 |
--------------------------------------------------------------------------------
/client/templates/singlenote.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
{{note.title}}
8 |
{{note.author}} 写作于 {{note.createdAt}}
9 |
TAGS: {{note.filter}}
10 |
11 | {{#if note.markdown}}
12 | {{#markdown}}{{note.content}}{{/markdown}}
13 | {{else}}
14 |
{{note.content}}
15 | {{/if}}
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/client/templates/singlenote.js:
--------------------------------------------------------------------------------
1 | Template.singlenote.helpers({
2 | note:function(){
3 | var _id = Session.get("_id");
4 | if(_id){
5 | return Notes.findOne({"_id":_id});
6 | }
7 | return null;
8 | }
9 |
10 | });
11 |
12 | Template.singlenote.events({
13 |
14 | "click .delete": function (event,template) {
15 | var usr = Meteor.user();
16 | if(!usr){
17 | alert("登录后才可以删除Note !!!");
18 | return false;
19 | }
20 | var author = usr.emails[0].address;
21 | if(author !== this.author && author !== "meiroo@outlook.com"){
22 | alert("只能删除自己的Note!!!");
23 | return false;
24 | }
25 | $('#confirmDelete').modal('show');
26 | //Notes.remove( this._id );
27 | },
28 |
29 | "click #confirmDelete .confirmdelete": function (event,template) {
30 | var usr = Meteor.user();
31 | if(!usr){
32 | alert("登录后才可以删除Note !!!");
33 | return false;
34 | }
35 | var author = usr.emails[0].address;
36 | if(author !== this.author && author !== "meiroo@outlook.com"){
37 | alert("只能删除自己的Note!!!");
38 | return false;
39 | }
40 | //$('#confirmDelete').modal('show');
41 | Notes.remove( this._id );
42 | },
43 |
44 | "click .thumbnail":function(event,template){
45 |
46 | event.preventDefault();
47 | var imgsrc = event.target.src;
48 | $('#image').modal('show');
49 | $('#image').find('img').attr("src",imgsrc);
50 |
51 | },
52 |
53 | "click .edit": function (event,template) {
54 | event.preventDefault();
55 |
56 | var usr = Meteor.user();
57 | if(!usr){
58 | alert("登录后才可以编辑Note !!!");
59 | return false;
60 | }
61 | var author = usr.emails[0].address;
62 | if(author !== this.author && author !== "meiroo@outlook.com"){
63 | alert("只能编辑自己的Note!!!");
64 | return false;
65 | }
66 |
67 | Session.set("current_edit", this._id);
68 | $('#myModal').modal('show');
69 | }
70 | });
71 |
72 | Template.singlenote.codePretty = function(){
73 | $('pre').addClass('prettyprint');
74 | prettyPrint();
75 | }
76 |
77 | Template.singlenote.rendered = function (template) {
78 | console.log("note rendered...");
79 | Template.singlenote.codePretty();
80 | //alert(window.location.href);
81 | $('#qrcode').qrcode({width: 150,height: 150,text: window.location.href});
82 | };
83 |
84 |
--------------------------------------------------------------------------------
/dist/notes.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meiroo/m-notes/db7244cbca7472832c650744ded5872592cb2cdd/dist/notes.tar.gz
--------------------------------------------------------------------------------
/dump/m-notes_meteor_com/notes.bson:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meiroo/m-notes/db7244cbca7472832c650744ded5872592cb2cdd/dump/m-notes_meteor_com/notes.bson
--------------------------------------------------------------------------------
/dump/m-notes_meteor_com/notes.metadata.json:
--------------------------------------------------------------------------------
1 | { "indexes" : [ { "v" : 1, "name" : "_id_", "key" : { "_id" : 1 }, "ns" : "m-notes_meteor_com.notes" } ] }
--------------------------------------------------------------------------------
/dump/m-notes_meteor_com/system.indexes.bson:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meiroo/m-notes/db7244cbca7472832c650744ded5872592cb2cdd/dump/m-notes_meteor_com/system.indexes.bson
--------------------------------------------------------------------------------
/dump/m-notes_meteor_com/users.bson:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meiroo/m-notes/db7244cbca7472832c650744ded5872592cb2cdd/dump/m-notes_meteor_com/users.bson
--------------------------------------------------------------------------------
/dump/m-notes_meteor_com/users.metadata.json:
--------------------------------------------------------------------------------
1 | { "indexes" : [ { "v" : 1, "name" : "_id_", "key" : { "_id" : 1 }, "ns" : "m-notes_meteor_com.users" }, { "v" : 1, "name" : "username_1", "key" : { "username" : 1 }, "unique" : true, "ns" : "m-notes_meteor_com.users", "sparse" : 1 }, { "v" : 1, "name" : "emails.address_1", "key" : { "emails.address" : 1 }, "unique" : true, "ns" : "m-notes_meteor_com.users", "sparse" : 1 }, { "v" : 1, "name" : "services.resume.loginTokens.hashedToken_1", "key" : { "services.resume.loginTokens.hashedToken" : 1 }, "unique" : true, "ns" : "m-notes_meteor_com.users", "sparse" : 1 }, { "v" : 1, "name" : "services.resume.loginTokens.token_1", "key" : { "services.resume.loginTokens.token" : 1 }, "unique" : true, "ns" : "m-notes_meteor_com.users", "sparse" : 1 }, { "v" : 1, "name" : "services.resume.haveLoginTokensToDelete_1", "key" : { "services.resume.haveLoginTokensToDelete" : 1 }, "ns" : "m-notes_meteor_com.users", "sparse" : 1 }, { "v" : 1, "name" : "services.resume.loginTokens.when_1", "key" : { "services.resume.loginTokens.when" : 1 }, "ns" : "m-notes_meteor_com.users", "sparse" : 1 }, { "v" : 1, "name" : "emails.validationTokens.token_1", "key" : { "emails.validationTokens.token" : 1 }, "unique" : true, "ns" : "m-notes_meteor_com.users", "sparse" : 1 }, { "v" : 1, "name" : "services.password.reset.token_1", "key" : { "services.password.reset.token" : 1 }, "unique" : true, "ns" : "m-notes_meteor_com.users", "sparse" : 1 } ] }
--------------------------------------------------------------------------------
/dump/meteor/notes.bson:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meiroo/m-notes/db7244cbca7472832c650744ded5872592cb2cdd/dump/meteor/notes.bson
--------------------------------------------------------------------------------
/dump/meteor/notes.metadata.json:
--------------------------------------------------------------------------------
1 | { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "meteor.notes", "name" : "_id_" } ] }
--------------------------------------------------------------------------------
/dump/meteor/system.indexes.bson:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meiroo/m-notes/db7244cbca7472832c650744ded5872592cb2cdd/dump/meteor/system.indexes.bson
--------------------------------------------------------------------------------
/dump/meteor/users.bson:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meiroo/m-notes/db7244cbca7472832c650744ded5872592cb2cdd/dump/meteor/users.bson
--------------------------------------------------------------------------------
/dump/meteor/users.metadata.json:
--------------------------------------------------------------------------------
1 | { "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "meteor.users", "name" : "_id_" }, { "v" : 1, "key" : { "username" : 1 }, "unique" : true, "ns" : "meteor.users", "name" : "username_1", "sparse" : 1 }, { "v" : 1, "key" : { "emails.address" : 1 }, "unique" : true, "ns" : "meteor.users", "name" : "emails.address_1", "sparse" : 1 }, { "v" : 1, "key" : { "services.resume.loginTokens.hashedToken" : 1 }, "unique" : true, "ns" : "meteor.users", "name" : "services.resume.loginTokens.hashedToken_1", "sparse" : 1 }, { "v" : 1, "key" : { "services.resume.loginTokens.token" : 1 }, "unique" : true, "ns" : "meteor.users", "name" : "services.resume.loginTokens.token_1", "sparse" : 1 }, { "v" : 1, "key" : { "services.resume.haveLoginTokensToDelete" : 1 }, "ns" : "meteor.users", "name" : "services.resume.haveLoginTokensToDelete_1", "sparse" : 1 }, { "v" : 1, "key" : { "services.resume.loginTokens.when" : 1 }, "ns" : "meteor.users", "name" : "services.resume.loginTokens.when_1", "sparse" : 1 }, { "v" : 1, "key" : { "emails.validationTokens.token" : 1 }, "unique" : true, "ns" : "meteor.users", "name" : "emails.validationTokens.token_1", "sparse" : 1 }, { "v" : 1, "key" : { "services.password.reset.token" : 1 }, "unique" : true, "ns" : "meteor.users", "name" : "services.password.reset.token_1", "sparse" : 1 } ] }
--------------------------------------------------------------------------------
/lib/collection.js:
--------------------------------------------------------------------------------
1 | Notes = new Meteor.Collection("notes");
2 | GroundDB(Notes);
3 | GroundDB(Meteor.users);
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ##
2 |
3 | ##demo site:
4 |
5 | ###功能列表
6 | 1. Notes管理、Notes增删查改。 增加分页模块。修改样式基于Google Material Design-Bootstrap
7 | 2. 权限和用户管理。注册登录。只能修改和删除自己Notes。
8 | 3. MarkDown和Sublime样式。支持MarkDown格式Notes。调整src样式类似sublime。
9 | 4. 查询。按Tags查询。
10 | 5. 全站缓存。全站页面以及JS和数据库都缓存到本地。无网络情况正常使用。有网络后自动同步。
11 | 6. 用户全部Notes导出下载为JSON文件。
12 | 7. qrcode
13 |
14 |
15 | ###技术实现
16 |
17 |
18 | ####依赖组件:
19 | ```
20 | //CSS样式类
21 | bootstrap3: bootstrap模板样式
22 | bootstrap-material-design: 基于bootstrap的模板
23 | code-prettyfy: 处理代码的样式优化
24 | markdown:markdown样式
25 |
26 | //login
27 | accounts-password : 处理账户密码添加验证
28 | accounts-ui-bootstrap: 基于bootstrap的登陆框样式
29 |
30 | //H5本地缓存 处理全部网站的本地缓存化
31 | appcache : 处理HTML5 CSS/JS/HTML的本地缓存
32 | grounddb:处理数据库的本地缓存
33 |
34 | //客户端服务端数据同步和发布
35 | autopublish:处理服务端数据库修改发布
36 | insecure: 客户端可写全部数据库
37 |
38 | //other
39 | qrcode
40 | iron:router
41 | pnotify
42 | ```
43 |
44 | ####目录结构:
45 | ```
46 | client //客户端
47 | - template //每个文件分为js和html。js为控制器 html为模板显示。
48 | header, nav, note, noteEdit, notes
49 | - plugin //一些组件等
50 | pagination pnotify
51 |
52 | lib //服务端和客户端共同访问数据库
53 | collection //数据库表
54 |
55 | server //服务端
56 | server
57 | publish
58 |
59 | ```
60 |
61 |
62 | ###使用到的Meteor功能特点
63 | * 依赖subscribe,publish功能。数据库可以对前后端统一开放。数据库修改后可以publish到各个终端。
64 | * 动态模版 填充。Meteor采用tracker进行跟踪自动刷新。此机制是通用机制。不仅是处理界面。逻辑部分也是可以完全用此机制自动处理逻辑模块的调用。
65 | * 本地存储。包括html css js 数据库。网络正常后会自动同步数据。
66 | * 组件化 前后端统一化组件 一键安装
67 |
68 | ###meteor package list
69 | ```
70 | accounts-password 1.0.4 Password support for accounts
71 | appcache 1.0.2 Enable the application cache in the browser
72 | autopublish 1.0.1 Publish the entire database to all clients
73 | code-prettify 1.0.1 Syntax highlighting of code, from Google
74 | fezvrasta:bootstrap-material-design-noglyph 0.2.1 FezVrasta's Bootstrap Google Material Design theme. Material icons instead of Bootstrap glyphicons.
75 | ground:db 0.0.9* Ground Meteor.Collections offline
76 | ian:accounts-ui-bootstrap-3 1.1.20* Bootstrap-styled accounts-ui with multi-language support.
77 | insecure 1.0.1 Allow all database writes by default
78 | iron:router 1.0.3* Routing specifically designed for Meteor
79 | markdown 1.0.2 Markdown-to-HTML processor
80 | meteor-platform 1.2.0 Include a standard set of Meteor packages in your app
81 | mongo 1.0.8* Adaptor for using MongoDB and Minimongo over DDP
82 |
83 |
84 | ```
85 |
--------------------------------------------------------------------------------
/routes/route.js:
--------------------------------------------------------------------------------
1 |
2 | Router.route('/', function () {
3 | Session.set('_id', null);
4 | this.render('index');
5 | });
6 |
7 | Router.route('/note/:_id', function () {
8 | this.render('single');
9 | Session.set('_id', this.params._id);
10 | });
11 |
12 | Router.route('/about', function () {
13 | Router.go('/note/kpNvwdsHtt6js3SeA');
14 | });
15 |
16 | Router.route('/mypost',function(){
17 | Session.set("status", "1");
18 | Session.set("current_page",1);
19 | this.render('index');
20 | });
21 |
22 | Router.route('/allpost',function(){
23 | Session.set("status", "0");
24 | Session.set("current_page",1);
25 | this.render('index');
26 | });
27 |
28 | Router.route('/filter',function(){
29 | $(".filter input").val('');
30 | Session.set("filter", 'blog');
31 | Session.set("current_page",1);
32 | this.render('index');
33 | });
34 |
35 | Router.route('/filter/:_tag',function(){
36 | $(".filter input").val(this.params._tag);
37 | var filtervalue = this.params._tag;
38 | Session.set("filter", filtervalue);
39 | Session.set("current_page",1);
40 | this.render('index');
41 | });
42 |
43 | // Router.route('/download', function () {
44 | // var req = this.request;
45 | // var res = this.response;
46 | // res.end('hello from the server\n');
47 | // this.render('json');
48 | // }, {where: 'server'});
49 | Router.route('/exportJSON', function () {
50 | var r = this;
51 | if (Meteor.user()) {
52 | var msg = Meteor.call('exportJSON',function(err,str){
53 | r.render('json',{
54 | data:{"content":str}
55 | });
56 | });
57 | }else {
58 | alert('登录后才能导出自己的Notes...');
59 | this.next();
60 | }
61 |
62 | });
63 |
64 |
65 | Router.route('/download', { where: 'server' })
66 | .get(function () {
67 | // GET /webhooks/stripe
68 | // var string = '';
69 | s = Meteor.call('download');
70 | this.response.setHeader('Content-Type', 'text/plain');
71 | this.response.setHeader('content-disposition', "attachment; filename=notes.json");
72 | s.pipe(this.response);
73 |
74 | //
75 | //this.response.end('asdfasfdsa');
76 | })
77 | .post(function () {
78 | // POST /webhooks/stripe
79 | })
80 | .put(function () {
81 | // PUT /webhooks/stripe
82 | });
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/server/publish.js:
--------------------------------------------------------------------------------
1 | // Meteor.publish("notes", function() {
2 | // return Notes.find();
3 | // });
--------------------------------------------------------------------------------
/server/server.js:
--------------------------------------------------------------------------------
1 | Meteor.startup(function () {
2 | // code to run on server at startup
3 | });
4 |
5 |
6 | Meteor.methods({
7 | exportJSON: function () {
8 | var usr = Meteor.user();
9 | var author = usr.emails[0].address;
10 | var query = {};
11 | query.author = author;
12 | var str = JSON.stringify(Notes.find(query,{limit:10}).fetch());
13 | return str;
14 | },
15 | download: function(){
16 | var stream = Npm.require("stream");
17 | var set = Notes.find({});
18 | var s = new stream.Readable();
19 | s._read = function noop() {};
20 | s.push('[');
21 | set.forEach(function (note) {
22 | s.push(JSON.stringify(note)+',');
23 | });
24 | s.push(']');
25 |
26 | s.push(null);
27 | return s;
28 | }
29 | });
--------------------------------------------------------------------------------