diff --git a/index.html b/index.html index 465f6355..5dd9282d 100644 --- a/index.html +++ b/index.html @@ -7,13 +7,10 @@ Leanote, Not Just A Notebook - -

loading........

- + - \ No newline at end of file diff --git a/index2.html b/index2.html deleted file mode 100644 index a4b8d918..00000000 --- a/index2.html +++ /dev/null @@ -1,921 +0,0 @@ - - - - - - - - - - -Leanote, Not Just A Notebook - - - - - - - - - - - - - - - - - - -
-
- - - - - -
-
- -
-
- loading... -
-
-
-
-
- - - Notebook - -
- -
-
- -
- -
    -
      -
      -
      - -
      -
      - - - Tag - -
      - - -
      - -
      -
      - - - Share - -
      - -
        - -
      -
      - -
      - - -
      - -
      - - -
      -
      - - -
      -
      -
      - -
      -
      -
      - - -
      - -
      - -
      -
      - -
      - loading... -
      -
      -
      -
      - - - - - - -
      - -
      -
      -
      - -
      -
      - - - -
      -
        -
      -
      -
      - -
      - -
      - -
      -
      -
      -

      -
      - - - - - Update - - - - Create - -
      -
      - -
      -
      -
      -
      - -
      -
      - -
      - loading... -
      -
      - The notebook is empty, why not... -
      -
      - -
      - Sorry, cannot new note in here, please choose a notebook at first. -
      -
      -
      - -
      - - - - -
      -
      -
      - - -
      - - -
      - -
      - -
      -
      - -
      - -
      -
      - - -
      -
      -
      -

      - - Note nav -

      -
      -
      -
      - - -
      -
      - Drop images to here - -
      -
        -
      -
      - - -
      - {{.noteContent}} -
      -
      - -
      - - -
      -
      - -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -

      - - Note nav -

      -
      -
      -
      -
      -
      -
      -
      - - -
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/sync.js b/node_modules/sync.js index 5371bdfa..846de52c 100644 --- a/node_modules/sync.js +++ b/node_modules/sync.js @@ -111,8 +111,11 @@ var Sync = { function canCall() { // 是最后一块, 且 me._addSyncNotebookNum(); + console.log(me._syncNotebookIsLastChunk); console.log(me._totalHasSyncNotebookNum + ' ' + me._totalSyncNotebookNum); - if(me._syncNotebookIsLastChunk && me._totalHasSyncNotebookNum >= me._totalSyncNotebookNum) { + console.log(me._syncInfo.notebook.ok); + if(me._syncNotebookIsLastChunk && + me._totalHasSyncNotebookNum >= me._totalSyncNotebookNum) { // 防止多次callback if(!me._syncInfo.notebook.ok) { me._syncInfo.notebook.ok = true; @@ -129,6 +132,8 @@ var Sync = { var notebook = notebooks[i]; // 得到本地的, 与之对比 + Web.syncProcess('notebook', notebook.Title); + (function(notebook) { var usn = notebook.Usn; @@ -185,7 +190,7 @@ var Sync = { me._totalSyncNotebookNum += notebooks.length; // 证明可能还有要同步的 if(notebooks.length == me._notebookMaxEntry) { - me._syncNotebookToLocal(notebooks); + me._syncNotebookToLocal(notebooks, callback); var last = notebooks[notebooks.length-1]; me.syncNotebook(last.Usn, callback); } else { @@ -250,6 +255,7 @@ var Sync = { for(var i in notes) { var note = notes[i]; // 得到本地的, 与之对比 + Web.syncProcess('note', note.Title); (function(note) { @@ -377,6 +383,7 @@ var Sync = { for(var i in tags) { var tag = tags[i]; // 得到本地的, 与之对比 + Web.syncProcess('tag', tag.Title); (function(tag) { @@ -454,13 +461,16 @@ var Sync = { var me = this; me._initSyncInfo(); + // Web.syncNotebookFinish(); // 同步笔记本 me.syncNotebook(-1, function(ok) { if(ok) { + // Web.syncNoteFinish(); console.log('------------------') // 同步笔记 me.syncNote(-1, function(ok) { if(ok) { + // Web.syncTagFinish(); // 同步标签 me.syncTag(-1, function() { // 更新上次同步时间 diff --git a/node_modules/underscore.js b/node_modules/underscore.js deleted file mode 100755 index 5a0cb3b0..00000000 --- a/node_modules/underscore.js +++ /dev/null @@ -1,32 +0,0 @@ -// Underscore.js 1.3.3 -// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. -// Underscore is freely distributable under the MIT license. -// Portions of Underscore are inspired or borrowed from Prototype, -// Oliver Steele's Functional, and John Resig's Micro-Templating. -// For all details and documentation: -// http://documentcloud.github.com/underscore -(function(){function r(a,c,d){if(a===c)return 0!==a||1/a==1/c;if(null==a||null==c)return a===c;a._chain&&(a=a._wrapped);c._chain&&(c=c._wrapped);if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return!1;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== -c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return!1;for(var f=d.length;f--;)if(d[f]==a)return!0;d.push(a);var f=0,g=!0;if("[object Array]"==e){if(f=a.length,g=f==c.length)for(;f--&&(g=f in a==f in c&&r(a[f],c[f],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return!1;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,h)&&!f--)break; -g=!f}}d.pop();return g}var s=this,I=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,J=k.unshift,l=p.toString,K=p.hasOwnProperty,y=k.forEach,z=k.map,A=k.reduce,B=k.reduceRight,C=k.filter,D=k.every,E=k.some,q=k.indexOf,F=k.lastIndexOf,p=Array.isArray,L=Object.keys,t=Function.prototype.bind,b=function(a){return new m(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a, -c,d){if(a!=null)if(y&&a.forEach===y)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==null&&(a=[]);if(A&& -a.reduce===A){e&&(c=b.bind(c,e));return f?a.reduce(c,d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduceRight===B){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a, -c,b){var e;G(a,function(a,g,h){if(c.call(b,a,g,h)){e=a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(C&&a.filter===C)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(D&&a.every===D)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b, -a,g,h)))return o});return!!e};var G=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(E&&a.some===E)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=G(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= -function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]}; -j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1),true);return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a= -i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=L||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&& -c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={};j(b.flatten(i.call(arguments,1)),function(b){b in a&&(c[b]=a[b])});return c};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty= -function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFunction=function(a){return l.call(a)=="[object Function]"}; -b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a, -b){return K.call(a,b)};b.noConflict=function(){s._=I;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){M(c,b[c]=a[c])})};var N=0;b.uniqueId= -function(a){var b=N++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},v;for(v in n)n[n[v]]=v;var O=/\\|'|\r|\n|\t|\u2028|\u2029/g,P=/\\(\\|'|r|n|t|u2028|u2029)/g,w=function(a){return a.replace(P,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(O,function(a){return"\\"+n[a]}).replace(d.escape|| -u,function(a,b){return"'+\n_.escape("+w(b)+")+\n'"}).replace(d.interpolate||u,function(a,b){return"'+\n("+w(b)+")+\n'"}).replace(d.evaluate||u,function(a,b){return"';\n"+w(b)+"\n;__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c}; -b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var x=function(a,c){return c?b(a).chain():a},M=function(a,c){m.prototype[a]=function(){var a=i.call(arguments);J.call(a,this._wrapped);return x(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return x(d, -this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return x(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); diff --git a/node_modules/web.js b/node_modules/web.js index e215c004..95a97d39 100644 --- a/node_modules/web.js +++ b/node_modules/web.js @@ -105,6 +105,25 @@ var Web = { attachSynced: function(attachs, attach, noteId) { var me = this; me.Attach.attachSynced(attachs, attach, noteId); + }, + + syncProcess: function(type, title) { + var me = this; + me.Note.syncProcess('In sync ' + type + ': ' + title); + }, + /* + syncNotebookFinish: function() { + var me = this; + me.Note.syncProcess('In sync notebooks...'); + }, + syncNoteFinish: function() { + var me = this; + me.Note.syncProcess('In sync notes...'); + }, + syncTagFinish: function() { + var me = this; + me.Note.syncProcess('In sync tags...'); } + */ }; module.exports = Web; diff --git a/note.html b/note.html index 5b8d0c2e..4e936c8f 100755 --- a/note.html +++ b/note.html @@ -87,7 +87,11 @@ function log(o) {

      +
      loading... +
      +
      +
      diff --git a/package.json b/package.json index 9cb4101c..538cfb1e 100755 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "frame": true, "min_width": 400, "min_height": 200, + // "width": 400, // 1100, + // "height": 300 // 600 "width": 1100, "height": 600 // "transparent": true diff --git a/public/js/app/launch.js b/public/js/app/launch.js index b0d3640a..fcbd5482 100644 --- a/public/js/app/launch.js +++ b/public/js/app/launch.js @@ -5,11 +5,41 @@ // 服务器开启 ServerService.start(); +var gui = require('nw.gui'); +// 窗口大小设置 +var win = gui.Window.get(); + +function to(width, height) { + win.resizeTo(width, height); + win.setPosition('center'); +} + +function ani(callback) { + var baseWidth = 400; + var baseHeight = 300; + var toWidth = 1100; + var toHeight = 600; + var t = 100; + for(var i = 0; i < t; i++) { + (function(i) { + setTimeout(function() { + to(baseWidth + (toWidth - baseWidth) * i / t, baseHeight + (toHeight - baseHeight) * i / t); + if(i == t - 1) { + callback && callback(); + } + }, i); + })(i); + } +} + + // 判断是否登录 UserService.init(function(userInfo) { if(userInfo) { UserInfo = userInfo; - location.href = 'note.html'; + // ani(function() { + location.href = 'note.html'; + // }); } else { location.href = 'login.html'; } diff --git a/public/js/app/note.js b/public/js/app/note.js index 28398f1b..d6f02ced 100644 --- a/public/js/app/note.js +++ b/public/js/app/note.js @@ -1076,6 +1076,11 @@ Note.fixNetOrAuthError = function() { } }; +Note.syncProcess = function(msg) { + $('#allProcess').hide(); + $('#syncProcess').html(msg); +}; + // 保存note ctrl + s Note.saveNote = function(e) { var num = e.which ? e.which : e.keyCode;