[ { "_id": "143563378008cw190src", "_rev": "1176-716306428b3e83529cddbaacb0b036fe", "name": "/os 1.9β", "type": "site", "stamp": 1443565630789, "creator": "ermouth-1ermouth", "owners": [], "acl": [], "s3": { "accessKeyId": "", "secretAccessKey": "", "region": "" }, "site": { "s3bucket": "", "s3folder": "os", "siteBase": "", "previewBase": "" }, "creds": { "crypto": "" }, "items": [ { "id": "16lbg37i", "type": "rtf", "snippet": true, "folder": "", "name": "--README--", "ext": "", "mime": "text/html", "desc": "", "data": "

What is what

Color and markup coding

Folders

All folders that start with - (minus) contains only code snippets. Other folders contain data to export.

sys Folder with system components. Unfolded dependency tree looks like this

lib folder with libraries. Snippets are in -lib folder.
docs folder with rendered docs. Snippets are in -p folder.

", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "external": "", "noIncludes": false, "state": { "savedSdbm": "9l6pc8h", "sdbm": "9l6pc8h", "impacts": {}, "depends": {} }, "cache": [ "86400" ] }, { "id": "17ozfdfk", "type": "html", "snippet": false, "folder": "", "name": "index", "ext": "html", "mime": "text/html", "desc": "", "data": "\n\n\nCloudWall Me 1.9.0\n\n\n\t\n\n\n\n\n\n\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n
\n\t
\n\t\t
\n\t\t\t\"CloudWall\"\n\t\t
\n\t\t
\n\t\t\n\t\t\t
\n\t\t\n\t\t
\n\t
\n\t\n\t\n\t\n\t
\n\t\t\"CloudWall\"\n\t\t
\n\t\t\tAbout\n\t\t\tArchitecture\n\t\t\t\n\t\t\tIDE\n\t\t\tAPI\n\t\t\tApp authoring\n\t\t\tCustom builds\n\t\t\t\n\t\t\tSync guide\n\t\t\tFAQ\n\t\t\t\n\t\t
\n\t\t\n\t
\n\t
\n\t\t
\n\t
\n\n\n\t\t\t\n\n\n{{-p/counter.html}}\n\t\n", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "cache": "86400", "external": "", "state": { "savedSdbm": "hxwyqdz", "sdbm": "hxwyqdz", "impacts": {}, "depends": { "-p/counter.html": true } } }, { "id": "1arjntc1", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Sys.Db.DocInfo", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"id\": \"cw.Sys.Db.DocInfo\",\n\t\"build\": 10,\n\t\"init\": function ($o,form) {\n\n\tvar that=this, pi=$.Deferred(),\n\t\t\tk1=\"name type crypto title _id _rev _read _nokey _conflicts contact creator stamp log created owners _attachments parent pic\".split(\" \"),\n\t\t\tk2=\"_id _rev parent title contact type creator created stamp _read crypto _conflicts _attachments\".split(\" \"),\n\t\t\td = form.data, \n\t\t\tdb=d.db,\n\t\t\tfi;\n\tif (!db || !Object.isObject(db) || !db.load) throw \"No DB provided\";\n\n\t//this.Actions = $.my.cache(\"cw.Sys.Db.List.Actions\"); \n\n\tdb.load(d.id,true)\n\t.fail( function(){\n\t\tpi.reject(\"Doc does not exist\")\n\t})\n\t.then(function(a0){\n\t\tvar val, a=[a0];\n\t\tObject.merge(d.doc, Object.select(a[0],k1));\n\t\ttry {\n\t\t\t// mount doc info\n\t\t\tk2.forEach(function(e){\n\t\t\t\tvar r;\n\t\t\t\tif (val=d.doc[e]) {\n\t\t\t\t\tval=(val+\"\").escapeHTML();\n\t\t\t\t\tif (e===\"stamp\") d.info.push({n:\"Modified\",v:cw.lib.date(d.doc[e]*1,\"full\")});\n\t\t\t\t\telse if (e===\"created\") d.info.push({n:\"Created\",v:cw.lib.date(d.doc[e]*1,\"full\")});\n\t\t\t\t\telse if (e===\"crypto\") d.info.push({\n\t\t\t\t\t\tn:\"Crypto\",\n\t\t\t\t\t\tv:\"AES256 key ID: \"+val\n\t\t\t\t\t\t+(d.doc._nokey?', key is unknown':'')\n\t\t\t\t\t});\n\t\t\t\t\telse if (e===\"_read\" && val) {\n\t\t\t\t\t\tr=db.isread(d.id);\n\t\t\t\t\t\tif (r) d.info.push({n:\"Read\",v:(d.doc._rev===r.rev?\"\":\"Rev \"+r.rev.split(\"-\")[0]+\", \")+cw.lib.date(r.stamp*1,\"full\")});\n\t\t\t\t\t}\n\t\t\t\t\telse if (e===\"creator\" || e===\"author\") {\n\t\t\t\t\t\tr = val.split(\"-\");\n\t\t\t\t\t\td.info.push({\n\t\t\t\t\t\t\tn:\"Creator\",\n\t\t\t\t\t\t\tv:' '+r[0]+''+(r[1]?' ('+r[1]+')':'')\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse if (e===\"_conflicts\") {\n\t\t\t\t\t\tr = d.doc[e].length;\n\t\t\t\t\t\tif (r) d.info.push({\n\t\t\t\t\t\t\tn:\"Conflicts\",\n\t\t\t\t\t\t\tv:r+' fork doc'+(r>1?'s':'')+' stored'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse if (e===\"_attachments\") {\n\t\t\t\t\t\tr = Object.keys(d.doc[e]);\n\t\t\t\t\t\tr.sort();\n\t\t\t\t\t\tif (r.length) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar html = '
';\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\thtml+= r.map(function(i){\n\t\t\t\t\t\t\t\tvar t = i.escapeHTML(), \n\t\t\t\t\t\t\t\t\t\tatt = d.doc[e][i],\n\t\t\t\t\t\t\t\t\t\tlen = Math.round(att.data.length/4*3)-att.data.last(2).replace(/[^=]/g,'').length;\n\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t\t''\n\t\t\t\t\t\t\t\t].join('');\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}).join('');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\thtml+='
',\n\t\t\t\t\t\t\t\t\t''+t.truncate(45,\"middle\",\"…\")+'',\n\t\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t\t((len>9999?len.metric(2,false):len)+'b').replace(/([a-z]+)$/i,' $1')+'',\n\t\t\t\t\t\t\t\t\t'
';\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\td.info.push({\n\t\t\t\t\t\t\t\tn:(r.length>1?r.length+\" a\":\"A\")+ \"ttaches\",\n\t\t\t\t\t\t\t\tv:html\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse d.info.push({n:e.replace(/^_/,'Doc ').capitalize(),v:val});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// mount actions\n\t\t\t// ...app\n\t\t\tif (d.doc.type===\"manifest\" && a[0].manifest && a[0].manifest.app && a[0].manifest.app.name) {\n\t\t\t\t//we have app\n\t\t\t\tif (a[0].manifest.app.nodecmd) d.actions[\"_runnew\"]=[a[0].manifest.id];\n\t\t\t\telse d.actions[\"_run\"]=[a[0].manifest.id];\n\t\t\t}\n\t\t\t// ...doc\n\t\t\tif (!d.doc._nokey) Object.merge(d.actions, db.actions(d.doc.type));\n\t\t\t// ..system\n\t\t\tif (d.id!==\"cw\" && d.doc.type!==\"readhidelist\") {\n\t\t\t\td.actions[\"_export\"]=true;\n\t\t\t\td.actions2[\"_hide\"]=true;\n\t\t\t\tif (!d.doc._nokey && \n\t\t\t\t\t\t(d.doc.type!==\"manifest\" \n\t\t\t\t\t\t || \n\t\t\t\t\t\t (Object.isArray(d.doc.log) \n\t\t\t\t\t\t\t&& \n\t\t\t\t\t\t\td.doc.log.last()[2].startsWith(cw.me())\n\t\t\t\t\t\t ))\n\t\t\t\t\t ) {\n\t\t\t\t\td.actions2[\"_delete\"]=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (d.doc.type==\"readhidelist\") d.actions2[\"_hide\"]=true;\n\t\t\td.actions[\"_json\"]=true;\n\t\t} catch(e) {\n\t\t\tcw.con(\"Error during doc info render.\",e.message, e.stack)\n\t\t}\n\n\t\t$o.html($.my.formgen([\n\t\t\t'
',\n\t\t\t'', \n\t\t\t'
',\n\t\t\t'
',\n\t\t\t'
',\n\t\t\t'
',\n\t\t\t'
4?\"fs80\":\"fs85\")+'\">
',\n\t\t\t'
'\n\n\t\t].compact()));\n\n\t\t$o.on(\"click\",\".button\", function (){\n\t\t\td.cmd = $(this).data(\"action\");\n\t\t\t(function(){$o.trigger(\"commit\");}).delay();\n\t\t});\n\n\t\tpi.resolve();\n\t\t\n\t});\n\n\treturn pi.promise();\n\n\t\t},\n\t\"params\": {\n\t\t\"width\": 700\n\t},\n\t\"data\": {\n\t\t\"db\": null,\n\t\t\"id\": \"\",\n\t\t\"cmd\": \"\",\n\t\t\"info\": [],\n\t\t\"doc\": {\n\t\t},\n\t\t\"actions\": {\n\t\t},\n\t\t\"actions2\": {\n\t\t}\n\t},\n\t\"ui\": {\n\t\t\"#pic\": \"doc.pic\",\n\t\t\"#name\": \"doc.name\",\n\t\t\"#list\": function (d) {\n\n\t\t\treturn $.my.formgen(d.info.reduce(function(a,b){\n\t\t\t\ta.push([b.n,''+b.v+'']);\n\t\t\t\treturn a;\n\t\t\t},[{row:\"560px\",label:\"110px\", labelCss:\"gray fs90\", rowCss:\"my-row pt8\"}]))\n\t\t\n\t\t\t},\n\t\t\"#actions\": {\n\t\t\t\"bind\": function (d) {\n\n\t\t\t\tvar html=\"\", fi, name, that=this;\n\t\t\t\tif(Object.size(d.actions2)) {\n\t\t\t\t\thtml+='
'+_btns(d.actions2, \"ml5 mr0\")+'
';\n\t\t\t\t}\n\t\t\t\thtml+=_btns(d.actions,\"mr5\");\n\t\t\t\treturn html;\n\t\t\t\t\n\t\t\t\t//--------\n\t\t\t\t\n\t\t\t\tfunction _btns (list, css) {\n\t\t\t\t\tvar i, html='';\n\t\t\t\t\tfor (i in list) {\n\t\t\t\t\t\tfi=that.Actions.fi[i]||\"\";\n\t\t\t\t\t\tname = that.Actions.name[i]||i.capitalize();\n\t\t\t\t\t\thtml+='';\n\t\t\t\t\t}\n\t\t\t\t\treturn html;\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"css\": {\n\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\treturn !Object.size(d.actions)\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"Actions\": {\n\t\t\"fi\": {\n\t\t\t\"edit\": \"fi-pencil\",\n\t\t\t\"view\": \"fi-eye\",\n\t\t\t\"create\": \"fi-page-copy\",\n\t\t\t\"_more\": \"fi-info\",\n\t\t\t\"_export\": \"fi-page-export\",\n\t\t\t\"_run\": \"fi-play-circle green\",\n\t\t\t\"_runnew\": \"fi-play-circle green\",\n\t\t\t\"_delete\": \"fi-trash red\",\n\t\t\t\"_hide\": \"fi-minus-circle orange\",\n\t\t\t\"_json\": \"fi-indent-more\"\n\t\t},\n\t\t\"name\": {\n\t\t\t\"create\": \"Clone\",\n\t\t\t\"_more\": \"Info\",\n\t\t\t\"_export\": \"Copy...\",\n\t\t\t\"_run\": \"Run\",\n\t\t\t\"_runnew\": \"Run\",\n\t\t\t\"_delete\": \"Del\",\n\t\t\t\"_hide\": \"Hide\",\n\t\t\t\"_json\": \"JSON\"\n\t\t},\n\t\t\"tip\": {\n\t\t\t\"edit\": \"Edit {type}\",\n\t\t\t\"create\": \"Create new {type} with the content of this one\",\n\t\t\t\"_run\": \"Run application\",\n\t\t\t\"_runnew\": \"Open app and create empty {type}\",\n\t\t\t\"_delete\": \"Delete {type} permanently\",\n\t\t\t\"_hide\": \"Hide {type}. Doc remains in DB, \\nbut you’ll never see it again.\",\n\t\t\t\"_export\": \"Copy {type} to other DB\",\n\t\t\t\"_json\": \"Edit as JSON\"\n\t\t}\n\t}\n}", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "Uglify": false, "noIncludes": true, "external": "pouch://cw-Sys-Db-DocInfo-4vx1 manifest", "state": { "savedSdbm": "585scxxy", "sdbm": "585scxxy", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "1d3uaiqs", "type": "js", "snippet": false, "folder": "sys", "name": "apps", "ext": "js", "mime": "text/javascript", "desc": "", "data": "(function(system, jQuery, Pouch) {\n\tvar cw = Object.merge({},system),\n\t\t$ = Object.clone(jQuery),\n\t\tPouchDB = Pouch;\n\t\n[\n//####### Start system manifests #########\n\t\n{/*{{-sys/cw.Sys.Db.DocInfo.js}}*/},\n{/*{{-sys/cw.Sys.Db.Settings.js}}*/},\t\n{/*{{-sys/cw.Sys.Db.List.js}}*/},\n{/*{{-sys/cw.Sys.Db.Ddocs.js}}*/},\n\t\n{/*{{-sys/cw.Sys.Side.js}}*/},\n{/*{{-sys/cw.Sys.Dock.js}}*/},\n\t\n\t\n{/*{{-sys/cw.Sys.Trust.js}}*/},\n{/*{{-sys/cw.Sys.Confirm.js}}*/},\n{/*{{-sys/cw.Sys.YesNoCancel.js}}*/},\n{/*{{-sys/cw.Sys.Cropper.Square.js}}*/},\n{/*{{-sys/cw.Sys.Attachments.js}}*/},\n{/*{{-sys/cw.Sys.Colorpicker.js}}*/},\n\t\n\t\n{/*{{-sys/cw.Manifest.js}}*/},\n{/*{{-sys/cw.Manifest.Editor.js}}*/},\n\t\n\n//######## End systaem manifests #########\n].sortBy(\"id\").forEach(function(e){cw.reg(e)});\n\n})(cw, jQuery, PouchDB);", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "Uglify": false, "noIncludes": false, "external": "", "state": { "savedSdbm": "2ihlzl7l", "sdbm": "2ihlzl7l", "impacts": {}, "depends": { "-sys/cw.Sys.Db.DocInfo.js": true, "-sys/cw.Sys.Db.Settings.js": true, "-sys/cw.Sys.Db.List.js": true, "-sys/cw.Sys.Db.Ddocs.js": true, "-sys/cw.Sys.Side.js": true, "-sys/cw.Sys.Dock.js": true, "-sys/cw.Sys.Trust.js": true, "-sys/cw.Sys.Confirm.js": true, "-sys/cw.Sys.YesNoCancel.js": true, "-sys/cw.Sys.Cropper.Square.js": true, "-sys/cw.Sys.Attachments.js": true, "-sys/cw.Sys.Colorpicker.js": true, "-sys/cw.Manifest.js": true, "-sys/cw.Manifest.Editor.js": true } }, "cache": [ "172800" ] }, { "id": "15dh7y6g", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Sys.Db.Settings", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"name\": \"Sys.Db.Settings\",\n\t\"title\": \"DB Settings\",\n\t\"type\": \"manifest\",\n\t\"desc\": \"\",\n\t\"beta\": false,\n\t\"id\": \"cw.Sys.Db.Settings\",\n\t\"pic\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/wAARCACAAIADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8Rc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Cr8YGWUnAAzjioo1Ywi4TV0zStSnOSnB6o44ft/fBc/8wXxF/wCAMP8A8epf+G/Pgx/0BPEf/gDD/wDHqYP2AvgyP+Y74l/8DYP/AIxR/wAMB/Br/oO+JP8AwNg/+M1f+x+ZF8Z5D/8Ahvz4Mf8AQE8R/wDgDD/8epp/b8+Cv/QF8RfhYw//AB6k/wCGA/g1/wBB3xJ/4Gwf/GaD+wF8GT/zHfEv/gdB/wDGKP8AY/ME8Z5C/wDDf/wW/wCgL4j/APAGH/49S/8ADf8A8Fv+gL4i/wDAGH/49Tf+GAfgz/0HvEv/AIHQf/GKP+GAvgz/ANB7xL/4HQf/ABij/Y/Md8X5Dv8Ahvz4Mf8AQE8Rf+AMP/x6l/4b8+DH/QE8R/8AgDD/APHqZ/wwH8Gv+g74k/8AA2D/AOM0f8MB/Br/AKDviT/wNg/+M0f7H5ivjPIcf2/fguOui+Iv/AGH/wCPUf8ADf8A8Fv+gL4j/wDAGH/49Tf+GAvgyRzrviX8L2D/AOMUf8MA/Bn/AKD3iX/wOg/+MUf7H5jTxfkO/wCG/wD4Lf8AQF8R/wDgDD/8epD+398GOo0TxGfT/QYf/j1J/wAMA/Bn/oPeJv8AwOg/+MUo/YC+DPX+3fEn430H/wAYof1PzC+L8j5/+NfxI1b9pX4tW974Z8NSRvLFFp2kWQIM0ih3YF+doYs7H0UdzgsftvwD4bHg3wRpHhEXHm/2XpkFoZcY3mONULY98ZrnPhZ+zr8LPhDKb/wpojtfMpQ6jey+bMFP8KnACj12gZ75ruVUL09aitVjNKMFoi6FGUG5SerFooornOgKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP//Z\",\n\t\"stamp\": 1435631477501,\n\t\"manifest\": {\n\t\t\"id\": \"cw.Sys.Db.Settings\",\n\t\t\"init\": function ($o,form) {\n\n\t\tvar that=this;\n\t\t$o.html($.my.formgen(that.HTML));\n\t\tObject.merge(form.data, this.db.settings(), true);\n\t\tthis.App.db=this.db;\n\t\tif (!form.data.pic) form.data.pic=form.data.ico;\n\t\n\t\t\t},\n\t\t\"build\": 31,\n\t\t\"app\": {\n\t\t\t\"name\": \"Sys.Db.Settings\",\n\t\t\t\"version\": \"2\",\n\t\t\t\"timeout\": \"5000\",\n\t\t\t\"title\": \"DB Settings\",\n\t\t\t\"author\": \"ermouth\",\n\t\t\t\"ico\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQECAgMCAgICAgQDAwIDBQQFBQUEBAQFBgcGBQUHBgQEBgkGBwgICAgIBQYJCgkICgcICAj/2wBDAQEBAQICAgQCAgQIBQQFCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAj/wAARCAAyADIDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+/csB1OK+efHP7Tvwv8B+Jb7wlfTeINa1u0C/a49LsGuFtWYZCOwIG7HYZx0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QhYjJ+RzjrhSexr3vxVd/Dnxp4Y8ReD/ABD4g8OXug6rYz6dew/b4182CWMxuuQ2RlWPI6U3x58Jvh18TVsR468J6Z4hkts+RJJuSSIHqokQq209ducZ5xXnH/DJn7Pf/RNtO/8AAu6/+O11upCVm201b8Pmcap1I3SSab/P5HmPwa/Z7+HHwn8YaX411H45+IviXqWk6Q3h/wAOx65qtq0ehaeSpMcQjC7nwipvP8Ixivrb/hMfCP8A0NPhz/wOi/8Aiq8X/wCGTP2e/wDom2nf+Bd1/wDHaP8Ahkz9nv8A6Jtp3/gXdf8Ax2qq1ITfNKTb9F/mTRpzprlhFL5v/I9o/wCEx8I/9DT4c/8AA6L/AOKr5X/an8Q6DrNn8EtI0fW9J1bVX8f6VKltbXCSysirKpYIpJwDIgz6sPWvQP8Ahkz9nv8A6Jtp3/gXdf8Ax2un8Ifs/fBzwJrUHiLwt4D0nTNaiBEVwXlleHIwSnmM21sEjIwcEjPNTCdKD5k236L/ADKqQqTjytJJ+b/yPZKKKK5DsCiiigAooooAKKKKACiiigD/2Q==\",\n\t\t\t\"nodetitle\": \"title\",\n\t\t\t\"build\": 30,\n\t\t\t\"maskstate\": {\n\t\t\t\t\"name\": true\n\t\t\t},\n\t\t\t\"width\": [800]\n\t\t},\n\t\t\"params\": {\n\t\t\t\"delay\": 20\n\t\t},\n\t\t\"data\": {\n\t\t\t\"ico\": \"\",\n\t\t\t\"pic\": \"\",\n\t\t\t\"name\": \"\",\n\t\t\t\"title\": \"\",\n\t\t\t\"desc\": \"\",\n\t\t\t\"stamp\": 0,\n\t\t\t\"start\": \"\",\n\t\t\t\"creator\": \"\",\n\t\t\t\"apps\": [],\n\t\t\t\"sync\": []\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#dbtitle\": {\n\t\t\t\t\"bind\": \"title\",\n\t\t\t\t\"watch\": \"#title\"\n\t\t\t},\n\t\t\t\"#title\": {\n\t\t\t\t\"bind\": \"title\",\n\t\t\t\t\"check\": function (d,v) {\n\n\t\t\t\tif (v && v.length<3) return \"At least 3 characters\";\n\t\t\t\tif (v && v.length>40) return \"40 chars maximum\";\n\t\t\t\treturn \"\";\n\t\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#desc\": {\n\t\t\t\t\"bind\": \"desc\",\n\t\t\t\t\"check\": /^[\\s\\S]{0,300}$/,\n\t\t\t\t\"error\": \"300 chars maximum\"\n\t\t\t},\n\t\t\t\"#dbinfo\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tvar that=this;\n\t\t\t\tthat.db.info().then(function(res){\n\t\t\t\t\tvar h=\"\", docs=0, users=1, useq=0;\n\t\t\t\t\tdocs=res.doc_count;\n\t\t\t\t\tuseq=res.update_seq;\n\t\t\t\t\th='Internal ID: '+that.db.name+'. ';\n\t\t\t\t\tif (d.stamp) {\n\t\t\t\t\t\th+=\"Created \"+cw.lib.date(d.stamp*1, \"tiny\")\n\t\t\t\t\t\t+(d.creator?' by '+d.creator+'. ':\". \");\n\t\t\t\t\t}\n\t\t\t\t\tif (docs) {\n\t\t\t\t\t\th+='Contains '+docs+' doc'+(docs>1?'s':'')+'. '\n\t\t\t\t\t} else h+='DB is empty. ';\n\t\t\t\t\t$o.html(h);\n\t\t\t\t});\n\t\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#pic\": {\n\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\t\tif (!d.ico.length) d.ico=d.pic;\n\t\t\t\treturn d.pic;\n\t\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#apps\": {\n\t\t\t\t\"bind\": \"apps\",\n\t\t\t\t\"manifest\": \"App\",\n\t\t\t\t\"check\": true,\n\t\t\t\t\"watch\": \"#btn-addapp\"\n\t\t\t},\n\t\t\t\"#sync\": {\n\t\t\t\t\"bind\": \"sync\",\n\t\t\t\t\"manifest\": \"Sync\",\n\t\t\t\t\"check\": true,\n\t\t\t\t\"watch\": \"#btn-addsync\"\n\t\t\t},\n\t\t\t\"#start\": {\n\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\tif (v!=null) {\n\t\t\t\tvar a = v.split(\"#\").last().split(\"/\").slice(0,4).compact(true);\n\t\t\t\tif (a[0]==this.db.name) a=a.slice(1);\n\t\t\t\td.start=a.join(\"/\");\n\t\t\t}\n\t\t\treturn d.start;\n\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#btn-close\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tif (v!=null)this.app.close(true);\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\"#btn-save\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tvar that=this;\n\t\t\tif (v!=null){\n\t\t\t\tif (!$o.my().root.my(\"valid\")) {\n\t\t\t\t\tcw.note(\n\t\t\t\t\t\t\"Save failed – some settings are invalid. Fix reds and try again.\",\n\t\t\t\t\t\t\"error\"\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvar db = cw.db(\"cw\");\n\t\t\t\td._cmd=\"\";\n\t\t\t\tdb.settings(d).then(function(){\n\t\t\t\t\tcw.note(\"Settings saved\");\n\t\t\t\t\tthat.app.close(true);\n\t\t\t\t}).fail(function(a){\n\t\t\t\t\tcw.note(a,\"error\");\n\t\t\t\t});\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\"#btn-addapp\": {\n\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\tif (v!=null) {\n\t\t\t\td.apps.push(Object.merge({stamp:Date.now()},this.App.data, true));\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\"#btn-compact\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tvar dbid = this.db.name;\n\t\t\tif (v!=null) {\n\t\t\t\t$o.parent().find(\".cw-busy\").removeClass(\"hide\");\n\t\t\t\tcw.db(dbid)\n\t\t\t\t.compact()\n\t\t\t\t.then(function(){\n\t\t\t\t\tif ($o && $o.is(\":visible\")) $o.parent().find(\".cw-busy\").addClass(\"hide\"); \n\t\t\t\t\tcw.note(\"DB \"+dbid+\" sucessfully compacted.\",\"ok\")\n\t\t\t\t});\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\"#btn-delete\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tvar that=this;\n\t\t\tif (v!=null){\n\t\t\t\tvar db = cw.db(\"cw\");\n\t\t\t\td._cmd=\"delete\";\n\t\t\t\tdb.settings(d).then(function(){\n\t\t\t\t\tcw.note(\"Settings saved. DB is being removed.\",\"warning\");\n\t\t\t\t}).fail(function(a){\n\t\t\t\t\tcw.note(a,\"error\");\n\t\t\t\t});\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\"#btn-pic\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tif (v!=null) {\n\t\t\t\t//console.log($o, $o.data(), this)\n\t\t\t\t$.my.modal({\n\t\t\t\t\tmanifest:\"cw.Sys.Cropper.Square\",\n\t\t\t\t\tdata:{data:\"\",filename:\"\", size:250}\n\t\t\t\t}).then(function (crop) {\n\t\t\t\t\tif (crop && crop.data) {\n\t\t\t\t\t\tvar I=new Image;\n\t\t\t\t\t\tI.src=\"data:image/jpeg;base64,\"+crop.data;\n\t\t\t\t\t\tI.onload=function(){\n\t\t\t\t\t\t\tvar img=cw.lib.image(I);\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\td.pic = img.resample(128).sharpen(0.2).jpeg(0.96, true);\n\t\t\t\t\t\t\t\td.ico = img.resample(50).sharpen(0.2).jpeg(0.96);\n\t\t\t\t\t\t\t\t$o.my().root.trigger(\"change\");\n\t\t\t\t\t\t\t}catch(e){\n\t\t\t\t\t\t\t\tconsole.log(e)\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcrop.data=\"\";\n\t\t\t\t\t\t\t$o.my(\"find\", \"#pic\").trigger(\"check\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\"#btn-resync\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tvar that=this;\n\t\t\tif (v!=null){\n\t\t\t\tvar db = cw.db(\"cw\");\n\t\t\t\td._cmd=\"resync\";\n\t\t\t\tdb.settings(d).then(function(){\n\t\t\t\t\tcw.note(\"Settings saved. DB is prepared to resync\",\"warning\");\n\t\t\t\t}).fail(function(a){\n\t\t\t\t\tcw.note(a,\"error\");\n\t\t\t\t});\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\",\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"hide\": function (d,v,$o) {\n\t\t\t\t\t\treturn !d.sync.length\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"#btn-tosync\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tvar that=this;\n\t\t\tif (v!=null){\n\t\t\t\t$o.parent().find(\".cw-busy\").removeClass(\"hide\");\n\t\t\t\td._cmd=\"sync\";\n\t\t\t\t\n\t\t\t\tvar sl = that.db.settings().sync.filter(function(e){return !!e.dir.length}).length,\n\t\t\t\t\t\tend = function(){\n\t\t\t\t\t\t\tif ($o && jQuery.contains(document, $o[0])) $o.parent().find(\".cw-busy\").addClass(\"hide\");\n\t\t\t\t\t\t},\n\t\t\t\t\t\tend2 = end.after(sl);\n\t\t\t\t\n\t\t\t\tcw.db(\"cw\").settings(d, function(){\n\t\t\t\t\tend2();\n\t\t\t\t}).then(function(a){\n\t\t\t\t\tcw.note(a,\"ok\");\n\t\t\t\t}).fail(function(a){\n\t\t\t\t\tend();\n\t\t\t\t\tcw.note(a,\"error\");\n\t\t\t\t});\n\n\t\t\t\t//_getSyncUrl(dbid,i)\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\",\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\t\treturn !d.sync.length\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"#btn-tosync0\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tvar that=this;\n\t\t\tif (v!=null){\n\t\t\t\t$o.parent().find(\".cw-busy\").removeClass(\"hide\");\n\t\t\t\td._cmd=\"sync0\";\n\t\t\t\t\n\t\t\t\tvar sl = that.db.settings().sync.filter(function(e){return !!e.dir.length}).length,\n\t\t\t\t\t\tend = function(){\n\t\t\t\t\t\t\tif ($o && jQuery.contains(document, $o[0])) $o.parent().find(\".cw-busy\").addClass(\"hide\");\n\t\t\t\t\t\t},\n\t\t\t\t\t\tend2 = end.after(sl);\n\t\t\t\t\n\t\t\t\tcw.db(\"cw\").settings(d, function(){\n\t\t\t\t\tend2();\n\t\t\t\t}).then(function(a){\n\t\t\t\t\tcw.note(a,\"ok\");\n\t\t\t\t}).fail(function(a){\n\t\t\t\t\tend();\n\t\t\t\t\tcw.note(a,\"error\");\n\t\t\t\t});\n\n\t\t\t\t//_getSyncUrl(dbid,i)\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\",\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\t\treturn !d.sync.length\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"#btn-addsync\": {\n\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\tif (v!=null) {\n\t\t\t\td.sync.push(Object.merge({stamp:Date.now()},this.Sync.data, true));\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t}\n\t\t},\n\t\t\"App\": {\n\t\t\t\"data\": {\n\t\t\t\t\"ico\": \"\",\n\t\t\t\t\"title\": \"\",\n\t\t\t\t\"url\": \"\"\n\t\t\t},\n\t\t\t\"init\": [{\n\t\t\t\t\t\"row\": \"350px\",\n\t\t\t\t\t\"rowCss\": \"my-row pb10\"\n\t\t\t\t},\n\t\t\t\t[\"\",\n\t\t\t\t\t\"
\",\n\t\t\t\t\t\"inp#apptitle.fs85.w125\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"Title\"\n\t\t\t\t\t},\n\t\t\t\t\t\"
\",\n\t\t\t\t\t\"inp#appurl.fs75.w220.pt7.pb8.gray\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"App URL hash\"\n\t\t\t\t\t},\n\t\t\t\t\t\"
\"]],\n\t\t\t\"ui\": {\n\t\t\t\t\"#apptitle\": {\n\t\t\t\t\t\"bind\": \"title\",\n\t\t\t\t\t\"check\": /^.{0,40}$/,\n\t\t\t\t\t\"error\": \"40 chars max\"\n\t\t\t\t},\n\t\t\t\t\"#appurl\": {\n\t\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\tvar a = v.split(\"#\").last().split(\"/\").slice(0,4).compact(true);\n\t\t\t\t\tif (a[0]==this.db.name) a=a.slice(1);\n\t\t\t\t\td.url=a.join(\"/\");\n\t\t\t\t}\n\t\t\t\treturn d.url;\n\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"Sync\": {\n\t\t\t\"data\": {\n\t\t\t\t\"url\": \"\",\n\t\t\t\t\"interval\": \"0\",\n\t\t\t\t\"dir\": [\"from\"]\n\t\t\t},\n\t\t\t\"init\": [{\n\t\t\t\t\t\"row\": \"350px\",\n\t\t\t\t\t\"rowCss\": \"my-row pb15\"\n\t\t\t\t},\n\t\t\t\t[\"\",\n\t\t\t\t\t\"
\",\n\t\t\t\t\t\"inp#syncurl.fs80.w350\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"CouchDB URL\"\n\t\t\t\t\t},\n\t\t\t\t\t\"
\",\n\t\t\t\t\t\"spn#syncdir.dib.mt1.vat.fs80\",\n\t\t\t\t\t\"
\",\n\t\t\t\t\t\" in \",\n\t\t\t\t\t\"num#interval.fs80.w70.pt2.pb2\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"min\": 0,\n\t\t\t\t\t\t\"max\": 7220\n\t\t\t\t\t},\n\t\t\t\t\t\" minute intervals\",\n\t\t\t\t\t\"
\"]],\n\t\t\t\"ui\": {\n\t\t\t\t\"#interval\": \"interval\",\n\t\t\t\t\"#syncurl\": {\n\t\t\t\t\t\"bind\": \"url\",\n\t\t\t\t\t\"check\": /^(|http[s]?:\\/\\/([^\\/]{1,100}\\/){1,5}[a-z0-9_$\\(\\)+\\-]{2,200}[\\/]?)$/,\n\t\t\t\t\t\"error\": \"Invalid CouchDB URL\"\n\t\t\t\t},\n\t\t\t\t\"#syncdir\": {\n\t\t\t\t\t\"bind\": \"dir\",\n\t\t\t\t\t\"init\": function ($o) {\n\n\t\t\t\t$o.tags({tags:[{\"From\":\"from\"},{\"To\":\"to\"}]})\n\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"HTML\": [\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t{\n\t\t\t\t\"row\": \"200px\",\n\t\t\t\t\"rowCss\": \"my-row\"\n\t\t\t},\n\t\t\t[\"\",\n\t\t\t\t\"btn#btn-save.fs100.w90.tac.mr5.green\",\n\t\t\t\t{\n\t\t\t\t\t\"val\": \"Save\",\n\t\t\t\t\t\"title\": \"Saves DB settings\"\n\t\t\t\t},\n\t\t\t\t\"btn#btn-close.fs100.w90.tac\",\n\t\t\t\t{\n\t\t\t\t\t\"val\": \"Close\",\n\t\t\t\t\t\"title\": \"Close and discards changes\"\n\t\t\t\t}],\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"\",\n\t\t\t\"\",\n\t\t\t\"\",\n\t\t\t\"
\",\n\t\t\t\"\",\n\t\t\t\"
\",\n\t\t\t\"Change...\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t{\n\t\t\t\t\"row\": \"580px\",\n\t\t\t\t\"rowCss\": \"my-row pb10\"\n\t\t\t},\n\t\t\t[\"\",\n\t\t\t\t\"inp#title.fs120.w350\",\n\t\t\t\t{\n\t\t\t\t\t\"plc\": \"DB title\"\n\t\t\t\t},\n\t\t\t\t\"
DB title as it will be shown in the left pane
\",\n\t\t\t\t\"msg\"],\n\t\t\t[\"\",\n\t\t\t\t\"txt#desc.fs90.w350\",\n\t\t\t\t{\n\t\t\t\t\t\"plc\": \"Description\"\n\t\t\t\t},\n\t\t\t\t\"
Short memo about db source, owner if any and so on
\",\n\t\t\t\t\"msg\"],\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t{\n\t\t\t\t\"row\": \"700px\",\n\t\t\t\t\"label\": \"120px\",\n\t\t\t\t\"rowCss\": \"my-row pb10\",\n\t\t\t\t\"labelCss\": \"my-label fs80 gray\"\n\t\t\t},\n\t\t\t[\"Default app\",\n\t\t\t\t\"inp#start.w350.fs90\",\n\t\t\t\t{\n\t\t\t\t\t\"plc\": \"App name or app URL hash\"\n\t\t\t\t},\n\t\t\t\t\"
Default app to run when DB is clicked in left pane
\",\n\t\t\t\t\"msg\"],\n\t\t\t[\"Other apps\",\n\t\t\t\t\"
\",\n\t\t\t\t\"div#apps.w350\",\n\t\t\t\t{\n\t\t\t\t\t\"style\": \"min-height: 9px;\"\n\t\t\t\t},\n\t\t\t\t\"
\",\n\t\t\t\t\"spn#btn-addapp.pseudolink.fs70\",\n\t\t\t\t{\n\t\t\t\t\t\"txt\": \" Add application to left aside panel\"\n\t\t\t\t},\n\t\t\t\t\"
\",\n\t\t\t\t\"
\",\n\t\t\t\t\"
Apps pinned in the left pane. Paste URL – and app is pinned.
\"],\n\t\t\t\"
\",\n\t\t\t[\"External sync\",\n\t\t\t\t\"
\",\n\t\t\t\t\"div#sync.w350\",\n\t\t\t\t{\n\t\t\t\t\t\"style\": \"min-height: 9px;\"\n\t\t\t\t},\n\t\t\t\t\"
\",\n\t\t\t\t\"spn#btn-addsync.pseudolink.fs70\",\n\t\t\t\t{\n\t\t\t\t\t\"txt\": \" Add link to external CouchDB\"\n\t\t\t\t},\n\t\t\t\t\"
\",\n\t\t\t\t\"
\",\n\t\t\t\t\"
External DBs to replicate to/from
\"],\n\t\t\t[\"Force sync\",\n\t\t\t\t\"spn#btn-tosync.pseudolink.fs90.green.my-tags\",\n\t\t\t\t{\n\t\t\t\t\t\"txt\": \"From checkpoint\"\n\t\t\t\t},\n\t\t\t\t\"spn#btn-tosync0.pseudolink.fs90.green.my-tags.ml20\",\n\t\t\t\t{\n\t\t\t\t\t\"txt\": \"Full re-sync\"\n\t\t\t\t},\n\t\t\t\t\"
\",\n\t\t\t\t\"
Tries to make full sync, it can take time.
\",\n\t\t\t\t\"msg\"],\n\t\t\t[\"Resync DB\",\n\t\t\t\t\"spn#btn-resync.pseudolink.fs85.o80.red.my-tags\",\n\t\t\t\t{\n\t\t\t\t\t\"txt\": \"Clear and resync DB\"\n\t\t\t\t},\n\t\t\t\t\"
Deletes DB and resyncs it back. No rollback if DB isn’t synced.
\",\n\t\t\t\t\"msg\"],\n\t\t\t\"
\",\n\t\t\t[\"Compact\",\n\t\t\t\t\"spn#btn-compact.pseudolink.fs90.green\",\n\t\t\t\t{\n\t\t\t\t\t\"txt\": \"Start compaction\"\n\t\t\t\t},\n\t\t\t\t\"
\",\n\t\t\t\t\"
Perfoms DB compaction, can fix replication issues.
\",\n\t\t\t\t\"msg\"],\n\t\t\t[\"Delete DB\",\n\t\t\t\t\"spn#btn-delete.pseudolink.fs85.o80.red\",\n\t\t\t\t{\n\t\t\t\t\t\"txt\": \"Delete DB permanently\"\n\t\t\t\t},\n\t\t\t\t\"
Deletes DB and all docs in it. No rollback if DB isn’t synced.
\",\n\t\t\t\t\"msg\"],\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"\"]\n\t},\n\t\"raw\": {\n\t\t\"_src\": \"\",\n\t\t\"_new\": false,\n\t\t\"_desc\": \"\",\n\t\t\"name\": \"Sys.Db.Settings\",\n\t\t\"version\": \"2\",\n\t\t\"timeout\": \"5000\",\n\t\t\"title\": \"DB Settings\",\n\t\t\"author\": \"ermouth\",\n\t\t\"pic\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/wAARCACAAIADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkN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X/an8Q6DrNn8EtI0fW9J1bVX8f6VKltbXCSysirKpYIpJwDIgz6sPWvQP8Ahkz9nv8A6Jtp3/gXdf8Ax2un8Ifs/fBzwJrUHiLwt4D0nTNaiBEVwXlleHIwSnmM21sEjIwcEjPNTCdKD5k236L/ADKqQqTjytJJ+b/yPZKKKK5DsCiiigAooooAKKKKACiiigD/2Q==\",\n\t\t\"maskstate\": \"{\\\"name\\\":true}\",\n\t\t\"nodetitle\": \"title\",\n\t\t\"nodedoc\": \"\",\n\t\t\"nodecmd\": \"\",\n\t\t\"types\": \"\",\n\t\t\"build\": 31,\n\t\t\"_opts\": {\n\t\t\t\"runWidth\": \"800\",\n\t\t\t\"runCss\": \"\",\n\t\t\t\"runId\": \"manifest-preview\",\n\t\t\t\"runMode\": [\"modal\"],\n\t\t\t\"compileTo\": [\"js\"]\n\t\t},\n\t\t\"_err\": [],\n\t\t\"com\": [{\n\t\t\t\t\"stamp\": \"1427318740970\",\n\t\t\t\t\"id\": \"Root\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\tparams:{delay:20},\\n\\tdata:{\\n\\t\\tapps:[],\\n\\t\\tico:\\\"\\\",\\n\\t\\tpic:\\\"\\\",\\n\\t\\tname:\\\"\\\",\\n\\t\\ttitle:\\\"\\\",\\n\\t\\tdesc:\\\"\\\",\\n\\t\\tstamp:0,\\n\\t\\tstart:\\\"\\\",\\n\\t\\tsync:[],\\n\\t\\tcreator:\\\"\\\"\\n\\t},\\n\\tinit: function ($o, form) {\\n\\t\\tvar that=this;\\n\\t\\t$o.html($.my.formgen(that.HTML));\\n\\t\\tObject.merge(form.data, this.db.settings(), true);\\n\\t\\tthis.App.db=this.db;\\n\\t\\tif (!form.data.pic) form.data.pic=form.data.ico;\\n\\t},\\n\\tui:{\\n\\t\\t\\\"#dbtitle\\\":{bind:\\\"title\\\", watch:\\\"#title\\\"},\\n\\t\\t\\\"#title\\\":{\\n\\t\\t\\tbind:\\\"title\\\",\\n\\t\\t\\tcheck:function (d,v) {\\n\\t\\t\\t\\tif (v && v.length<3) return \\\"At least 3 characters\\\";\\n\\t\\t\\t\\tif (v && v.length>40) return \\\"40 chars maximum\\\";\\n\\t\\t\\t\\treturn \\\"\\\";\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t\\\"#desc\\\":{\\n\\t\\t\\tbind:\\\"desc\\\",\\n\\t\\t\\tcheck:/^[\\\\s\\\\S]{0,300}$/,\\n\\t\\t\\terror:\\\"300 chars maximum\\\"\\n\\t\\t},\\n\\t\\t\\n\\t\\t\\\"#dbinfo\\\":{\\n\\t\\t\\tbind:function (d,v,$o) {\\n\\t\\t\\t\\tvar that=this;\\n\\t\\t\\t\\tthat.db.info().then(function(res){\\n\\t\\t\\t\\t\\tvar h=\\\"\\\", docs=0, users=1, useq=0;\\n\\t\\t\\t\\t\\tdocs=res.doc_count;\\n\\t\\t\\t\\t\\tuseq=res.update_seq;\\n\\t\\t\\t\\t\\th='Internal ID: '+that.db.name+'. ';\\n\\t\\t\\t\\t\\tif (d.stamp) {\\n\\t\\t\\t\\t\\t\\th+=\\\"Created \\\"+cw.lib.date(d.stamp*1, \\\"tiny\\\")\\n\\t\\t\\t\\t\\t\\t+(d.creator?' by '+d.creator+'. ':\\\". \\\");\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tif (docs) {\\n\\t\\t\\t\\t\\t\\th+='Contains '+docs+' doc'+(docs>1?'s':'')+'. '\\n\\t\\t\\t\\t\\t} else h+='DB is empty. ';\\n\\t\\t\\t\\t\\t$o.html(h);\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t\\\"#pic\\\":{\\n\\t\\t\\tbind:function(d,v){\\n\\t\\t\\t\\tif (!d.ico.length) d.ico=d.pic;\\n\\t\\t\\t\\treturn d.pic;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"err\": [],\n\t\t\t\t\"opts\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427318869306\",\n\t\t\t\t\"id\": \".ui\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\t\\\"#apps\\\":{\\n\\t\\tbind:\\\"apps\\\",\\n\\t\\tmanifest:\\\"App\\\",\\n\\t\\tcheck:true,\\n\\t\\twatch:\\\"#btn-addapp\\\"\\n\\t},\\n\\t\\\"#sync\\\":{\\n\\t\\tbind:\\\"sync\\\",\\n\\t\\tmanifest:\\\"Sync\\\",\\n\\t\\tcheck:true,\\n\\t\\twatch:\\\"#btn-addsync\\\"\\n\\t},\\n\\t\\\"#start\\\":{\\n\\t\\tbind:function (d,v) {\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\tvar a = v.split(\\\"#\\\").last().split(\\\"/\\\").slice(0,4).compact(true);\\n\\t\\t\\t\\tif (a[0]==this.db.name) a=a.slice(1);\\n\\t\\t\\t\\td.start=a.join(\\\"/\\\");\\n\\t\\t\\t}\\n\\t\\t\\treturn d.start;\\n\\t\\t}\\n\\t},\\n\\t\\n\\t\\\"#btn-close\\\":{\\n\\t\\tbind:function(d,v,$o){\\n\\t\\t\\tif (v!=null)this.app.close(true);\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t},\\n\\t\\\"#btn-save\\\":{\\n\\t\\tbind:function(d,v,$o){\\n\\t\\t\\tvar that=this;\\n\\t\\t\\tif (v!=null){\\n\\t\\t\\t\\tif (!$o.my().root.my(\\\"valid\\\")) {\\n\\t\\t\\t\\t\\tcw.note(\\n\\t\\t\\t\\t\\t\\t\\\"Save failed – some settings are invalid. Fix reds and try again.\\\",\\n\\t\\t\\t\\t\\t\\t\\\"error\\\"\\n\\t\\t\\t\\t\\t);\\n\\t\\t\\t\\t\\treturn;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tvar db = cw.db(\\\"cw\\\");\\n\\t\\t\\t\\td._cmd=\\\"\\\";\\n\\t\\t\\t\\tdb.settings(d).then(function(){\\n\\t\\t\\t\\t\\tcw.note(\\\"Settings saved\\\");\\n\\t\\t\\t\\t\\tthat.app.close(true);\\n\\t\\t\\t\\t}).fail(function(a){\\n\\t\\t\\t\\t\\tcw.note(a,\\\"error\\\");\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427318978048\",\n\t\t\t\t\"id\": \".ui\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\t// buttons\\n\\t\\\"#btn-addapp\\\":{\\n\\t\\tbind: function (d,v) {\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\td.apps.push(Object.merge({stamp:Date.now()},this.App.data, true));\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t},\\n\\t\\\"#btn-compact\\\":{\\n\\t\\tbind: function (d,v,$o) {\\n\\t\\t\\tvar dbid = this.db.name;\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\t$o.parent().find(\\\".cw-busy\\\").removeClass(\\\"hide\\\");\\n\\t\\t\\t\\tcw.db(dbid)\\n\\t\\t\\t\\t.compact()\\n\\t\\t\\t\\t.then(function(){\\n\\t\\t\\t\\t\\tif ($o && $o.is(\\\":visible\\\")) $o.parent().find(\\\".cw-busy\\\").addClass(\\\"hide\\\"); \\n\\t\\t\\t\\t\\tcw.note(\\\"DB \\\"+dbid+\\\" sucessfully compacted.\\\",\\\"ok\\\")\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t},\\n\\t\\\"#btn-delete\\\":{\\n\\t\\tbind:function(d,v,$o){\\n\\t\\t\\tvar that=this;\\n\\t\\t\\tif (v!=null){\\n\\t\\t\\t\\tvar db = cw.db(\\\"cw\\\");\\n\\t\\t\\t\\td._cmd=\\\"delete\\\";\\n\\t\\t\\t\\tdb.settings(d).then(function(){\\n\\t\\t\\t\\t\\tcw.note(\\\"Settings saved. DB is being removed.\\\",\\\"warning\\\");\\n\\t\\t\\t\\t}).fail(function(a){\\n\\t\\t\\t\\t\\tcw.note(a,\\\"error\\\");\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t},\\n\\t\\\"#btn-pic\\\":{\\n\\t\\tbind: function (d,v,$o){\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\t//console.log($o, $o.data(), this)\\n\\t\\t\\t\\t$.my.modal({\\n\\t\\t\\t\\t\\tmanifest:\\\"cw.Sys.Cropper.Square\\\",\\n\\t\\t\\t\\t\\tdata:{data:\\\"\\\",filename:\\\"\\\", size:250}\\n\\t\\t\\t\\t}).then(function (crop) {\\n\\t\\t\\t\\t\\tif (crop && crop.data) {\\n\\t\\t\\t\\t\\t\\tvar I=new Image;\\n\\t\\t\\t\\t\\t\\tI.src=\\\"data:image/jpeg;base64,\\\"+crop.data;\\n\\t\\t\\t\\t\\t\\tI.onload=function(){\\n\\t\\t\\t\\t\\t\\t\\tvar img=cw.lib.image(I);\\n\\t\\t\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\t\\t\\td.pic = img.resample(128).sharpen(0.2).jpeg(0.96, true);\\n\\t\\t\\t\\t\\t\\t\\t\\td.ico = img.resample(50).sharpen(0.2).jpeg(0.96);\\n\\t\\t\\t\\t\\t\\t\\t\\t$o.my().root.trigger(\\\"change\\\");\\n\\t\\t\\t\\t\\t\\t\\t}catch(e){\\n\\t\\t\\t\\t\\t\\t\\t\\tconsole.log(e)\\n\\t\\t\\t\\t\\t\\t\\t}\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\tcrop.data=\\\"\\\";\\n\\t\\t\\t\\t\\t\\t\\t$o.my(\\\"find\\\", \\\"#pic\\\").trigger(\\\"check\\\");\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427319025546\",\n\t\t\t\t\"id\": \".ui\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\t// Sync\\n\\t\\\"#btn-resync\\\":{\\n\\t\\tbind:function(d,v,$o){\\n\\t\\t\\tvar that=this;\\n\\t\\t\\tif (v!=null){\\n\\t\\t\\t\\tvar db = cw.db(\\\"cw\\\");\\n\\t\\t\\t\\td._cmd=\\\"resync\\\";\\n\\t\\t\\t\\tdb.settings(d).then(function(){\\n\\t\\t\\t\\t\\tcw.note(\\\"Settings saved. DB is prepared to resync\\\",\\\"warning\\\");\\n\\t\\t\\t\\t}).fail(function(a){\\n\\t\\t\\t\\t\\tcw.note(a,\\\"error\\\");\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\",\\n\\t\\tcss:{\\n\\t\\t\\thide:function(d,v,$o){return !d.sync.length}\\n\\t\\t}\\n\\t},\\n\\t\\\"#btn-tosync\\\":{\\n\\t\\tbind:function(d,v,$o){\\n\\t\\t\\tvar that=this;\\n\\t\\t\\tif (v!=null){\\n\\t\\t\\t\\t$o.parent().find(\\\".cw-busy\\\").removeClass(\\\"hide\\\");\\n\\t\\t\\t\\td._cmd=\\\"sync\\\";\\n\\t\\t\\t\\t\\n\\t\\t\\t\\tvar sl = that.db.settings().sync.filter(function(e){return !!e.dir.length}).length,\\n\\t\\t\\t\\t\\t\\tend = function(){\\n\\t\\t\\t\\t\\t\\t\\tif ($o && jQuery.contains(document, $o[0])) $o.parent().find(\\\".cw-busy\\\").addClass(\\\"hide\\\");\\n\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\tend2 = end.after(sl);\\n\\t\\t\\t\\t\\n\\t\\t\\t\\tcw.db(\\\"cw\\\").settings(d, function(){\\n\\t\\t\\t\\t\\tend2();\\n\\t\\t\\t\\t}).then(function(a){\\n\\t\\t\\t\\t\\tcw.note(a,\\\"ok\\\");\\n\\t\\t\\t\\t}).fail(function(a){\\n\\t\\t\\t\\t\\tend();\\n\\t\\t\\t\\t\\tcw.note(a,\\\"error\\\");\\n\\t\\t\\t\\t});\\n\\n\\t\\t\\t\\t//_getSyncUrl(dbid,i)\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\",\\n\\t\\tcss:{\\n\\t\\t\\thide:function(d){return !d.sync.length}\\n\\t\\t}\\n\\t},\\n\\t\\\"#btn-tosync0\\\":{\\n\\t\\tbind:function(d,v,$o){\\n\\t\\t\\tvar that=this;\\n\\t\\t\\tif (v!=null){\\n\\t\\t\\t\\t$o.parent().find(\\\".cw-busy\\\").removeClass(\\\"hide\\\");\\n\\t\\t\\t\\td._cmd=\\\"sync0\\\";\\n\\t\\t\\t\\t\\n\\t\\t\\t\\tvar sl = that.db.settings().sync.filter(function(e){return !!e.dir.length}).length,\\n\\t\\t\\t\\t\\t\\tend = function(){\\n\\t\\t\\t\\t\\t\\t\\tif ($o && jQuery.contains(document, $o[0])) $o.parent().find(\\\".cw-busy\\\").addClass(\\\"hide\\\");\\n\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\tend2 = end.after(sl);\\n\\t\\t\\t\\t\\n\\t\\t\\t\\tcw.db(\\\"cw\\\").settings(d, function(){\\n\\t\\t\\t\\t\\tend2();\\n\\t\\t\\t\\t}).then(function(a){\\n\\t\\t\\t\\t\\tcw.note(a,\\\"ok\\\");\\n\\t\\t\\t\\t}).fail(function(a){\\n\\t\\t\\t\\t\\tend();\\n\\t\\t\\t\\t\\tcw.note(a,\\\"error\\\");\\n\\t\\t\\t\\t});\\n\\n\\t\\t\\t\\t//_getSyncUrl(dbid,i)\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\",\\n\\t\\tcss:{\\n\\t\\t\\thide:function(d){return !d.sync.length}\\n\\t\\t}\\n\\t},\\n\\t\\\"#btn-addsync\\\":{\\n\\t\\tbind: function (d,v) {\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\td.sync.push(Object.merge({stamp:Date.now()},this.Sync.data, true));\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427318836806\",\n\t\t\t\t\"id\": \".App\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\tdata:{\\n\\t\\tico:\\\"\\\", title:\\\"\\\", url:\\\"\\\"\\n\\t},\\n\\tinit: [\\n\\t\\t{row:\\\"350px\\\", rowCss:\\\"my-row pb10\\\"},\\n\\t\\t[\\\"\\\", '
','inp#apptitle.fs85.w125',{plc:\\\"Title\\\"},\\n\\t\\t '
','inp#appurl.fs75.w220.pt7.pb8.gray',{plc:\\\"App URL hash\\\"},'
']\\n\\t],\\n\\tui:{\\n\\t\\t\\\"#apptitle\\\":{\\n\\t\\t\\tbind:\\\"title\\\",\\n\\t\\t\\tcheck:/^.{0,40}$/,\\n\\t\\t\\terror:\\\"40 chars max\\\"\\n\\t\\t},\\n\\t\\t\\\"#appurl\\\":{\\n\\t\\t\\tbind:function (d,v) {\\n\\t\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\t\\tvar a = v.split(\\\"#\\\").last().split(\\\"/\\\").slice(0,4).compact(true);\\n\\t\\t\\t\\t\\tif (a[0]==this.db.name) a=a.slice(1);\\n\\t\\t\\t\\t\\td.url=a.join(\\\"/\\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\treturn d.url;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427318862261\",\n\t\t\t\t\"id\": \".Sync\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\tdata:{\\n\\t\\tdir:[\\\"from\\\"],\\n\\t\\turl:\\\"\\\",\\n\\t\\tinterval:\\\"0\\\"\\n\\t},\\n\\tinit:[\\n\\t\\t{row:\\\"350px\\\", rowCss:\\\"my-row pb15\\\"},\\n\\t\\t[\\\"\\\", \\n\\t\\t '
',\\n\\t\\t 'inp#syncurl.fs80.w350',{plc:\\\"CouchDB URL\\\"},\\n\\t\\t '
',\\n\\t\\t 'spn#syncdir.dib.mt1.vat.fs80',\\n\\t\\t '
',\\n\\t\\t ' in ',\\n\\t\\t 'num#interval.fs80.w70.pt2.pb2',{min:0, max:7220},\\n\\t\\t ' minute intervals',\\n\\t\\t '
'\\t\\t\\t\\t\\n\\t\\t]\\n\\t],\\n\\tui:{\\n\\t\\t\\\"#syncurl\\\":{\\n\\t\\t\\tbind:\\\"url\\\",\\n\\t\\t\\tcheck:/^(|http[s]?:\\\\/\\\\/([^\\\\/]{1,100}\\\\/){1,5}[a-z0-9_$\\\\(\\\\)+\\\\-]{2,200}[\\\\/]?)$/,\\n\\t\\t\\terror:\\\"Invalid CouchDB URL\\\"\\n\\t\\t},\\n\\t\\t\\\"#syncdir\\\":{\\n\\t\\t\\tbind:\\\"dir\\\",\\n\\t\\t\\tinit:function($o) {\\n\\t\\t\\t\\t$o.tags({tags:[{\\\"From\\\":\\\"from\\\"},{\\\"To\\\":\\\"to\\\"}]})\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t\\\"#interval\\\":\\\"interval\\\"\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427318920921\",\n\t\t\t\t\"id\": \".HTML\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"([\\n\\t '
',\\n\\t\\t'
',\\n\\t\\t\\t'
',\\n\\t\\t\\t'
',\\n\\t\\t\\t'
',\\n\\t\\t\\t\\t{row:\\\"200px\\\",rowCss:\\\"my-row\\\"},\\n\\t\\t\\t\\t['', 'btn#btn-save.fs100.w90.tac.mr5.green',{val:\\\"Save\\\",title:\\\"Saves DB settings\\\"},\\n\\t\\t\\t\\t \\t'btn#btn-close.fs100.w90.tac',{val:\\\"Close\\\",title:\\\"Close and discards changes\\\"}],\\n\\t\\t\\t'
',\\n\\t\\t'
',\\n\\t\\t'
',\\n\\t\\t\\t'',\\n\\t\\t\\t\\t'',\\n\\t\\t\\t\\t'',\\n\\t\\t\\t'
',\\n\\t\\t\\t\\t\\t'',\\n\\t\\t\\t\\t\\t'
',\\n\\t\\t\\t\\t\\t\\t'Change...',\\n\\t\\t\\t\\t\\t'
',\\n\\t\\t\\t\\t'
',\\n\\t\\t\\t\\t\\t{row:\\\"580px\\\", rowCss:\\\"my-row pb10\\\"},\\n\\t\\t\\t\\t\\t['', 'inp#title.fs120.w350',{plc:\\\"DB title\\\"},\\n\\t\\t\\t\\t\\t '
DB title as it will be shown in the left pane
',\\n\\t\\t\\t\\t\\t 'msg'],\\n\\t\\t\\t\\t\\t['', 'txt#desc.fs90.w350',{plc:\\\"Description\\\"},\\n\\t\\t\\t\\t\\t '
Short memo about db source, owner if any and so on
',\\n\\t\\t\\t\\t\\t 'msg'],\\n\\t\\t\\t\\t'
',\\n\\t\\t'
',\\n\\t\\t'
',\\n\\t\\t\\t{row:\\\"700px\\\", label:\\\"120px\\\", rowCss:\\\"my-row pb10\\\", labelCss:\\\"my-label fs80 gray\\\"},\\n\\t\\t\\t['Default app', 'inp#start.w350.fs90',{plc:\\\"App name or app URL hash\\\"},\\n\\t\\t\\t '
Default app to run when DB is clicked in left pane
',\\n\\t\\t\\t 'msg'\\n\\t\\t\\t],\\n\\t\\t\\t['Other apps',\\n\\t\\t\\t '
',\\n\\t\\t\\t \\t'div#apps.w350', {style:\\\"min-height: 9px;\\\"}, \\n\\t\\t\\t\\t '
',\\n\\t\\t\\t\\t \\t'spn#btn-addapp.pseudolink.fs70',{txt:\\\" Add application to left aside panel\\\"},\\n\\t\\t\\t\\t '
',\\n\\t\\t\\t'
',\\n\\t\\t\\t '
Apps pinned in the left pane. Paste URL – and app is pinned.
'\\n\\t\\t\\t],\\n\\t\\n\\t\\t\\t'
',\\n\\t\\n\\t\\t\\t['External sync',\\n\\t\\t\\t \\t'
',\\n\\t\\t\\t \\t\\t'div#sync.w350', {style:\\\"min-height: 9px;\\\"}, \\n\\t\\t\\t \\t\\t'
',\\n\\t\\t\\t \\t\\t\\t'spn#btn-addsync.pseudolink.fs70',{txt:\\\" Add link to external CouchDB\\\"},\\n\\t\\t\\t \\t\\t\\t'
',\\n\\t\\t\\t\\t'
',\\n\\t\\t\\t\\t'
External DBs to replicate to/from
'\\n\\t\\t\\t],\\n\\t\\t\\t\\n\\t\\t\\t['Force sync', \\n\\t\\t\\t 'spn#btn-tosync.pseudolink.fs90.green.my-tags',{txt:\\\"From checkpoint\\\"},\\n\\t\\t\\t 'spn#btn-tosync0.pseudolink.fs90.green.my-tags.ml20',{txt:\\\"Full re-sync\\\"},\\n\\t\\t\\t '
',\\n\\t\\t\\t '
Tries to make full sync, it can take time.
',\\n\\t\\t\\t 'msg'\\n\\t\\t\\t],\\n\\t\\t\\t['Resync DB', 'spn#btn-resync.pseudolink.fs85.o80.red.my-tags',{txt:\\\"Clear and resync DB\\\"},\\n\\t\\t\\t '
Deletes DB and resyncs it back. No rollback if DB isn’t synced.
',\\n\\t\\t\\t 'msg'\\n\\t\\t\\t],\\n\\t\\n\\t\\t\\t'
',\\n\\t\\n\\t\\t\\t['Compact', 'spn#btn-compact.pseudolink.fs90.green',{txt:\\\"Start compaction\\\"},\\n\\t\\t\\t '
',\\n\\t\\t\\t '
Perfoms DB compaction, can fix replication issues.
',\\n\\t\\t\\t 'msg'\\n\\t\\t\\t],\\n\\t\\t\\t['Delete DB', 'spn#btn-delete.pseudolink.fs85.o80.red',{txt:\\\"Delete DB permanently\\\"},\\n\\t\\t\\t '
Deletes DB and all docs in it. No rollback if DB isn’t synced.
',\\n\\t\\t\\t 'msg'\\n\\t\\t\\t],\\n\\t\\t\\t\\n\\t\\t'
',\\n\\t\\t'
',\\n\\t\\t''\\n\\t])\",\n\t\t\t\t\"active\": true,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t}],\n\t\t\"width\": [800],\n\t\t\"_cmd\": [],\n\t\t\"_type\": [\"app\"]\n\t},\n\t\"log\": [[1435630910112,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t30,\n\t\t\t\"CloudWall\"],\n\t\t[1435599159150,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t29,\n\t\t\t\"CloudWall\"],\n\t\t[1435275219093,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t27,\n\t\t\t\"CloudWall\"],\n\t\t[1428388890071,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t26,\n\t\t\t\"CloudWall\"],\n\t\t[1428253403419,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t25,\n\t\t\t\"CloudWall\"],\n\t\t[1428099925189,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t24,\n\t\t\t\"CloudWall\"],\n\t\t[1428098645017,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t23,\n\t\t\t\"CloudWall\"],\n\t\t[1427920143925,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t19,\n\t\t\t\"CloudWall\"],\n\t\t[1427643539074,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t18,\n\t\t\t\"CloudWall\"],\n\t\t[1427642823917,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t16,\n\t\t\t\"CloudWall\"],\n\t\t[1427641923086,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t8,\n\t\t\t\"CloudWall\"],\n\t\t[1427468161500,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t7,\n\t\t\t\"CloudWall\"],\n\t\t[1427320983967,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t6,\n\t\t\t\"CloudWall\"],\n\t\t[1427319992405,\n\t\t\t\"create\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t1,\n\t\t\t\"CloudWall\"]],\n\t\"_id\": \"cw-Sys-Db-Settings-4vx1\",\n\t\"_rev\": \"31-2ee66085e703e44b4404b7e727913d53\"\n}", "parser": "(function (item, atts){\n\n\tvar z, src = eval('('+ item.data+')');\n\t\n\tz = Object.reject(src.manifest,\"files\");\n\tif (src._attachments) z.files = src._attachments;\n\t\n\tz.app.name = \"DBSettings\";\n\tsrc = null;\n\treturn cw.lib.js2txt(z,'\\t');\n})", "parserActive": true, "Uglify": false, "noIncludes": true, "external": "pouch://cw-Sys-Db-Settings-4vx1", "state": { "savedSdbm": "5vt895ii", "sdbm": "5vt895ii", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "1374gghk", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Sys.Db.List", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"name\": \"Sys.Db.List\",\n\t\"title\": \"Doc List\",\n\t\"type\": \"manifest\",\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ermouth-1ermouth\",\n\t\"manifest\": {\n\t\t\"id\": \"cw.Sys.Db.List\",\n\t\t\"build\": 46,\n\t\t\"init\": function ($o,form) {\n\n\n\tvar pi = $.Deferred(), \n\t\t\tchanges,\n\t\t\tfd = form.data,\n\t\t\tposts = fd.items, \n\t\t\tacts = fd.actions,\n\t\t\tapps = fd.apps,\n\t\t\ttypes=fd.types,\n\t\t\tbytype=fd.bytype,\n\t\t\tthat=this,\n\t\t\t$list, $start,$blist,\n\t\t\tsets = this.db.settings(),\n\t\t\tdbid=this.db.name;\n\n\t$o.formgen(that.HTML);\n\n\t$blist = $o.find(\"#brieflist\");\n\t$start = $o.find(\"#start\");\n\t\n\t\n\t\n\t// load docs info\n\tthat.db.query(\"cloudwall/info\", {descending:true})\n\t.then(\n\t\tfunction(res){\n\t\t\t(function(){pi.resolve();}).delay(1);\t\n\t\t\t_rebuild(res);\n\t\t\tthat.db.watch(\"\").progress(function(docs){\n\t\t\t\t\n\t\t\t\t//console.log(docs)\n\t\t\t\t\n\t\t\t\tvar i, keys=[], del=[];\n\t\t\t\tfor (i=0;i'\n\t\t\t\t\t\t\t\t\t\t).appendTo($(\"body\")));\n\t\t\t}\n\t\t\t(function(){\n\t\t\t\t$(\".cw-List-tips\").fadeIn(500, function(){\n\t\t\t\t\t$o.on(\"click.tips\", function(){\n\t\t\t\t\t\t$(\".cw-List-tips\").fadeOut(500, function(){$(\".cw-List-tips\").remove()});\n\t\t\t\t\t\t$o.unbind(\".tips\");\n\t\t\t\t\t})\n\t\t\t\t}).on(\"click\", function(){\n\t\t\t\t\t$(\".cw-List-tips\").fadeOut(500, function(){$(\".cw-List-tips\").remove()})\n\t\t\t\t});\n\t\t\t}).delay(20);\n\t\t}\n\t}\n\n\t\t\t},\n\t\t\"Filter\": function (dbres,del) {\n\n\tvar i,j,r, a, obj, reg, tmp,\n\t\t\tthat = this, \n\t\t\tf=[];\n\t\n\t// Parse DB response\n\tif (dbres && dbres.rows) {\n\t\ttmp = {};\n\t\tfor(i=0;i Hide doc?'\n\t\t\t\t\t+'

You’ll never see this doc again, but it is not removed '\n\t\t\t\t\t+'from DB. Useful for shared DBs.

',\n\t\t\t\t\tok:\"Mark as hidden\"\n\t\t\t\t}\n\t\t\t}).always(function(r){\n\t\t\t\tif (Object.isObject(r) && r.cmd===\"commit\") {\n\t\t\t\t\tcw.db(db).hide(id);\n\t\t\t\t\tcw.note(\"Doc hidden\",\"ok\");\n\t\t\t\t}\n\t\t\t});\n\t\t} \n\t\telse if (act===\"_export\" && doc) {\n\t\t\tdblist = cw.dbs(); delete dblist[db];\n\t\t\tform.app.modal({\n\t\t\t\tmanifest:Object.merge(\n\t\t\t\t\tform.db.form(\"cw.Sys.Confirm\"),{\n\t\t\t\t\t\tui:{\n\t\t\t\t\t\t\t\"#dest\":{\n\t\t\t\t\t\t\t\tinit: function ($o) {\n\t\t\t\t\t\t\t\t\tvar html=\"\", list=dblist;\n\t\t\t\t\t\t\t\t\t$o.tags({tags:[\n\t\t\t\t\t\t\t\t\t\tObject.keys(list).map(function(i){\n\t\t\t\t\t\t\t\t\t\t\tvar obj = {};\n\t\t\t\t\t\t\t\t\t\t\tobj[list[i].escapeHTML()] = i;\n\t\t\t\t\t\t\t\t\t\t\treturn obj;\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t]});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tbind:\"dest\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"#options\":{\n\t\t\t\t\t\t\t\tinit: function($o) {\n\t\t\t\t\t\t\t\t\tvar tags = [[{\"Restart revision\":\"newrev\"}]];\n\t\t\t\t\t\t\t\t\tif (doc.type!=\"manifest\") tags.push([{\"New doc ID\":\"newid\"}]);\n\t\t\t\t\t\t\t\t\t$o.tags({tags:tags})\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tbind:\"options\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, true),\n\t\t\t\tdata:{\n\t\t\t\t\ttext:' Select destination DB'\n\t\t\t\t\t+'

'\n\t\t\t\t\t+'

Options:

',\n\t\t\t\t\tok:' Copy',\n\t\t\t\t\tdest:Object.keys(dblist)[0],\n\t\t\t\t\toptions:[\"newrev\"]\n\t\t\t\t},\n\t\t\t\tesc:true\n\t\t\t}).always(function(r){\n\t\t\t\tif (Object.isObject(r) && r.cmd===\"commit\") {\n\t\t\t\t\tcw.db(db)\n\t\t\t\t\t.get(id, {attachments:true})\n\t\t\t\t\t.then(function(doc){\n\t\t\t\t\t\tvar pi=$.Deferred();\n\t\t\t\t\t\t// check if doc exists in dest DB\n\t\t\t\t\t\tcw.db(r.dest+\"\").get(doc._id, function(e, destdoc){\n\t\t\t\t\t\t\tif (!destdoc || r.options.indexOf(\"newid\")>-1) {\n\t\t\t\t\t\t\t\t_save(true, r.options);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// confirm overwrite\n\t\t\t\t\t\t\t\t$.my.modal({\n\t\t\t\t\t\t\t\t\tmanifest:\"cw.Sys.Confirm\",\n\t\t\t\t\t\t\t\t\tdata:{\n\t\t\t\t\t\t\t\t\t\ttext:' Doc exists in destination DB. '\n\t\t\t\t\t\t\t\t\t\t+'Saving will overwrite existing doc.',\n\t\t\t\t\t\t\t\t\t\tok:\"Overwrite\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}).then(function(d){\n\t\t\t\t\t\t\t\t\tif (Object.isObject(d) && d.cmd===\"commit\") {\n\t\t\t\t\t\t\t\t\t\tdoc._rev = destdoc._rev;\n\t\t\t\t\t\t\t\t\t\t_save(false, r.options);\n\t\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t\telse pi.reject(\"Overwite cancelled\");\n\t\t\t\t\t\t\t\t}).fail(function(){\n\t\t\t\t\t\t\t\t\tpi.reject(\"Overwite cancelled\");\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tpi.then(function(doc){\n\t\t\t\t\t\t\tcw.note('Doc '+(doc.title||doc.name||doc._id).stripTags()+' copied to '+dblist[r.dest],\"ok\");\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.fail(function(){\n\t\t\t\t\t\t\tcw.note(\"Copy failed\",\"error\");\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\treturn pi.promise();\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Saver itself\n\t\t\t\t\t\t\n\t\t\t\t\t\tfunction _save(isnew, opts){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar doc0 = Object.reject(doc, \"_db\");\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (opts.indexOf(\"newid\")>-1) doc0._id = cw.lib.uuid(); \n\t\t\t\t\t\t\tif (isnew && opts.indexOf(\"newrev\")>-1) delete doc0._rev;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcw.db(r.dest+\"\").save(doc0, true)\n\t\t\t\t\t\t\t.then(function(a,b){\n\t\t\t\t\t\t\t\tpi.resolve(a,b);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.fail(function(a,b){pi.reject(a,b)});\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}, function(a,b){pi.reject(\"Failed reading file to copy\")});\n\t\t\t\t}\n\t\t\t});\n\t\t} \n\t} else if (app) {\n\t\turl=db+\"/\"+app.app.name+\"/\"+cw.lib.tourl64([act,id]);\n\t}\n\tif (url) _run(url);\n\tfunction _run(url) {form.app.run(url);}\n\n\t\t\t},\n\t\t\"app\": {\n\t\t\t\"name\": \"Sys.Db.List\",\n\t\t\t\"version\": \"2\",\n\t\t\t\"timeout\": \"15000\",\n\t\t\t\"title\": \"Doc List\",\n\t\t\t\"author\": \"ermouth\",\n\t\t\t\"ico\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQECAgMCAgICAgQDAwI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qzW5vL+aeOOQHIfy2baSCARkHBAPavmeNMDxnn+UYnJK2Bw9GGJhKm5rFVJuCmuVyUPqsOZpNtLmjd6XR6/D+J4eyzHUcxp4mrUlRkpqPsYx5nF3Scvbysm93Z2XRn0pRRRX9BH5aFFFFABRRRQAUUUUAFFFFAH//Z\",\n\t\t\t\"nodetitle\": \"title\",\n\t\t\t\"build\": 45,\n\t\t\t\"maskstate\": {\n\t\t\t\t\"mode\": true,\n\t\t\t\t\"search\": true,\n\t\t\t\t\"sort\": true\n\t\t\t},\n\t\t\t\"width\": [795,\n\t\t\t\t1060,\n\t\t\t\t1325],\n\t\t\t\"collapsed\": []\n\t\t},\n\t\t\"params\": {\n\t\t\t\"delay\": 50\n\t\t},\n\t\t\"Show\": [],\n\t\t\"All\": {\n\t\t},\n\t\t\"data\": {\n\t\t\t\"search\": \"\",\n\t\t\t\"reg\": \"\",\n\t\t\t\"title\": \"List All DB Items\",\n\t\t\t\"mode\": [\"columns-brief\"],\n\t\t\t\"sort\": [\"Type\"],\n\t\t\t\"items\": {\n\t\t\t},\n\t\t\t\"actions\": {\n\t\t\t},\n\t\t\t\"apps\": {\n\t\t\t},\n\t\t\t\"types\": {\n\t\t\t},\n\t\t\t\"bytype\": {\n\t\t\t},\n\t\t\t\"start\": []\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#dbname\": function (d) {\n\n\t\tvar t = this.db.settings().title, html=\"\", tail=''; \n\t\td.title=t;\n\t\tif (t.length>18) html+=''+t.truncate(18,\"right\",\"\")+'...';\n\t\telse if (t.length>16) html+=''+t;\n\t\telse if (t.length>14) html+=''+t;\n\t\telse html=t, tail=\"\";\n\t\treturn html+''+tail;\n\t\n\t\t\t\t},\n\t\t\t\"#dbico\": function (d) {\n\n\t\treturn d.ico = (this.db.settings().ico || this.db.settings().pic);\n\t\n\t\t\t\t},\n\t\t\t\"#start\": {\n\t\t\t\t\"init\": function ($o,form) {\n\n\t\tvar that=this;\n\t\t$o.list({\n\t\t\tdata:[],\n\t\t\tchunk:100,\n\t\t\tdelay:1,\n\t\t\ttemplate:function(doc,idx){\n\t\t\t\tvar html=\"\";\n\t\t\t\thtml+=\n\t\t\t\t\t'
'\n\t\t\t\t+''\n\t\t\t\t+'
'\n\t\t\t\t+''+doc.title+''\n\t\t\t\t+'
'\n\t\t\t\t+'
';\n\t\t\t\treturn html;\n\t\t\t},\n\t\t\thash: function (e) {return e.title+e.name+e.pic.length},\n\t\t\tid: function (e) {return e.id}\n\t\t});\n\t\t$o.on(\"click.my\", \".cw-List-app\", function(){\n\t\t\t$o.my(\"find\",\"#btn-start\").click();\n\t\t\tthat.app.run(that.db.name+\"/\"+$(this).data(\"app\"));\n\t\t});\n\t\tcw.event().progress(function(e){\n\t\t\tif (/^app/.test(e)) $o.trigger(\"check\");\n\t\t});\n\t\n\t\t\t\t\t},\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\tvar that=this;\n\t\tif (null!=v) {\n\t\t\td.start = that.db.app().map(function(e){\n\t\t\t\treturn e===\"List\"?null:that.db.app(e)\n\t\t\t}).compact().sortBy(\"title\");\n\t\t\t$o.list(\"data\", d.start);\n\t\t}\n\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#sort\": {\n\t\t\t\t\"bind\": \"sort\",\n\t\t\t\t\"init\": function ($o) {\n\n\t\t\t$o.tags({\n\t\t\t\ttags:[Object.keys(this.Sorters).slice(1)],\n\t\t\t\tempty:(function(t){\n\t\t\t\t\tvar r={}, k=Object.keys(t.Sorters)[0];\n\t\t\t\t\tr[k]=k;\n\t\t\t\t\treturn r;\n\t\t\t\t})(this)\n\t\t\t});\n\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#mode\": {\n\t\t\t\t\"bind\": \"mode\",\n\t\t\t\t\"init\": function ($o) {\n\n\t\t\t$o.tags({\n\t\t\t\tempty:{'':\"columns-brief\"},\n\t\t\t\ttags:[[{'':\"grid-medium\"}]],\n\t\t\t\tgroupshim:\"\"\n\t\t\t});\n\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#search\": {\n\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\tif (v!=null) {\n\t\t\t\td.search=v.to(100);\n\t\t\t\tif (v.length>0) d.reg = new RegExp(\n\t\t\t\t\t\"(\"\n\t\t\t\t\t+d.search.toLowerCase()\n\t\t\t\t\t.compact().split(/[\\s,]/)\n\t\t\t\t\t.compact(true)\n\t\t\t\t\t.map(function(e){return RegExp.escape(e)})\n\t\t\t\t\t.join(\"|\")+\")\",\"i\"\n\t\t\t\t);\n\t\t\t\treturn v;\n\t\t\t}\n\t\t\treturn d.search;\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"my-search\": /^[^\\s][^\\s]+/\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"#xproxy\": {\n\t\t\t\t\"delay\": 100,\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tthis.Filter();\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"watch\": \"#filter,#search,#sort,#mode\"\n\t\t\t},\n\t\t\t\"#xstatus\": {\n\t\t\t\t\"delay\": 100,\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tif (!this.Show.length) return '
List is empty
— ※ —
';\n\t\t\telse return \"\";\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"watch\": \"#xproxy,#brieflist\"\n\t\t\t},\n\t\t\t\"#brieflist\": {\n\t\t\t\t\"bind\": \"this.Show\",\n\t\t\t\t\"id\": function (e) {\n\n\t\treturn cw.lib.sdbm([\n\t\t\te.id,\n\t\t\te.rev,\n\t\t\t(new Date()).getDate(),\n\t\t\te.read\n\t\t]);\n\t\n\t\t\t\t\t},\n\t\t\t\t\"hash\": function (e) {\n\n\t\treturn cw.lib.sdbm([\n\t\t\te.id,\n\t\t\te.rev,\n\t\t\t(new Date()).getDate(),\n\t\t\te.read\n\t\t]);\n\t\n\t\t\t\t\t},\n\t\t\t\t\"init\": function ($o,form) {\n\n\t\tvar that =this,\n\t\t\t\t_act = that.Cmd.fill(that);\n\t\t\n\t\t// list trackers\t\t\t\t\n\t\t$o.on(\"click.my\", \"#bimg,#btxt\", function (){\n\t\t\tvar $p=$(this).my().root,\n\t\t\t\t\tdata = $p.my(\"data\"),\n\t\t\t\t\tid = data.id, \n\t\t\t\t\tdb = that.db.name,\n\t\t\t\t\tact = $(this).data(\"action\")||\"_more\",\n\t\t\t\t\turl, \n\t\t\t\t\tapp,\n\t\t\t\t\tappid,\n\t\t\t\t\tacts = form.data.actions,\n\t\t\t\t\tapps = form.data.apps;\n\t\t\t\n\t\t\tif (act===\"_more\") {\n\t\t\t\tthat.app.modal({\n\t\t\t\t\tmanifest:\"cw.Sys.Db.DocInfo\", \n\t\t\t\t\twidth:700,\n\t\t\t\t\tdata:{db:that.db, id:id}, \n\t\t\t\t\tesc:true\n\t\t\t\t}).always(function(a) {\n\t\t\t\t\tvar act;\n\t\t\t\t\tif (Object.isObject(a) && a.cmd) {\n\t\t\t\t\t\tact=a.cmd;\n\t\t\t\t\t\tapp = $o.my().data.apps[((acts[data.type]||{})[act]||[])[0]];\n\t\t\t\t\t\t_act( act, db, id, app);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tappid = ((acts[data.type]||{})[act]||[])[0];\n\t\t\t\tapp = apps[appid];\n\t\t\t\t_act(act, db, id, app);\t\n\t\t\t}\n\t\t});\n\t\t\n\t\n\t\t\t\t\t},\n\t\t\t\t\"list\": \"
\",\n\t\t\t\t\"manifest\": \"this.ItemBrief\",\n\t\t\t\t\"watch\": \"#xproxy\",\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"xcol5\": function (d,v,$o) {\n\t\t\t\t\t\tvar w = $o.width(); return (w>=1099); \n\t\t\t\t\t\t},\n\t\t\t\t\t\"xcol4\": function (d,v,$o) {\n\t\t\t\t\t\tvar w = $o.width(); return (w>900 && w<1110); \n\t\t\t\t\t\t},\n\t\t\t\t\t\"xcol3\": function (d,v,$o) {\n\t\t\t\t\t\tvar w = $o.width(); return (w<=900); \n\t\t\t\t\t\t},\n\t\t\t\t\t\"columns-brief\": function (d) {\n\t\t\t\t\t\treturn d.mode == \"columns-brief\" \n\t\t\t\t\t\t},\n\t\t\t\t\t\"grid-medium\": function (d) {\n\t\t\t\t\t\treturn d.mode == \"grid-medium\" \n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"#btn-sync\": {\n\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\tif (v!=null) {\n\t\t\t\tvar that = this;\n\t\t\t\tthat.db.sync(false);\n\t\t\t\t(function(){\n\t\t\t\t\tthat.db.sync(true);\n\t\t\t\t\tthat.Syncing = true;\n\t\t\t\t\tcw.note(\"Trying to resync...\");\n\t\t\t\t}).delay(700);\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\",\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"self:hide\": function (d) {\n\n\t\t\t\tvar that = this,\n\t\t\t\t\tsyncs = (that.db.settings().sync||[]).reduce(function(a,b){\n\t\t\t\t\t\tif (b.dir+\"\") return a+1;\n\t\t\t\t\t\treturn a;\n\t\t\t\t\t},0);\n\t\t\t\treturn !syncs;\n\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"#btn-settings\": {\n\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\tif (v!=null) {\n\t\t\t\tthis.app.run(this.db.name+\"/DBSettings\");\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t}\n\t\t},\n\t\t\"ItemBrief\": {\n\t\t\t\"id\": \"cw.Sys.Db.List2.ItemBrief\",\n\t\t\t\"ui\": {\n\t\t\t\t\"#bpicto\": function (d) {\n\n\t\t\tvar css=\"\";\n\t\t\tif (d.crypto) {\n\t\t\t\tcss=\"fi-key \"+(cw.crypto.keys().findIndex(function(e){return e.id==d.crypto})>-1?\"green\":\"red\");\n\t\t\t}\n\t\t\t//else if (d.type == \"user\") css=\"fi-torso fs90 o70\";\n\t\t\tif (css) return ' ';\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"#bimg\": {\n\t\t\t\t\t\"bind\": \"pic\",\n\t\t\t\t\t\"css\": {\n\t\t\t\t\t\t\"bapp\": function (d) {\n\t\t\t\t\t\t\treturn !!d.app\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#btxt\": {\n\t\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tvar css = \"\", cmd=\"\";\n\t\t\t\tif (d.app) {\n\t\t\t\t\tcss+=\"fs110 lh115 bold \";\n\t\t\t\t\tcmd=\"_run\";\n\t\t\t\t}\n\t\t\t\telse if (d.actions && d.actions.edit) {\n\t\t\t\t\tcmd=\"edit\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!d.app && d.title.length>30 && Object.size(d.actions)) css+=\"lh130 fs95 \";\n\t\t\t\t\n\t\t\t\tif (cmd) $o.data(\"action\", cmd);\n\t\t\t\treturn ''+d.title+'';\n\t\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"css\": {\n\t\t\t\t\t\t\"fs90\": function (d) {\n\t\t\t\t\t\t\treturn d.type!=\"user\" && !Object.size(d.actions)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#binfo\": {\n\t\t\t\t\t\"css\": {\n\t\t\t\t\t\t\"blue\": function (d) {\n\t\t\t\t\t\t\treturn d.read && !d.read.rev.startsWith(d.rev);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\"skyblue\": function (d) {\n\t\t\t\t\t\t\treturn !d.read && d.type!=\"user\" && Object.size(d.actions)\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\"o90 trim lh110\": function (d) {\n\t\t\t\t\t\t\treturn !Object.size(d.actions)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#btype\": {\n\t\t\t\t\t\"bind\": function (d) {\n\n\t\t\t\tvar css=\"\", h=[], \n\t\t\t\t\t\tt = d.type.capitalize();\n\n\t\t\t\tif (d.app) t = \"App\";\n\t\t\t\tif (t===\"Manifest\") css=\"fi-widget\";\n\t\t\t\telse if (t===\"App\") css=\"fi-layout\";\n\t\t\t\telse if (t===\"User\") css=\"fi-torso\";\n\t\t\t\th.push((css?'':'')\n\t\t\t\t\t\t\t +''+t+'');\n\n\t\t\t\tif (d.stamp) h.push(\n\t\t\t\t\t''+cw.lib.date(+d.stamp, \"short\")\n\t\t\t\t\t+''\n\t\t\t\t);\n\n\t\t\t\tif (d.files.length) h.push(' '+d.files.length);\n\n\t\t\t\treturn h.length?h.join(\" · \"):\"\";\n\t\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"css\": {\n\t\t\t\t\t\t\"pt2\": function (d) {\n\t\t\t\t\t\t\treturn !d.app\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#btags\": {\n\t\t\t\t\t\"bind\": function (d) {\n\n\t\t\t\tvar h=\"\", t = Object.keys(d.tags);\n\t\t\t\tif (t.length) {\n\t\t\t\t\th = '#'\n\t\t\t\t\t\t+t.map(function(e){\n\t\t\t\t\t\t\treturn ''+e+'';\n\t\t\t\t\t\t}).to(6).join(\", \");\n\t\t\t\t}\n\t\t\t\treturn h;\n\t\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"css\": {\n\t\t\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\t\t\treturn !Object.size(d.tags)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"Sorters\": {\n\t\t\t\"Type\": function (e) {\n\n\t\tvar t=\"\";\n\t\tif (e.type===\"manifest\" && e.app) t=\"0|\"+e.title;\n\t\telse if (e.type===\"user\") t=\" ̄0|\"+e.title;\n\t\telse if (!Object.size(e.actions)) t=\" ̄1|\"+e.type+\"|\"+e.title;\n\t\telse t=\"1|\"+e.type+\"|\"+e.title;\n\t\treturn t;\n\t\n\t\t\t\t},\n\t\t\t\"AZ\": function (e) {\n\n\t\treturn e.title;\n\t\n\t\t\t\t},\n\t\t\t\"Modified\": function (e) {\n\n\t\treturn 1e16-e.stamp;\n\t\n\t\t\t\t}\n\t\t},\n\t\t\"style\": {\n\t\t\t\" .bitem\": \"transition:width 0.1s, padding:0.1s, margin:0.1s;width:245px;display:inline-block;vertical-align:top;\",\n\t\t\t\" #bimg\": \"transition:width 0.1s, height 0.1s, margin 0.1s;margin-right:10px;display:inline-block;vertical-align:top;border-radius:3px;cursor:help;cursor:context-menu;\",\n\t\t\t\" #binfo\": \"transition:width 0.1s, font-size 0.1s;display:inline-block;vertical-align:top;font-size:90%;line-height:1.2em;\",\n\t\t\t\" .baux\": \"transition:height 0.1s, opacity 0.1s; xoverflow:hidden; font-size:80%; padding-top: 0.1em;\",\n\t\t\t\" .pseudolink.btag\": \"border-bottom-style: dotted!important;\",\n\t\t\t\" .trim\": \"white-space:nowrap;width:100%;xoverflow:hidden;text-overflow:ellipsis\",\n\t\t\t\" .cw-List-nav .dbname\": \"margin:-4px 8px 0 10px;white-space:nowrap;width:220px;overflow:hidden;text-overflow:ellipsis\",\n\t\t\t\" .xcol5\": \"overflow-y: visible!important;clear: both;height: auto!important;-webkit-column-count: 5!important;-webkit-column-gap: 25px; column-count: 5!important; column-gap: 25px;-moz-column-count: 5!important;-moz-column-gap: 25px;\",\n\t\t\t\" .xcol4\": \"overflow-y: visible!important;clear: both;height: auto!important;-webkit-column-count: 4!important;-webkit-column-gap: 25px; column-count: 4!important; column-gap: 25px;-moz-column-count: 4!important;-moz-column-gap: 25px;\",\n\t\t\t\" .xcol3\": \"overflow-y: visible!important;clear: both;height: auto!important;-webkit-column-count: 3!important;-webkit-column-gap: 25px; column-count: 3!important; column-gap: 25px;-moz-column-count: 3!important;-moz-column-gap: 25px;\",\n\t\t\t\" .columns-brief\": {\n\t\t\t\t\" .bitem\": \"padding:3px 0 5px 0;\",\n\t\t\t\t\" #bimg\": \"width:20px;height:20px;border-radius:2px;\",\n\t\t\t\t\" #binfo\": \"width:215px;font-size:85%;\",\n\t\t\t\t\" .baux\": \"display:none;opacity:0;\"\n\t\t\t},\n\t\t\t\" .grid-medium\": {\n\t\t\t\t\" .bitem\": \"padding:7px 0 9px 0;\",\n\t\t\t\t\" #bimg\": \"width:25px;height:25px;border-radius:3px;margin:2px 18px 0 7px;\",\n\t\t\t\t\" #bimg.bapp\": \"width:38px;height:38px;border-radius:3px;margin:3px 12px 0 0;\",\n\t\t\t\t\" #binfo\": \"width:195px;font-size:90%;\",\n\t\t\t\t\" .baux\": \"display:block;opacity:1;\",\n\t\t\t\t\" #btags\": \"display:none;\"\n\t\t\t}\n\t\t},\n\t\t\"HTML\": [\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"\",\n\t\t\t\"\",\n\t\t\t\"
\",\n\t\t\t\"\",\n\t\t\t{\n\t\t\t\t\"label\": \"65px\",\n\t\t\t\t\"row\": \"265px\",\n\t\t\t\t\"labelCss\": \"fs90 lh110 gray\",\n\t\t\t\t\"rowCss\": \"my-row dib vat mt2\"\n\t\t\t},\n\t\t\t[\"\",\n\t\t\t\t\"spn#mode.fs100.mr15\",\n\t\t\t\t\"  \",\n\t\t\t\t\"spn#sort.fs95\"],\n\t\t\t\"
\",\n\t\t\t\"\",\n\t\t\t\"
\",\n\t\t\t\" Settings\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\"],\n\t\t\"views\": {\n\t\t\t\"info\": {\n\t\t\t\t\"map\": function (doc) {\n\n\t\t\tvar i, stamp=0,\n\t\t\t\t\ttype = doc.type,\n\t\t\t\t\ttags = {}, mantype = \"\", \n\t\t\t\t\tobj, att, atts=[];\n\t\t\tif (typeof type === \"string\" && type) {\n\t\t\t\tstamp = doc.stamp || doc.created || stamp;\n\t\t\t\tif (typeof doc.tags === \"object\") {\n\t\t\t\t\tif (typeof doc.tags.slice === \"function\") {\n\t\t\t\t\t\tfor (i=0;i'\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t).appendTo($(\\\"body\\\")));\\n\\t\\t\\t}\\n\\t\\t\\t(function(){\\n\\t\\t\\t\\t$(\\\".cw-List-tips\\\").fadeIn(500, function(){\\n\\t\\t\\t\\t\\t$o.on(\\\"click.tips\\\", function(){\\n\\t\\t\\t\\t\\t\\t$(\\\".cw-List-tips\\\").fadeOut(500, function(){$(\\\".cw-List-tips\\\").remove()});\\n\\t\\t\\t\\t\\t\\t$o.unbind(\\\".tips\\\");\\n\\t\\t\\t\\t\\t})\\n\\t\\t\\t\\t}).on(\\\"click\\\", function(){\\n\\t\\t\\t\\t\\t$(\\\".cw-List-tips\\\").fadeOut(500, function(){$(\\\".cw-List-tips\\\").remove()})\\n\\t\\t\\t\\t});\\n\\t\\t\\t}).delay(20);\\n\\t\\t}\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1418479639333\",\n\t\t\t\t\"id\": \".ui\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\t\\\"#dbname\\\":function (d){\\n\\t\\tvar t = this.db.settings().title, html=\\\"\\\", tail='
'; \\n\\t\\td.title=t;\\n\\t\\tif (t.length>18) html+=''+t.truncate(18,\\\"right\\\",\\\"\\\")+'...';\\n\\t\\telse if (t.length>16) html+=''+t;\\n\\t\\telse if (t.length>14) html+=''+t;\\n\\t\\telse html=t, tail=\\\"\\\";\\n\\t\\treturn html+''+tail;\\n\\t},\\n\\t\\\"#dbico\\\":function (d){\\n\\t\\treturn d.ico = (this.db.settings().ico || this.db.settings().pic);\\n\\t},\\n\\t\\\"#start\\\": {/* See tab */},\\n\\t\\\"#sort\\\":{\\n\\t\\tbind:\\\"sort\\\",\\n\\t\\tinit: function($o) {\\n\\t\\t\\t$o.tags({\\n\\t\\t\\t\\ttags:[Object.keys(this.Sorters).slice(1)],\\n\\t\\t\\t\\tempty:(function(t){\\n\\t\\t\\t\\t\\tvar r={}, k=Object.keys(t.Sorters)[0];\\n\\t\\t\\t\\t\\tr[k]=k;\\n\\t\\t\\t\\t\\treturn r;\\n\\t\\t\\t\\t})(this)\\n\\t\\t\\t});\\n\\t\\t}\\n\\t},\\n\\t\\\"#mode\\\":{\\n\\t\\tbind:\\\"mode\\\",\\n\\t\\tinit: function ($o) {\\n\\t\\t\\t$o.tags({\\n\\t\\t\\t\\tempty:{'':\\\"columns-brief\\\"},\\n\\t\\t\\t\\ttags:[[{'':\\\"grid-medium\\\"}]],\\n\\t\\t\\t\\tgroupshim:\\\"\\\"\\n\\t\\t\\t});\\n\\t\\t}\\n\\t},\\n\\t\\\"#search\\\":{\\n\\t\\tbind:function (d,v) {\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\td.search=v.to(100);\\n\\t\\t\\t\\tif (v.length>0) d.reg = new RegExp(\\n\\t\\t\\t\\t\\t\\\"(\\\"\\n\\t\\t\\t\\t\\t+d.search.toLowerCase()\\n\\t\\t\\t\\t\\t.compact().split(/[\\\\s,]/)\\n\\t\\t\\t\\t\\t.compact(true)\\n\\t\\t\\t\\t\\t.map(function(e){return RegExp.escape(e)})\\n\\t\\t\\t\\t\\t.join(\\\"|\\\")+\\\")\\\",\\\"i\\\"\\n\\t\\t\\t\\t);\\n\\t\\t\\t\\treturn v;\\n\\t\\t\\t}\\n\\t\\t\\treturn d.search;\\n\\t\\t},\\n\\t\\tcss:{\\\"my-search\\\": /^[^\\\\s][^\\\\s]+/}\\n\\t},\\n\\t\\\"#xproxy\\\":{\\n\\t\\tdelay:100,\\n\\t\\tbind: function(d,v,$o){\\n\\t\\t\\tthis.Filter();\\n\\t\\t},\\n\\t\\twatch:\\\"#filter,#search,#sort,#mode\\\"\\n\\t},\\n\\t\\\"#xstatus\\\":{\\n\\t\\tdelay:100,\\n\\t\\tbind: function(d,v,$o){\\n\\t\\t\\tif (!this.Show.length) return '
List is empty
— ※ —
';\\n\\t\\t\\telse return \\\"\\\";\\n\\t\\t},\\n\\t\\twatch:\\\"#xproxy,#brieflist\\\"\\n\\t},\\n\\t\\\"#brieflist\\\":{/* See tab */},\\n\\t\\\"#btn-sync\\\":{\\n\\t\\tbind: function (d,v){\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\tvar that = this;\\n\\t\\t\\t\\tthat.db.sync(false);\\n\\t\\t\\t\\t(function(){\\n\\t\\t\\t\\t\\tthat.db.sync(true);\\n\\t\\t\\t\\t\\tthat.Syncing = true;\\n\\t\\t\\t\\t\\tcw.note(\\\"Trying to resync...\\\");\\n\\t\\t\\t\\t}).delay(700);\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\",\\n\\t\\tcss:{\\n\\t\\t\\t\\\"self:hide\\\":function(d){\\n\\t\\t\\t\\tvar that = this,\\n\\t\\t\\t\\t\\tsyncs = (that.db.settings().sync||[]).reduce(function(a,b){\\n\\t\\t\\t\\t\\t\\tif (b.dir+\\\"\\\") return a+1;\\n\\t\\t\\t\\t\\t\\treturn a;\\n\\t\\t\\t\\t\\t},0);\\n\\t\\t\\t\\treturn !syncs;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t},\\n\\t\\\"#btn-settings\\\":{\\n\\t\\tbind: function (d,v){\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\tthis.app.run(this.db.name+\\\"/DBSettings\\\");\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1418510856618\",\n\t\t\t\t\"id\": \".ui.#brieflist\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\tbind:\\\"this.Show\\\",\\n\\tid: function(e){\\n\\t\\treturn cw.lib.sdbm([\\n\\t\\t\\te.id,\\n\\t\\t\\te.rev,\\n\\t\\t\\t(new Date()).getDate(),\\n\\t\\t\\te.read\\n\\t\\t]);\\n\\t},\\n\\thash: function(e){\\n\\t\\treturn cw.lib.sdbm([\\n\\t\\t\\te.id,\\n\\t\\t\\te.rev,\\n\\t\\t\\t(new Date()).getDate(),\\n\\t\\t\\te.read\\n\\t\\t]);\\n\\t},\\n\\tinit: function($o, form){\\n\\t\\tvar that =this,\\n\\t\\t\\t\\t_act = that.Cmd.fill(that);\\n\\t\\t\\n\\t\\t// list trackers\\t\\t\\t\\t\\n\\t\\t$o.on(\\\"click.my\\\", \\\"#bimg,#btxt\\\", function (){\\n\\t\\t\\tvar $p=$(this).my().root,\\n\\t\\t\\t\\t\\tdata = $p.my(\\\"data\\\"),\\n\\t\\t\\t\\t\\tid = data.id, \\n\\t\\t\\t\\t\\tdb = that.db.name,\\n\\t\\t\\t\\t\\tact = $(this).data(\\\"action\\\")||\\\"_more\\\",\\n\\t\\t\\t\\t\\turl, \\n\\t\\t\\t\\t\\tapp,\\n\\t\\t\\t\\t\\tappid,\\n\\t\\t\\t\\t\\tacts = form.data.actions,\\n\\t\\t\\t\\t\\tapps = form.data.apps;\\n\\t\\t\\t\\n\\t\\t\\tif (act===\\\"_more\\\") {\\n\\t\\t\\t\\tthat.app.modal({\\n\\t\\t\\t\\t\\tmanifest:\\\"cw.Sys.Db.DocInfo\\\", \\n\\t\\t\\t\\t\\twidth:700,\\n\\t\\t\\t\\t\\tdata:{db:that.db, id:id}, \\n\\t\\t\\t\\t\\tesc:true\\n\\t\\t\\t\\t}).always(function(a) {\\n\\t\\t\\t\\t\\tvar act;\\n\\t\\t\\t\\t\\tif (Object.isObject(a) && a.cmd) {\\n\\t\\t\\t\\t\\t\\tact=a.cmd;\\n\\t\\t\\t\\t\\t\\tapp = $o.my().data.apps[((acts[data.type]||{})[act]||[])[0]];\\n\\t\\t\\t\\t\\t\\t_act( act, db, id, app);\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t\\telse {\\n\\t\\t\\t\\tappid = ((acts[data.type]||{})[act]||[])[0];\\n\\t\\t\\t\\tapp = apps[appid];\\n\\t\\t\\t\\t_act(act, db, id, app);\\t\\n\\t\\t\\t}\\n\\t\\t});\\n\\t\\t\\n\\t},\\n\\tlist:[\\n\\t\\t'
',\\n\\t\\t\\t'',\\n\\t\\t\\t'
',\\n\\t\\t\\t\\t'',\\n\\t\\t\\t\\t'',\\n\\t\\t\\t\\t'
',\\n\\t\\t\\t\\t'
',\\n\\t\\t\\t'
',\\n\\t\\t'
'\\n\\t].join(\\\"\\\"),\\n\\tmanifest: \\\"this.ItemBrief\\\",\\n\\twatch:\\\"#xproxy\\\",\\n\\t//watch:\\\"#filter,#search,#sort,#mode\\\",\\n\\tcss:{\\n\\t\\t//hide:function(d){ return d.mode!=\\\"columns-brief\\\" },\\n\\t\\txcol5: function(d,v,$o){var w = $o.width(); return (w>=1099); },\\n\\t\\txcol4: function(d,v,$o){var w = $o.width(); return (w>900 && w<1110); },\\n\\t\\txcol3: function(d,v,$o){var w = $o.width(); return (w<=900); },\\n\\t\\t\\\"columns-brief\\\": function(d){return d.mode == \\\"columns-brief\\\" },\\n\\t\\t\\\"grid-medium\\\": function(d){return d.mode == \\\"grid-medium\\\" },\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1418480165019\",\n\t\t\t\t\"id\": \".ItemBrief\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\tid:\\\"cw.Sys.Db.List2.ItemBrief\\\",\\n\\tui:{\\n\\t\\t\\\"#bimg\\\": {\\n\\t\\t\\tbind:\\\"pic\\\",\\n\\t\\t\\tcss:{\\n\\t\\t\\t\\tbapp:function(d) {return !!d.app}\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t\\\"#btxt\\\": {\\n\\t\\t\\tbind: function(d, v, $o){\\n\\t\\t\\t\\tvar css = \\\"\\\", cmd=\\\"\\\";\\n\\t\\t\\t\\tif (d.app) {\\n\\t\\t\\t\\t\\tcss+=\\\"fs110 lh115 bold \\\";\\n\\t\\t\\t\\t\\tcmd=\\\"_run\\\";\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\telse if (d.actions && d.actions.edit) {\\n\\t\\t\\t\\t\\tcmd=\\\"edit\\\";\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\n\\t\\t\\t\\tif (!d.app && d.title.length>30 && Object.size(d.actions)) css+=\\\"lh130 fs95 \\\";\\n\\t\\t\\t\\t\\n\\t\\t\\t\\tif (cmd) $o.data(\\\"action\\\", cmd);\\n\\t\\t\\t\\treturn ''+d.title+'';\\n\\t\\t\\t},\\n\\t\\t\\tcss:{\\n\\t\\t\\t\\t\\\"fs90\\\": function(d) {return d.type!=\\\"user\\\" && !Object.size(d.actions)}\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t\\\"#binfo\\\":{\\n\\t\\t\\tcss:{\\n\\t\\t\\t\\tblue:function(d) {return d.read && !d.read.rev.startsWith(d.rev);},\\n\\t\\t\\t\\tskyblue: function(d) {return !d.read && d.type!=\\\"user\\\" && Object.size(d.actions)},\\n\\t\\t\\t\\t\\\"o90 trim lh110\\\": function(d) {return !Object.size(d.actions)}\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t\\\"#bpicto\\\": function(d){\\n\\t\\t\\tvar css=\\\"\\\";\\n\\t\\t\\tif (d.crypto) {\\n\\t\\t\\t\\tcss=\\\"fi-key \\\"+(cw.crypto.keys().findIndex(function(e){return e.id==d.crypto})>-1?\\\"green\\\":\\\"red\\\");\\n\\t\\t\\t}\\n\\t\\t\\t//else if (d.type == \\\"user\\\") css=\\\"fi-torso fs90 o70\\\";\\n\\t\\t\\tif (css) return ' ';\\n\\t\\t},\\n\\t\\t\\\"#btype\\\": {\\n\\t\\t\\tbind: function(d){\\n\\t\\t\\t\\tvar css=\\\"\\\", h=[], \\n\\t\\t\\t\\t\\t\\tt = d.type.capitalize();\\n\\n\\t\\t\\t\\tif (d.app) t = \\\"App\\\";\\n\\t\\t\\t\\tif (t===\\\"Manifest\\\") css=\\\"fi-widget\\\";\\n\\t\\t\\t\\telse if (t===\\\"App\\\") css=\\\"fi-layout\\\";\\n\\t\\t\\t\\telse if (t===\\\"User\\\") css=\\\"fi-torso\\\";\\n\\t\\t\\t\\th.push((css?'':'')\\n\\t\\t\\t\\t\\t\\t\\t +''+t+'');\\n\\n\\t\\t\\t\\tif (d.stamp) h.push(\\n\\t\\t\\t\\t\\t''+cw.lib.date(+d.stamp, \\\"short\\\")\\n\\t\\t\\t\\t\\t+''\\n\\t\\t\\t\\t);\\n\\n\\t\\t\\t\\tif (d.files.length) h.push(' '+d.files.length);\\n\\n\\t\\t\\t\\treturn h.length?h.join(\\\" · \\\"):\\\"\\\";\\n\\t\\t\\t},\\n\\t\\t\\tcss:{\\n\\t\\t\\t\\t\\\"pt2\\\":function(d) {return !d.app}\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t\\\"#btags\\\":{\\n\\t\\t\\tbind: function(d){\\n\\t\\t\\t\\tvar h=\\\"\\\", t = Object.keys(d.tags);\\n\\t\\t\\t\\tif (t.length) {\\n\\t\\t\\t\\t\\th = '#'\\n\\t\\t\\t\\t\\t\\t+t.map(function(e){\\n\\t\\t\\t\\t\\t\\t\\treturn ''+e+'';\\n\\t\\t\\t\\t\\t\\t}).to(6).join(\\\", \\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\treturn h;\\n\\t\\t\\t},\\n\\t\\t\\tcss:{\\n\\t\\t\\t\\thide: function(d){return !Object.size(d.tags)}\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1418512070269\",\n\t\t\t\t\"id\": \".Filter\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"(function(dbres, del){\\n\\tvar i,j,r, a, obj, reg, tmp,\\n\\t\\t\\tthat = this, \\n\\t\\t\\tf=[];\\n\\t\\n\\t// Parse DB response\\n\\tif (dbres && dbres.rows) {\\n\\t\\ttmp = {};\\n\\t\\tfor(i=0;i'\\n\\t\\t\\t\\t+''\\n\\t\\t\\t\\t+'
'\\n\\t\\t\\t\\t+''+doc.title+''\\n\\t\\t\\t\\t+'
'\\n\\t\\t\\t\\t+'';\\n\\t\\t\\t\\treturn html;\\n\\t\\t\\t},\\n\\t\\t\\thash: function (e) {return e.title+e.name+e.pic.length},\\n\\t\\t\\tid: function (e) {return e.id}\\n\\t\\t});\\n\\t\\t$o.on(\\\"click.my\\\", \\\".cw-List-app\\\", function(){\\n\\t\\t\\t$o.my(\\\"find\\\",\\\"#btn-start\\\").click();\\n\\t\\t\\tthat.app.run(that.db.name+\\\"/\\\"+$(this).data(\\\"app\\\"));\\n\\t\\t});\\n\\t\\tcw.event().progress(function(e){\\n\\t\\t\\tif (/^app/.test(e)) $o.trigger(\\\"check\\\");\\n\\t\\t});\\n\\t},\\n\\tbind:function(d,v,$o){\\n\\t\\tvar that=this;\\n\\t\\tif (null!=v) {\\n\\t\\t\\td.start = that.db.app().map(function(e){\\n\\t\\t\\t\\treturn e===\\\"List\\\"?null:that.db.app(e)\\n\\t\\t\\t}).compact().sortBy(\\\"title\\\");\\n\\t\\t\\t$o.list(\\\"data\\\", d.start);\\n\\t\\t}\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1418479571268\",\n\t\t\t\t\"id\": \".SortGroup\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\t\\\"Type\\\": function (e){\\n\\t\\tvar t=\\\"\\\";\\n\\t\\tif (e.type===\\\"manifest\\\" && e.manifest && e.manifest.app) t=\\\"0\\\"+e.name;\\n\\t\\telse if (e.type===\\\"user\\\") t=\\\" ̄0\\\"+e.name;\\n\\t\\telse t=e.type+\\\" \\\"+(1e16-((Object.isArray(e.log) && Object.isArray(e.log[0]))?e.log[0][0]:e.stamp||e.created||0)*1);\\n\\t\\treturn t;\\n\\t},\\n\\t\\\"AZ\\\": function (e){\\n\\t\\treturn e.name;\\n\\t},\\n\\t\\\"Stamp\\\": function(e){\\n\\t\\treturn (1e16-(e.log?e.log[0][0]:e.stamp||e.created||0)*1);\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [\"nocompile\"],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1418479603532\",\n\t\t\t\t\"id\": \".Cmd\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": function (form,act,db,id,app) {\n\n\n\t// executes command over doc\n\tvar url, doc=cw.ram(db,id), dblist;\n\tif (doc && act.to(1)===\"_\") {\n\t\tif (act.startsWith(\"_run\") && doc) {\n\t\t\turl=db+\"/\"+doc.manifest.app.name+\"/\";\n\t\t\turl+=(act===\"_runnew\"?cw.lib.tourl64([\"create\",\"\"]):\"\")\n\t\t} \n\t\telse if (act===\"_delete\" && doc) {\n\t\t\tform.app.modal({\n\t\t\t\tmanifest:\"cw.Sys.Confirm\",\n\t\t\t\tdata:{\n\t\t\t\t\ttext:\" Delete doc?\",\n\t\t\t\t\tcss:\"fi-x red\",\n\t\t\t\t\tok:\"Delete\"\n\t\t\t\t}\n\t\t\t}).always(function(r){\n\t\t\t\tif (Object.isObject(r) && r.cmd===\"commit\") {\n\t\t\t\t\tcw.db(db).del(id).then(\n\t\t\t\t\t\tfunction(){cw.note(\"Doc deleted\",\"ok\")},\n\t\t\t\t\t\tfunction(){cw.note(\"Fail to delete doc\",\"error\")}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t} \n\t\telse if (act===\"_json\" && doc) {\n\t\t\turl=db+\"/Sys.JSON/\"+cw.lib.tourl64([\"edit\",id]);\n\t\t}\n\t\telse if (act===\"_hide\" && doc) {\n\t\t\tform.app.modal({\n\t\t\t\tmanifest:\"cw.Sys.Confirm\",\n\t\t\t\tdata:{\n\t\t\t\t\ttext:' Hide doc?'\n\t\t\t\t\t+'

You’ll never see this doc again, but it is not removed '\n\t\t\t\t\t+'from DB. Useful for shared DBs.

',\n\t\t\t\t\tok:\"Mark as hidden\"\n\t\t\t\t}\n\t\t\t}).always(function(r){\n\t\t\t\tif (Object.isObject(r) && r.cmd===\"commit\") {\n\t\t\t\t\tcw.db(db).hide(id);\n\t\t\t\t\tcw.note(\"Doc hidden\",\"ok\");\n\t\t\t\t}\n\t\t\t});\n\t\t} \n\t\telse if (act===\"_export\" && doc) {\n\t\t\tdblist = cw.dbs(); delete dblist[db];\n\t\t\tform.app.modal({\n\t\t\t\tmanifest:Object.merge(\n\t\t\t\t\tform.db.form(\"cw.Sys.Confirm\"),{\n\t\t\t\t\t\tui:{\n\t\t\t\t\t\t\t\"#dest\":{\n\t\t\t\t\t\t\t\tinit: function ($o) {\n\t\t\t\t\t\t\t\t\tvar html=\"\", list=dblist;\n\t\t\t\t\t\t\t\t\t$o.tags({tags:[\n\t\t\t\t\t\t\t\t\t\tObject.keys(list).map(function(i){\n\t\t\t\t\t\t\t\t\t\t\tvar obj = {};\n\t\t\t\t\t\t\t\t\t\t\tobj[list[i].escapeHTML()] = i;\n\t\t\t\t\t\t\t\t\t\t\treturn obj;\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t]});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tbind:\"dest\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"#options\":{\n\t\t\t\t\t\t\t\tinit: function($o) {\n\t\t\t\t\t\t\t\t\tvar tags = [[{\"Restart revision\":\"newrev\"}]];\n\t\t\t\t\t\t\t\t\tif (doc.type!=\"manifest\") tags.push([{\"New doc ID\":\"newid\"}]);\n\t\t\t\t\t\t\t\t\t$o.tags({tags:tags})\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tbind:\"options\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, true),\n\t\t\t\tdata:{\n\t\t\t\t\ttext:' Select destination DB'\n\t\t\t\t\t+'

'\n\t\t\t\t\t+'

Options:

',\n\t\t\t\t\tok:' Copy',\n\t\t\t\t\tdest:Object.keys(dblist)[0],\n\t\t\t\t\toptions:[\"newrev\"]\n\t\t\t\t},\n\t\t\t\tesc:true\n\t\t\t}).always(function(r){\n\t\t\t\tif (Object.isObject(r) && r.cmd===\"commit\") {\n\t\t\t\t\tcw.db(db)\n\t\t\t\t\t.get(id, {attachments:true})\n\t\t\t\t\t.then(function(doc){\n\t\t\t\t\t\tvar pi=$.Deferred();\n\t\t\t\t\t\t// check if doc exists in dest DB\n\t\t\t\t\t\tcw.db(r.dest+\"\").get(doc._id, function(e, destdoc){\n\t\t\t\t\t\t\tif (!destdoc || r.options.indexOf(\"newid\")>-1) {\n\t\t\t\t\t\t\t\t_save(true, r.options);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// confirm overwrite\n\t\t\t\t\t\t\t\t$.my.modal({\n\t\t\t\t\t\t\t\t\tmanifest:\"cw.Sys.Confirm\",\n\t\t\t\t\t\t\t\t\tdata:{\n\t\t\t\t\t\t\t\t\t\ttext:' Doc exists in destination DB. '\n\t\t\t\t\t\t\t\t\t\t+'Saving will overwrite existing doc.',\n\t\t\t\t\t\t\t\t\t\tok:\"Overwrite\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}).then(function(d){\n\t\t\t\t\t\t\t\t\tif (Object.isObject(d) && d.cmd===\"commit\") {\n\t\t\t\t\t\t\t\t\t\tdoc._rev = destdoc._rev;\n\t\t\t\t\t\t\t\t\t\t_save(false, r.options);\n\t\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t\telse pi.reject(\"Overwite cancelled\");\n\t\t\t\t\t\t\t\t}).fail(function(){\n\t\t\t\t\t\t\t\t\tpi.reject(\"Overwite cancelled\");\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tpi.then(function(doc){\n\t\t\t\t\t\t\tcw.note('Doc '+(doc.title||doc.name||doc._id).stripTags()+' copied to '+dblist[r.dest],\"ok\");\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.fail(function(){\n\t\t\t\t\t\t\tcw.note(\"Copy failed\",\"error\");\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\treturn pi.promise();\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Saver itself\n\t\t\t\t\t\t\n\t\t\t\t\t\tfunction _save(isnew, opts){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar doc0 = Object.reject(doc, \"_db\");\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (opts.indexOf(\"newid\")>-1) doc0._id = cw.lib.uuid(); \n\t\t\t\t\t\t\tif (isnew && opts.indexOf(\"newrev\")>-1) delete doc0._rev;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcw.db(r.dest+\"\").save(doc0, true)\n\t\t\t\t\t\t\t.then(function(a,b){\n\t\t\t\t\t\t\t\tpi.resolve(a,b);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.fail(function(a,b){pi.reject(a,b)});\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}, function(a,b){pi.reject(\"Failed reading file to copy\")});\n\t\t\t\t}\n\t\t\t});\n\t\t} \n\t} else if (app) {\n\t\turl=db+\"/\"+app.app.name+\"/\"+cw.lib.tourl64([act,id]);\n\t}\n\tif (url) _run(url);\n\tfunction _run(url) {form.app.run(url);}\n\n\t\t\t\t\t},\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1418479456618\",\n\t\t\t\t\"id\": \".style\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\t\\\" .columns-brief\\\":{\\n\\t\\t\\\" .bitem\\\":\\\"padding:3px 0 5px 0;\\\",\\n\\t\\t\\\" #bimg\\\": \\\"width:20px;height:20px;border-radius:2px;\\\",\\n\\t\\t\\\" #binfo\\\": \\\"width:215px;font-size:85%;\\\",\\n\\t\\t\\\" .baux\\\":\\\"display:none;opacity:0;\\\"\\n\\t},\\n\\t\\n\\t\\\" .grid-medium\\\":{\\n\\t\\t\\\" .bitem\\\":\\\"padding:7px 0 9px 0;\\\",\\n\\t\\t\\\" #bimg\\\": \\\"width:25px;height:25px;border-radius:3px;margin:2px 18px 0 7px;\\\",\\n\\t\\t\\\" #bimg.bapp\\\": \\\"width:38px;height:38px;border-radius:3px;margin:3px 12px 0 0;\\\",\\n\\t\\t\\\" #binfo\\\": \\\"width:195px;font-size:90%;\\\",\\n\\t\\t\\\" .baux\\\":\\\"display:block;opacity:1;\\\",\\n\\t\\t\\\" #btags\\\":\\\"display:none;\\\"\\n\\t},\\n\\t\\n\\t\\\" .bitem\\\":\\\"transition:width 0.1s, padding:0.1s, margin:0.1s;width:245px;\\\"\\n\\t\\t\\t+\\\"display:inline-block;vertical-align:top;\\\",\\n\\t\\n\\t\\\" #bimg\\\": \\\"transition:width 0.1s, height 0.1s, margin 0.1s;margin-right:10px;\\\"\\n\\t\\t\\t+\\\"display:inline-block;vertical-align:top;border-radius:3px;cursor:help;cursor:context-menu;\\\",\\n\\t\\n\\t\\\" #binfo\\\": \\\"transition:width 0.1s, font-size 0.1s;\\\"\\n\\t\\t\\t+\\\"display:inline-block;vertical-align:top;font-size:90%;line-height:1.2em;\\\",\\n\\t\\n\\t\\\" .baux\\\":\\\"transition:height 0.1s, opacity 0.1s; xoverflow:hidden; font-size:80%; padding-top: 0.1em;\\\",\\n\\t\\n\\t\\\" .pseudolink.btag\\\":\\\"border-bottom-style: dotted!important;\\\",\\n\\t\\n\\t\\\" .trim\\\":\\\"white-space:nowrap;width:100%;xoverflow:hidden;text-overflow:ellipsis\\\",\\n\\t\\n\\t\\\" .cw-List-nav .dbname\\\":\\\"margin:-4px 8px 0 10px;white-space:nowrap;width:220px;overflow:hidden;text-overflow:ellipsis\\\",\\n\\t\\n\\t\\\" .xcol5\\\":\\\"overflow-y: visible!important;clear: both;height: auto!important;-webkit-column-count: 5!important;\\\"\\n\\t\\t\\t+\\\"-webkit-column-gap: 25px; column-count: 5!important; column-gap: 25px;\\\"\\n\\t\\t\\t+\\\"-moz-column-count: 5!important;-moz-column-gap: 25px;\\\",\\n\\t\\n\\t\\\" .xcol4\\\":\\\"overflow-y: visible!important;clear: both;height: auto!important;-webkit-column-count: 4!important;\\\"\\n\\t\\t\\t+\\\"-webkit-column-gap: 25px; column-count: 4!important; column-gap: 25px;\\\"\\n\\t\\t\\t+\\\"-moz-column-count: 4!important;-moz-column-gap: 25px;\\\",\\n\\t\\n\\t\\\" .xcol3\\\":\\\"overflow-y: visible!important;clear: both;height: auto!important;-webkit-column-count: 3!important;\\\"\\n\\t\\t\\t+\\\"-webkit-column-gap: 25px; column-count: 3!important; column-gap: 25px;\\\"\\n\\t\\t\\t+\\\"-moz-column-count: 3!important;-moz-column-gap: 25px;\\\"\\n})\",\n\t\t\t\t\"active\": true,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1418479927337\",\n\t\t\t\t\"id\": \".HTML\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"([\\n\\t'
',\\n\\t'
',\\n\\t\\t'
',\\n\\t\\t'',\\n\\t\\t'',\\n\\t'
',\\n\\t'',\\n\\t{\\\"label\\\":\\\"65px\\\",row:\\\"265px\\\", labelCss:\\\"fs90 lh110 gray\\\", rowCss:\\\"my-row dib vat mt2\\\"},\\n\\t['' , 'spn#mode.fs100.mr15', '  ', 'spn#sort.fs95'],\\n\\t'
',\\n\\t\\t'',\\n\\t'
',\\n\\t' Settings',\\n\\t'
',\\n\\t'
',\\n\\t'
',\\n\\t'
',\\n\\t'
'\\n])\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1418653253590\",\n\t\t\t\t\"id\": \".views\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"// Views for _design/cloudwal ddoc\\n({\\n\\t\\\"info\\\":{\\n\\t\\tmap: function(doc){\\n\\t\\t\\tvar i, stamp=0,\\n\\t\\t\\t\\t\\ttype = doc.type,\\n\\t\\t\\t\\t\\ttags = {}, mantype = \\\"\\\", \\n\\t\\t\\t\\t\\tobj, att, atts=[];\\n\\t\\t\\tif (typeof type === \\\"string\\\" && type) {\\n\\t\\t\\t\\tstamp = doc.stamp || doc.created || stamp;\\n\\t\\t\\t\\tif (typeof doc.tags === \\\"object\\\") {\\n\\t\\t\\t\\t\\tif (typeof doc.tags.slice === \\\"function\\\") {\\n\\t\\t\\t\\t\\t\\tfor (i=0;i '\n\t\t\t\t+cw.lib.date(sync[i],\"short\")\n\t\t\t\t+'';\n\t\t}\n\t\tcw.lib.note(t);\n\t});\n\t\n\n\t$o.on(\"update.cw\", function(){\n\t\tvar a=[], slot, st=cw.crypto.dblist(), dbc, n, nurl,\n\t\t\t\tstate = cw.state.get()||{},\n\t\t\t\turl=state.initurl||\"\",\n\t\t\t\tsurl=state.url||\"\",\n\t\t\t\tsdbm, ico, sync;\n\n\t\tfor (var j=0; j0) {\n\t\t\t\t\tsyncstate = 1;\n\t\t\t\t\tif (Object.size(sync)!=vals.compact(true).length) syncstate = 2;\n\t\t\t\t\tif (times.length) syncstate = times.min();\n\t\t\t\t}\n\n\n\t\t\t\ta.push({\n\t\t\t\t\turl:nurl,\n\t\t\t\t\tactive:!!(nurl===url || nurl===surl),\n\t\t\t\t\tico:dbc.ico,\n\t\t\t\t\ttitle:dbc.title,\n\t\t\t\t\tname:dbc.name,\n\t\t\t\t\tbubble:\"\",\n\t\t\t\t\tbubbleCss:\"\",\n\t\t\t\t\tshift:false,\n\t\t\t\t\tsync:syncstate\n\t\t\t\t});\n\n\t\t\t\tfor (var i in dbc.apps) {\n\t\t\t\t\tslot=dbc.apps[i];\n\t\t\t\t\tnurl = n+\"/\"+slot.url;\n\t\t\t\t\tif (cw.form(nurl,n)) a.push({\n\t\t\t\t\t\turl:nurl,\n\t\t\t\t\t\tactive:!!(nurl===url || nurl===surl),\n\t\t\t\t\t\tico:cw.form(nurl,n).app.ico||\"\",\n\t\t\t\t\t\ttitle:slot.title,\n\t\t\t\t\t\tbubble:\"\",\n\t\t\t\t\t\tbubbleCss:\"\",\n\t\t\t\t\t\tshift:true\n\t\t\t\t\t});\n\t\t\t\t\t//a=a.sortBy(function(e){return e.born*1}, true);\n\t\t\t\t}\n\t\t\t}\n\t\t} // -- end for\n\n\t\td.list.length=0;\n\t\td.list.add(a);\n\t\t$o.find(\"#list\").trigger(\"recalc\");\n\t}.debounce(105));\n\t\n\t\t\n\t\t},\n\t\"params\": {\n\t\t\"delay\": 50\n\t},\n\t\"data\": {\n\t\t\"title\": \"\",\n\t\t\"list\": [],\n\t\t\"collapsed\": {\n\t\t}\n\t},\n\t\"ui\": {\n\t\t\"#list\": {\n\t\t\t\"bind\": \"list\",\n\t\t\t\"check\": true,\n\t\t\t\"list\": \"\",\n\t\t\t\"manifest\": \"List\"\n\t\t},\n\t\t\"#sidelogo\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\tcw.lib.note(\"Here must be introducing app, not yet implemented.\")\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\"\n\t\t},\n\t\t\"#btn-update\": {\n\t\t\t\"bind\": function (d,v) {\n\n\t\tif (null!=v) {\n\t\t\tvar pi=$.Deferred(), \n\t\t\t\t\turl = (cw.CW.updateURL||\"/x/\")+\"snapshot\";\n\t\t\t$.my.modal(\n\t\t\t\t'
'\n\t\t\t\t+'Loading updates...'\n\t\t\t\t+'
'\n\t\t\t\t+'
'\n\t\t\t\t,function(){},300);\n\n\n\t\t\tvar db = cw.db(\"cw\");\n\n\t\t\t// Read app list\t\n\t\t\t$.ajax({ url:\"sys/apps.json\", type:\"GET\", dataType:\"json\", cache:false })\n\t\t\t.then(function(a){\n\t\t\t\tvar b, i, j, o, news = {}, olds, del={};\n\t\t\t\tif (!Object.isArray(a) || !a.length) {\n\t\t\t\t\t$.my.modal();\n\t\t\t\t\tcw.lib.note(\"Oops, server responded with error. Please retry in 5-10 minutes.\", \"error\", 5000);\n\t\t\t\t\tconsole.log(a);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tb = Object.clone(a, !0)\n\t\t\t\t\tfor (var i=0;iSelect apps and docs to update

'\n\t\t\t\t\t\t\t\t\t\t+b.map(function(e){\n\t\t\t\t\t\t\t\t\t\t\treturn '
';\t\n\t\t\t\t\t\t\t\t\t\t}).join(\"\"),\n\t\t\t\t\t\t\t\t\t\tapps:b.map(function(e){return e._id}),\n\t\t\t\t\t\t\t\t\t\tok:\"Update\"\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tesc:true\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.always(function(res){\n\t\t\t\t\t\t\t\t\tif (Object.isObject(res) && res.apps.length) {\n\t\t\t\t\t\t\t\t\t\tvar list = cw.lib.a2o(res.apps),\n\t\t\t\t\t\t\t\t\t\t\t\tfin = [];\n\t\t\t\t\t\t\t\t\t\tfor(var i=0; i1?\"s\":\"\")+\".\");\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tconsole.log(res);\n\t\t\t\t\t\t\t\t\t\tpi.reject(\"Update cancelled.\")\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t},\n\t\t\t\t\t\t//err\n\t\t\t\t\t\tfunction(err) {\n\t\t\t\t\t\t\tpi.reject(\"Error fetching new docs. Retry later.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.fail(function(a,b){\n\t\t\t\t$.my.modal();\n\t\t\t\tcw.lib.note(\"Failed reading system apps set. Please, try again in several seconds.\", \"error\", 5000)\n\t\t\t\tconsole.log(a,b);\n\t\t\t});\n\n\t\t\tpi.then(function(a){\n\t\t\t\t$.my.modal();\n\t\t\t\tcw.lib.note(a,\"ok\",5000);\n\t\t\t}).fail(function(a){\n\t\t\t\t$.my.modal();\n\t\t\t\tcw.lib.note(a,\"error\", 3000);\n\t\t\t});\n\n\n\t\t}\n\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\"\n\t\t},\n\t\t\"#btn-newdb\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\tvar that=this;\n\t\tif (v!=null) $.my.modal({\n\t\t\tmanifest:Object.merge(\n\t\t\t\tcw.form(\"cw.Sys.Confirm\"),{\n\t\t\t\t\tui:{\n\t\t\t\t\t\t\"#name\":{\n\t\t\t\t\t\t\tbind:function (d,v) {\n\t\t\t\t\t\t\t\tif (v!=null) {\n\t\t\t\t\t\t\t\t\td.name=v.compact();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn d.name;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcheck:function (d,v){\n\t\t\t\t\t\t\t\tif (v.length<2) return \"2+ latins and nums\";\n\t\t\t\t\t\t\t\tif (/^http[s]?:\\/\\//.test(v)) {\n\t\t\t\t\t\t\t\t\t//check url\n\t\t\t\t\t\t\t\t\tif (v.has(\"•\")) return \"Impossible password in URL\";\n\t\t\t\t\t\t\t\t\tif (!/^http[s]?:\\/\\/([^\\/]{2,100}\\/){1,5}[a-z0-9_$\\(\\)+\\-]{1,200}[\\/]?$/.test(v))\n\t\t\t\t\t\t\t\t\t\treturn \"Invalid CouchDB URL\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (!/^[a-z0-9\\s\\-]{2,30}$/i.test(v)) return \"2-30 latins and nums\";\n\t\t\t\t\t\t\t\t\telse if (d.dbs.indexOf(v.replace(/\\s/g,'-').toLowerCase())!==-1) return \"This name already exist\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn \"\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"#btn-ok\":{\n\t\t\t\t\t\t\tbind: function(d,v,$o){\n\t\t\t\t\t\t\t\tif (v!=null) {\n\t\t\t\t\t\t\t\t\tif ($o.my().root.my(\"valid\")) $o.trigger(\"commit\");\n\t\t\t\t\t\t\t\t\telse cw.note(\"Correct name fist!\",\"error\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'#syncdir':{\n\t\t\t\t\t\t\tbind:\"dir\",\n\t\t\t\t\t\t\tinit: function($o){\n\t\t\t\t\t\t\t\t$o.tags({tags:[{\"From\":\"from\"},{\"To\":\"to\"}]});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'#interval':\"interval\",\n\t\t\t\t\t\t'#sync':{\n\t\t\t\t\t\t\twatch:'#name',\n\t\t\t\t\t\t\tcss:{\n\t\t\t\t\t\t\t\thide: function(d,v,$o){ return !/^http[s]?:\\/\\/.+/.test(d.name) || $o.my(\"errors\")['#name'] }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}, true),\n\t\t\tdata:{\n\t\t\t\ttext:([\n\t\t\t\t\t' New DB title or URL ',\n\t\t\t\t\t'
',\n\t\t\t\t\t'',\n\t\t\t\t\t\t'
',\n\t\t\t\t\t'
',\n\t\t\t\t\t'
',\n\t\t\t\t\t\t$.my.formgen([['','spn#syncdir.dib.mt1.vat.fs80',\n\t\t\t\t\t\t'
',\n\t\t\t\t\t\t' in ',\n\t\t\t\t\t\t'num#interval.fs80.w70.pt2.pb2',{min:0, max:7220},\n\t\t\t\t\t\t' minute intervals']]),\n\t\t\t\t\t'
'\n\t\t\t\t]).join(\"\"),\n\t\t\t\tok:\"Create DB\",\n\t\t\t\tname:\"\",\n\t\t\t\tdir:[\"from\"],\n\t\t\t\tinterval:\"5\",\n\t\t\t\tdbs:Object.keys(cw.dbs()).map(function(e){return e.toLowerCase()})\n\t\t\t}\n\t\t}).then(function(res){\n\t\t\tvar s, name;\n\t\t\tif (Object.isObject(res)) {\n\n\t\t\t\tif (/^http[s]?:\\/\\//.test(res.name)){\n\t\t\t\t\t//url\n\t\t\t\t\tname = res.name.split(\"/\").compact(true).last();\n\t\t\t\t\ts = cw.lib.fuse({}, that.DB, {\n\t\t\t\t\t\ttitle:name.to(50).capitalize(), \n\t\t\t\t\t\tname:rename(name), \n\t\t\t\t\t\tstamp:Date.now(), \n\t\t\t\t\t\tcreator:cw.me(),\n\t\t\t\t\t\tsync:[{\n\t\t\t\t\t\t\turl:res.name,\n\t\t\t\t\t\t\tdir:res.dir.slice(0),\n\t\t\t\t\t\t\tinterval:res.interval\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse if (false) {\n\t\t\t\t\t//share code\n\n\t\t\t\t} \n\t\t\t\telse {\n\n\t\t\t\t\ts = cw.lib.fuse({}, that.DB, {\n\t\t\t\t\t\ttitle:res.name.to(50), \n\t\t\t\t\t\tname:rename(res.name), \n\t\t\t\t\t\tstamp:Date.now(), \n\t\t\t\t\t\tcreator:cw.me(),\n\t\t\t\t\t\tsync:[]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (s.sync && s.sync.length) {\n\t\t\t\t\tlocalStorage.removeItem(_key (s.sync[0].url, \"to\"));\n\t\t\t\t\tlocalStorage.removeItem(_key (s.sync[0].url, \"from\"));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconsole.log(s);\n\t\t\t\t\n\t\t\t\tif (s) cw.db(\"cw\").settings(s)\n\t\t\t\t.then(function(){\n\t\t\t\t\tcw.note(\"DB created\",\"ok\");\n\t\t\t\t})\n\t\t\t\t.fail(function(msg){\n\t\t\t\t\tcw.note(\"DB creation failed during settings update. \"+msg,\"error\");\n\t\t\t\t})\n\t\t\t}\n\t\t\t\n\t\t\t//- - - - -\n\t\t\t\n\t\t\tfunction _key (url, dir){\n\t\t\t\t// masks pwd in url\n\t\t\t\treturn \"_repl_\"+dir+\"_\"+url.replace(/^(http[s]?\\:\\/\\/[^\\:@\\/]+:)[^@]+(@.+)$/,\"$1•••••$2\");\n\t\t\t}\n\t\t\t\n\t\t\t//- - - - -\n\n\t\t\tfunction rename(newname) {\n\t\t\t\tvar name = newname;\n\t\t\t\tif ( name.replace(/[^a-z0-9\\-]/ig,\"\").to(30) !== name ) {\n\t\t\t\t\tname = name.replace(/[^a-z0-9]/ig,\"-\").to(30);\n\t\t\t\t\tif (name.length<2 || cw.dbs()[name]) name = cw.lib.hash8(name+Number.random(1e12));\n\t\t\t\t}\n\t\t\t\treturn name;\n\t\t\t}\n\t\t});\n\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\"\n\t\t},\n\t\t\"#btn-sysdb\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\tif(v!=null) {\n\t\t\t$(\"#cw-header\").slideDown(200);\n\t\t\tcw.state.set(\"cw/List\");\n\t\t}\n\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\"\n\t\t}\n\t},\n\t\"List\": {\n\t\t\"init\": function ($o,form) {\n\n\t\t\t$o.html('
'\n\t\t\t\t+'
'\n\t\t\t\t\t+(form.data.sync>0?'':'')\n\t\t\t\t\t\t+(form.data.sync===2?'':\"\")\n\t\t\t\t\t\t+(form.data.sync===1?'':\"\")\n\t\t\t\t\t\t+(form.data.sync>3?'':\"\"\n\t\t\t\t\t\t)\n\t\t\t\t\t+(form.data.sync>0?'':'')\n\t\t\t\t\t+''\n\t\t\t\t+'
'\n\t\t\t\t+''\n\t\t\t\t+'
'\n\t\t\t);\n\t\t\n\t\t\t},\n\t\t\"data\": {\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#appname\": \"title\",\n\t\t\t\"#ico\": \"ico\",\n\t\t\t\"#cont\": {\n\t\t\t\t\"bind\": function () {\n\n\t\t\t\t\t},\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"blue\": function (d) {\n\t\t\t\t\t\treturn d.active\n\t\t\t\t\t\t},\n\t\t\t\t\t\"xgray o50\": function (d) {\n\t\t\t\t\t\treturn !d.active\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"#bubble\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": {\n\t\t\" .green\": \"color:#BEEA00!important\",\n\t\t\" #sidelogo\": \"cursor:pointer;\",\n\t\t\" #sidelogo img\": \"width:180px; opacity:0.8; transition:opacity 0.3s; display:block;\",\n\t\t\" #sidelogo:hover img\": \"opacity:1;\"\n\t},\n\t\"DB\": {\n\t\t\"ico\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABMpJREFUeNrsWU1oG1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Vz+ovizHRKoq7AIKflLReXXbQGKuHVrSZI64NsiJnxD/HyK5OvYUh9F1z0zOT6PhV59Rs8C1ESAIm7evOmRugYuMMYmxM0+K4LEJ0notiocW2z/I/SwzTm/89Lk+LrelYYIQGgdUGcQEYBABCAQAQhEAAIRgEAEIBABCEQAAhGAQAQgEAEIRAACEYBABCA0Jf4vwADTIj96RMYWrAAAAABJRU5ErkJggg==\",\n\t\t\"title\": \"\",\n\t\t\"desc\": \"\",\n\t\t\"stamp\": \"\",\n\t\t\"start\": \"List/!eyJtb2RlIjogWyJjb2x1bW5zLWJyaWVmIl0sInNlYXJjaCI6ICIiLCJzb3J0IjogWyJUeXBlIl19\",\n\t\t\"creator\": \"\",\n\t\t\"apps\": [],\n\t\t\"sync\": []\n\t},\n\t\"Sync\": {\n\t\t\"init\": [\"

Sync state of

\"],\n\t\t\"ui\": {\n\t\t\t\"#dbtitle\": \"title\"\n\t\t}\n\t},\n\t\"HTML\": [\"
\",\n\t\t\"\",\n\t\t\"
\",\n\t\t\"
\",\n\t\t\"
\",\n\t\t\"
\",\n\t\t\"System DB\",\n\t\t\"
\",\n\t\t\"
\",\n\t\t\"Add new DB...\",\n\t\t\"
\",\n\t\t\"
\",\n\t\t\"Check updates...\",\n\t\t\"
\",\n\t\t\"
\",\n\t\t\"Profile...\",\n\t\t\"
\",\n\t\t\"
\"]\n}", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "Uglify": false, "noIncludes": true, "external": "pouch://cw-Sys-Side-4vx1 manifest", "state": { "savedSdbm": "-1p3e51oj", "sdbm": "-1p3e51oj", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "1bx35dh2", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Sys.Dock", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"id\": \"cw.Sys.Dock\",\n\t\"init\": function ($o,form) {\n\n\t\tvar that = this, d = form.data;\n\t\t$o.parent().parent().css({top:\"25px\"}); \n\t\t$o.html('
');\n\t\t$o.on(\"update.cw\", function(){\n\t\t\tvar a=[], slot, slots = cw.state.slots(), active, atitle=\"\";\n\t\t\tfor (var i in slots) {\n\t\t\t\tslot=slots[i];\n\t\t\t\tactive=slot.app.isActive();\n\t\t\t\t//if we have editor\n\t\t\t\t//if (slot.app.nodedoc && slot.app.nodecmd) \n\t\t\t\tif (!slot.closing) a.push({\n\t\t\t\t\turl:slot.app.url,\n\t\t\t\t\tiniturl:i,\n\t\t\t\t\tactive:active,\n\t\t\t\t\tico:slot.app.ico,\n\t\t\t\t\ttitle:slot.title||slot.app.title,\n\t\t\t\t\tborn:slot.app.born\n\t\t\t\t});\n\t\t\t\tif (active) atitle = slot.title;\n\t\t\t}\n\t\t\ta=a.sortBy(function(e){return e.born*1}, true);\n\t\t\t//$o.my(\"data\",{list:a})\n\t\t\t$('img#ico').each(function(){\n\t\t\t\tif ($(this).data(\"modal\")) $(this).modal();\n\t\t\t});\n\t\t\t(function(){\n\t\t\t\td.list=a; $o.find(\"#list\").trigger(\"redraw\");\n\t\t\t\t\n\t\t\t}).fill(a).delay(40);\n\t\t\tdocument.title = atitle;\n\t\t}.debounce(105));\n\t\t$o.on(\"click\",\"span#appname\", function(){\n\t\t\tvar url=$(this).data(\"url\");\n\t\t\tcw.state.set(url);\n\t\t});\n\t\t$o.on(\"click\", 'img#ico', function(){\n\t\t\t\n\t\t\tvar $i = $(this), \n\t\t\t\t\t$f = $i.my().root,\n\t\t\t\t\tslot = $i.my(\"data\");\n\t\t\t//var $i=$($0);\n\t\t\t$i.modal({\n\t\t\t\troot:$i.parents(\".my-form-list\").eq(0),\n\t\t\t\tscreen:'rgba(255,255,255,0.2)',\n\t\t\t\tclose:'
×
',\n\t\t\t\tesc:true,\n\t\t\t\twidth:136,\n\t\t\t\talign:'left:66%; top:-5px;',\n\t\t\t\tnose:\"left\",\n\t\t\t\tcss:\"fs80 lh140 pl6 pt5 pr5 pb4 blue\",\n\t\t\t\tdata:$i.my(\"data\"),\n\t\t\t\tbound:1,\n\t\t\t\tmanifest:that.MAppinfo\n\t\t\t});\n\t\t\t\n\t\t});\n\t\n\t\t},\n\t\"params\": {\n\t\t\"delay\": 50\n\t},\n\t\"data\": {\n\t\t\"list\": []\n\t},\n\t\"ui\": {\n\t\t\"#list\": {\n\t\t\t\"manifest\": \"AppList\",\n\t\t\t\"bind\": \"list\",\n\t\t\t\"check\": true,\n\t\t\t\"list\": \"\",\n\t\t\t\"id\": [\"url\",\n\t\t\t\t\"active\",\n\t\t\t\t\"title\"],\n\t\t\t\"hash\": [\"url\",\n\t\t\t\t\"active\",\n\t\t\t\t\"title\"]\n\t\t}\n\t},\n\t\"style\": {\n\t\t\" div.my-modal.my-modal-overlay\": \"box-shadow:0 0 0px 1px rgba(0, 20, 47, 0.2)!important;background-color:rgb(245,250,255);word-wrap: break-word;\",\n\t\t\" div.my-modal.nose-left:before\": \"background-color:rgb(245,250,255);\",\n\t\t\" #list\": \"min-height:200px\",\n\t\t\" #ico\": \"cursor: help;cursor:context-menu;width:25px; height:16px;padding-right:9px;margin:2px 1px -2px 0;\"\n\t},\n\t\"AppList\": {\n\t\t\"init\": function ($o,form) {\n\n\t\t$o.html(\n\t\t\t'
'\n\t\t\t+'
'\n\t\t\t+''\n\t\t\t+'
'\n\t\t\t+'×'\n\t\t\t+'
'\n\t\t);\n\t\n\t\t\t},\n\t\t\"data\": {\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#appname\": function (d,v) {\n\n\t\t\treturn d.title;//.escapeHTML();\n\t\t\n\t\t\t\t},\n\t\t\t\"#ico\": \"ico\",\n\t\t\t\"#cont\": {\n\t\t\t\t\"bind\": function () {\n\n\t\t\t\t\t},\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"blue\": function (d) {\n\t\t\t\t\t\treturn d.active\n\t\t\t\t\t\t},\n\t\t\t\t\t\"xgray o50\": function (d) {\n\t\t\t\t\t\treturn !d.active\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"#btn-closeapp\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif(v!=null) {\n\t\t\t\t\tcw.state.slots(d.initurl).app.close().then(function(){\n\t\t\t\t\t\tif ($o.my()) $o.my().root.slideUp(150);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t}\n\t\t}\n\t},\n\t\"MAppinfo\": {\n\t\t\"init\": [\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t\"
\"],\n\t\t\"data\": {\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#db\": function (d) {\n\t\t\t\t \n\t\t\treturn d.url.split(\"/\")[0];\n\t\t\n\t\t\t\t},\n\t\t\t\"#appname\": function (d) {\n\n\t\t\treturn d.url.split(\"/\")[1];\n\t\t\n\t\t\t\t},\n\t\t\t\"#docname\": function (d) {\n\n\t\t\treturn d.title.truncate(200,\"middle\",\" … \");\n\t\t\n\t\t\t\t},\n\t\t\t\"#started\": function (d) {\n\n\t\t\treturn cw.lib.date(d.born);\n\t\t\n\t\t\t\t}\n\t\t}\n\t}\n}", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "Uglify": false, "noIncludes": true, "external": "pouch://cw-Sys-Dock-4vx1 manifest", "state": { "savedSdbm": "-2s0rw83d", "sdbm": "-2s0rw83d", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "1emnhei5", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Manifest", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"name\": \"Manifest\",\n\t\"title\": \"App Editor\",\n\t\"type\": \"manifest\",\n\t\"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nWLqMCTpgrGvIiQ88AknOCzYGPQwABgUUVySlKTuzrjGMY2QUUUUij/2Q==\",\n\t\"stamp\": 1441370289537,\n\t\"creator\": \"ermouth-1ermouth\",\n\t\"manifest\": {\n\t\t\"id\": \"cw.Manifest\",\n\t\t\"build\": 70,\n\t\t\"init\": function ($o,form) {\n\n\t\t\n\tvar pi=$.Deferred(), that=this;\n\t\t\t\t\n\t\t$o.formgen([\n\t\t'
',\n\t\t\t'
',\n\t\t\t\t'',\n\t\t\t'
',\n\t\t\t'
',\n\t\t\t'
',\n\t\t\t\t'
',\n\t\t\t\t'
',\n\t\t\t\t{row:\"200px\", rowCss:\"my-row mt15\"},\n\t\t\t\t['', 'btn#btn-save.fs100.w90.tac.mr5.green',{val:\"Save\",title:\"Saves manifest\"},\n\t\t\t\t \t'btn#btn-close.fs100.w90.tac',{val:\"Close\",title:\"Close and discards changes\"}],\n\t\t\t\t'
',\n\t\t\t'
',\n\t\t'
'\n\t\t]);\n\t\t\n\t$o.find(\"#pane\").on(\"keyup\",\"textarea\", function (){\n\t\tvar $t=$(this);\n\t\t$t.height(0).height($t[0].scrollHeight-6);\n\t});\n\t\n\t//try {\n\t\n\tvar ed = form.data.editor;\n\t\n\tthat.$Ed = $o.find(\"#manifesto\");\n\n\tthat.MakePostfix(ed._id);\n\tthat.MakeSubs(\"cw.\"+ed.raw.name);\n\t\n\tthat.Editor.Prefix = function(){\n\t\treturn {id:form.data.editor.id};\n\t};\n\n\tthat.Editor.Postfix = function(){\n\t\treturn that.Postfix;\n\t};\n\t\t\n\tthat.Editor.Subs = function(){\n\t\treturn that.Subs;\n\t};\n\t\t\n\t//} catch (err) {console.log(err);}\n\t\n\t(function(){pi.resolve();}).delay(1);\n\t\t\n\treturn pi.promise();\n\t\t\n\t\t\t},\n\t\t\"MakePostfix\": function (docid) {\n\n\tvar that = this;\n\tthat.db.load(docid, true)\n\t.then(function(doc){\n\t\tif ( doc && doc._attachments ) that.Postfix.files = doc._attachments;\n\n\t})\n\t\t\n\t\t\t},\n\t\t\"MakeSubs\": function (formid) {\n\n\tvar that = this,\n\t\t\ti, \n\t\t\tchilds = that.db.ram(function(e){\n\t\t\t\treturn (e.type == \"manifest\" && e.manifest && e.manifest.id.startsWith(formid+\".\"))\n\t\t\t});\n\n\tif (childs.length) {\n\t\tchilds = childs.map(function(e){return Object.clone(e,true)});\n\t\tchilds.forEach(function(e){\n\t\t\tvar man = cw.lib.unjson(e.manifest),\n\t\t\t\t\tref = man.id.from(formid.length+1);\n\t\t\t$.extend(!0, that.Subs, cw.lib.unmask(man, ref));\n\t\t\tman = cw.lib.getref(that.Subs, ref);\n\n\t\t\t//has attaches?\n\t\t\tif (Object.size(e._attachments)) {\n\t\t\t\tthat.db.load(e._id, true)\n\t\t\t\t.then(function(man2){\n\t\t\t\t\tman.files = man2._attachments;\n\t\t\t\t});\n\t\t\t}\n\n\t\t});\n\t}\n\t\t\n\t\t\t},\n\t\t\"app\": {\n\t\t\t\"name\": \"Manifest\",\n\t\t\t\"version\": \"2\",\n\t\t\t\"timeout\": \"15000\",\n\t\t\t\"title\": \"App Editor\",\n\t\t\t\"author\": \"ermouth\",\n\t\t\t\"ico\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQECAgMCAgICAgQDAwIDBQQFBQUEBAQFBgcGBQUHBgQEBgkGBwgICAgIBQYJCgkICgcICAj/2wBDAQEBAQICAgQCAgQIBQQFCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAj/wAARCAAyADIDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTl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durFNpHGDuYsc56AcT+zh+yVpPibwp4xuPjP4M8SaLrclwbTT/OlktpLeLy1YzRoDgtuYgFwy/KRg819RaB+178EdYb7Jq2vaj4M1hTtmstYsZYZIGA5V2UMgP1atXWv2rvgDocBnm+IWnX7EErHZQTTs3t8iED/gRFdPt8VZws7v1OP6pheZTVrJbaGr8CfgZoXwM8N6ho2l6pqGuaheXH2m9vJxsExGQipECVQKvHGSxyScYC+O+O75fj98bvDfwx0Nmvfh/4Su11fxNdJhoZ7xCRFa5HBIIZCM/xS8ZjpL74gfGr9oAPoXwr8N6v8Kvh/MRHd+J9XQxXU0J4P2SEHOSM4ZSe3zxmvpP4YfDDwt8JvC1r4W8LWzJAp8y5uZMGa+mIG6WVh1Y4HsAAAABWMpODc5u83+Hm/wDI6IxU4qFNWgv6/wCHZ6JRRRXAegFFFFAHOa74P8JeKPLPibwt4c8RFBhPt1jFcbR6DepxWbpPw2+HWg3cd/ofgHwVo18h3JNaaVBDIp9QyqCKKK9GH8M82p/FO1ooorzj0gooooA//9k=\",\n\t\t\t\"nodetitle\": \"editor.title\",\n\t\t\t\"nodedoc\": \"editor\",\n\t\t\t\"nodecmd\": \"cmd\",\n\t\t\t\"build\": 69,\n\t\t\t\"maskstate\": [\"cmd\",\n\t\t\t\t\"editor._id\"],\n\t\t\t\"width\": [1320,\n\t\t\t\t1170],\n\t\t\t\"collapsed\": [],\n\t\t\t\"types\": {\n\t\t\t\t\"manifest\": [\"edit\",\n\t\t\t\t\t\"create\"]\n\t\t\t}\n\t\t},\n\t\t\"params\": {\n\t\t\t\"delay\": 50,\n\t\t\t\"restyle\": 200\n\t\t},\n\t\t\"data\": {\n\t\t\t\"cmd\": \"\",\n\t\t\t\"editor\": {\n\t\t\t\t\"_id\": \"\",\n\t\t\t\t\"name\": \"\",\n\t\t\t\t\"title\": \"\",\n\t\t\t\t\"type\": \"manifest\",\n\t\t\t\t\"desc\": \"\",\n\t\t\t\t\"beta\": false,\n\t\t\t\t\"manifest\": {\n\t\t\t\t\t\"app\": {\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"raw\": {\n\t\t\t\t\t\"_src\": \"\",\n\t\t\t\t\t\"_new\": false\n\t\t\t\t},\n\t\t\t\t\"log\": []\n\t\t\t},\n\t\t\t\"err\": []\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#pane\": {\n\t\t\t\t\"manifest\": \"Side\",\n\t\t\t\t\"check\": true,\n\t\t\t\t\"bind\": \"editor.raw\"\n\t\t\t},\n\t\t\t\"#manifesto\": {\n\t\t\t\t\"bind\": \"editor.raw\",\n\t\t\t\t\"manifest\": \"Editor\",\n\t\t\t\t\"check\": true,\n\t\t\t\t\"delay\": 20,\n\t\t\t\t\"events\": \"change.my\"\n\t\t\t},\n\t\t\t\"#warn\": {\n\t\t\t\t\"delay\": 250,\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\n\t\tvar i,j,k, \n\t\t\t\tthat = this,\n\t\t\t\tr=d.editor.raw, \n\t\t\t\tm=d.editor.manifest,\n\t\t\t\t$ed = that.$Ed,\n\t\t\t\ted = d.editor, \n\t\t\t\tok=[\"Manifest structure is ok.\"],\n\t\t\t\terr=[], js, app;\n\n\t\t//console.log(\"Root\",v);\n\t\t\n\t\tif (!$o.my(\"find\",\"#pane\").my(\"valid\")) {\n\t\t\terr.push(\"Component description has errors.\");\n\t\t\tdelete d.editor.app;\n\t\t} else {\n\t\t\t//check if unique\n\t\t\tif (!ed._rev) {\n\t\t\t\tif (false) {//(cw.form(r.name) || $.my.forms(\"cw.\"+r.name, \"exist\")) {\n\t\t\t\t\terr.push (\"Component name must be unique – and it’s not.\");\n\t\t\t\t\td.editor.id=\"\";\n\t\t\t\t} else {\n\t\t\t\t\tr.author = cw.me();\n\t\t\t\t\td.editor.id = \"cw.\"+r.name;\n\t\t\t\t\td.editor._id = d.editor.id.replace(/\\./g,\"-\")+\"-\"+cw.lib.hash4(r.author+\"/\"+r.version);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.Side.IsApp(r)) {\n\t\t\t\tvar trim=[/^_/,\"pic\",\"types\",\"com\"];\n\t\t\t\tif (!this.Side.IsEd(r)) trim.push(\"nodecmd\",\"nodedoc\");\n\n\t\t\t\tapp = Object.clone(Object.reject(r,trim),true);\n\n\t\t\t\tif (this.Side.IsEd(r)) {\n\t\t\t\t\t//update maskstate\n\t\t\t\t\tapp.maskstate='[\"'+app.nodecmd+'\",\"'+app.nodedoc+'._id\"]';\n\t\t\t\t}\n\n\t\t\t\tif (/^[\\[\\{]|[\\}\\]]$/.test(app.maskstate)) \n\t\t\t\t\tapp.maskstate = JSON.parse(app.maskstate);\n\n\t\t\t\t// mount editor-specific fields\n\t\t\t\tvar tmp={}, ttype;\n\t\t\t\tif (this.Side.IsEd(r)) {\n\n\t\t\t\t\tif (r._cmd && r._cmd.length) for (i=0;i-1);\n\t\t}\n\t\tif (err.length) d.err=err; else d.err=[];\n\t\treturn err.length?'
'+err.join(\"
\")+'
':'
'+ok.join(\"
\")+'
';\n\t\n\t\t\t\t\t},\n\t\t\t\t\"watch\": \"#pane,#manifesto\"\n\t\t\t},\n\t\t\t\"#btn-save\": {\n\t\t\t\t\"delay\": 350,\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tvar dbid=this.db.name,\n\t\t\t\t\tthat=this; \n\t\t\tif (v!=null) {\n\t\t\t\td.editor.stamp=Date.now();\n\t\t\t\t\n\t\t\t\tif (d.editor.manifest) {\n\t\t\t\t\tvar build = d.editor.raw.build || (d.editor._rev?+d.editor._rev.split(\"-\")[0]:null) || 0;\n\t\t\t\t\tif (!Object.isNumber(build)) build = 0;\n\t\t\t\t\td.editor.manifest.build = build+1;\n\t\t\t\t\td.editor.raw.build = build+1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcw.read[dbid].trust[d.editor._id]=\"*\";\n\t\t\t\tthis.db.save(d.editor)\n\t\t\t\t.then(\n\t\t\t\t\tfunction (res){\n\n\t\t\t\t\t\t// mark manifest as trusted\n\t\t\t\t\t\tcw.read[dbid].trust[res._id]=res._rev;\n\t\t\t\t\t\tcw.read[dbid]._dirty=true;\n\n\t\t\t\t\t\t//push to app\n\t\t\t\t\t\tObject.merge(\n\t\t\t\t\t\t\td.editor,\n\t\t\t\t\t\t\tObject.select(res,[/^_/, \"stamp\", \"log\"])\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t//redraw file list\n\t\t\t\t\t\t$o.my(\"find\",\"#atts\").trigger(\"redraw\");\n\n\t\t\t\t\t\t//rebuild \n\t\t\t\t\t\tthat.MakePostfix(d.editor._id);\n\n\t\t\t\t\t}, function (e,msg) {\n\t\t\t\t\t\tconsole.log(msg, e);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\"#btn-close\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tif (v!=null) $o.trigger(\"cancel\");\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\"#atts\": {\n\t\t\t\t\"init\": function ($o,form) {\n\n\t\t\t$o.my(\"cw.Sys.Attachments\", {\n\t\t\t\tdoc:form.data.editor,\n\t\t\t\ttruncate:18\n\t\t\t});\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"bind\": function () {\n\n\t\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"Postfix\": {\n\t\t},\n\t\t\"Subs\": {\n\t\t},\n\t\t\"Side\": {\n\t\t\t\"IsApp\": function (d) {\n\t\t\t\t return !(d._type.indexOf(\"app\")<0 && d._type.indexOf(\"editor\")<0);\n\t\t\t\t},\n\t\t\t\"IsEd\": function (d) {\n\t\t\t\t return !(d._type.indexOf(\"editor\")<0);\n\t\t\t\t},\n\t\t\t\"init\": function ($o) {\n\n\t\t\n\t\t$o.formgen(this.HTML);\n\t\n\t\t\t\t},\n\t\t\t\"data\": {\n\t\t\t\t\"_src\": \"\",\n\t\t\t\t\"_desc\": \"\",\n\t\t\t\t\"name\": \"\",\n\t\t\t\t\"version\": \"1\",\n\t\t\t\t\"timeout\": \"3000\",\n\t\t\t\t\"title\": \"\",\n\t\t\t\t\"author\": \"\",\n\t\t\t\t\"pic\": \"\",\n\t\t\t\t\"ico\": \"\",\n\t\t\t\t\"maskstate\": \"\",\n\t\t\t\t\"nodetitle\": \"\",\n\t\t\t\t\"nodedoc\": \"\",\n\t\t\t\t\"nodecmd\": \"\",\n\t\t\t\t\"types\": \"\",\n\t\t\t\t\"_type\": [\"manifest\"],\n\t\t\t\t\"_cmd\": [],\n\t\t\t\t\"width\": []\n\t\t\t},\n\t\t\t\"ui\": {\n\t\t\t\t\"#type\": {\n\t\t\t\t\t\"bind\": \"_type\",\n\t\t\t\t\t\"init\": function ($o) {\n\n\t\t\t$o.tags({tags:[[{\"App\":\"app\"},{\"Editor\":\"editor\"}],{\"βeta\":\"beta\"}], empty:{\"Manifest\":\"manifest\"}});\n\t\t\n\t\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#title\": {\n\t\t\t\t\t\"bind\": \"title\",\n\t\t\t\t\t\"check\": function (d,v) {\n\n\t\t\tvar t=v.compact();\n\t\t\tif (t.length<3) return \"Enter title\";\n\t\t\tif (t.length>50) return \"Too long!\";\n\t\t\treturn \"\";\n\t\t\n\t\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#name\": {\n\t\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\tif (v!=null) d.name=v.to(1).toUpperCase()+v.from(1);\n\t\t\treturn d.name;\n\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"check\": function (d,v) {\n\n\t\t\tif (!/^[A-Z][A-Za-z0-9]{2,24}(\\.[A-Za-z0-9]{1,25}){0,4}$/.test(v)) return \"Like App.Some.Ext\";\n\t\t\tif (v.to(1).toUpperCase() !== v.to(1)) return \"First – cap\";\n\t\t\tif (v.length>129) return \"Too long\";\n\t\t\treturn \"\";\n\t\t\n\t\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#ver\": {\n\t\t\t\t\t\"bind\": \"version\",\n\t\t\t\t\t\"check\": /^(|[0-9][a-z0-9\\.]{0,5})$/,\n\t\t\t\t\t\"error\": \"Like 12 or 5.6.8\"\n\t\t\t\t},\n\t\t\t\t\"#desc\": {\n\t\t\t\t\t\"bind\": \"_desc\",\n\t\t\t\t\t\"check\": /^.{0,140}$/,\n\t\t\t\t\t\"error\": \"Short desc, please\"\n\t\t\t\t},\n\t\t\t\t\"#isapp\": {\n\t\t\t\t\t\"bind\": function () {\n\n\t\t\t\t\t\t},\n\t\t\t\t\t\"watch\": \"#type\",\n\t\t\t\t\t\"css\": {\n\t\t\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\t\t\treturn !this.IsApp(d)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#maskstate\": {\n\t\t\t\t\t\"delay\": 50,\n\t\t\t\t\t\"bind\": \"maskstate\",\n\t\t\t\t\t\"check\": function (d,v) {\n\n\t\t\t//v must be ref or json array or obj\n\t\t\tvar t=v.compact(), obj;\n\t\t\tif (!this.IsApp(d) || this.IsEd(d)) return \"\";\n\t\t\tif (t.length>150) return \"Too long\";\n\t\t\tif (/^[\"']|[\"']$/.test(t)) return \"No quots for single string\";\n\t\t\tif (/^[\\[\\{]|[\\}\\]]$/.test(t)){\n\t\t\t\ttry{\n\t\t\t\t\tobj=JSON.parse(t);\n\t\t\t\t} catch(e) {}\n\t\t\t\tif (!obj) return \"Invalid JSON\";\n\t\t\t\tif (Object.isArray(obj)) {\n\t\t\t\t\tif (!obj.length) return \"At least one elt\";\n\t\t\t\t\tfor (var i=0;i150) return \"Too long\";\n\t\t\tif (/^[\"']|[\"']$/.test(t)) return \"No quots for single string\";\n\t\t\treturn \"\";\n\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"watch\": \"#type\"\n\t\t\t\t},\n\t\t\t\t\"#timeout\": {\n\t\t\t\t\t\"bind\": \"timeout\",\n\t\t\t\t\t\"check\": function (d,v) {\n\n\t\t\tif (!this.IsApp(d)) return \"\";\n\t\t\tif (!/^\\d{1,5}$/.test(v)) return \"Num, 0 to 99K\";\n\t\t\treturn \"\";\n\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"watch\": \"#type\"\n\t\t\t\t},\n\t\t\t\t\"#width\": {\n\t\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tif (v!=null) {\n\t\t\t\td.width=v.split(/[\\s,]/).map(function(e){return parseInt(e)}).compact(true);\n\t\t\t\treturn v;\n\t\t\t}\n\t\t\treturn d.width.join(\" \");\n\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"check\": function (d,v) {\n\n\t\t\tif (!this.IsApp(d)) return \"\";\n\t\t\tvar t=v.compact();\n\t\t\tif (!/^(\\d{3,4}([\\s,]\\d{3,4})*[\\s,]?)$/.test(t)) return \"Num list\";\n\t\t\treturn \"\";\n\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"watch\": \"#type\"\n\t\t\t\t},\n\t\t\t\t\"#iseditor\": {\n\t\t\t\t\t\"bind\": function () {\n\n\t\t\t\t\t\t},\n\t\t\t\t\t\"watch\": \"#type\",\n\t\t\t\t\t\"css\": {\n\t\t\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\t\t\treturn !this.IsEd(d);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#nodedoc\": {\n\t\t\t\t\t\"bind\": \"nodedoc\",\n\t\t\t\t\t\"check\": function (d,v) {\n\n\t\t\tif (!this.IsEd(d)) return \"\";\n\t\t\tvar t=v.compact();\n\t\t\tif (!t.length) return \"Field to map doc object to edit\";\n\t\t\tif (t.length>150) return \"Too long\";\n\t\t\tif (/^[\"']|[\"']$/.test(t)) return \"No quots for single string\";\n\t\t\treturn \"\";\n\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"watch\": \"#type\"\n\t\t\t\t},\n\t\t\t\t\"#btn-addpic\": {\n\t\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tif (v!=null) {\n\t\t\t\t//console.log($o, $o.data(), this)\n\t\t\t\t$.my.modal({\n\t\t\t\t\tmanifest:\"cw.Sys.Cropper.Square\",\n\t\t\t\t\tdata:{data:\"\",filename:\"\", size:250}\n\t\t\t\t}).then(function (crop) {\n\t\t\t\t\tif (crop && crop.data) {\t\n\t\t\t\t\t\tvar I=new Image();\n\t\t\t\t\t\tI.src=\"data:image/jpeg;base64,\"+crop.data;\n\t\t\t\t\t\tI.onload=function(){\n\t\t\t\t\t\t\tvar img=cw.lib.image(I);\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\td.pic = img.resample(128).sharpen(0.2).jpeg(0.95, true);\n\t\t\t\t\t\t\t\td.ico = img.resample(50).brightness(1.05).contrast(1.05).sharpen(0.5).jpeg(0.96);\n\t\t\t\t\t\t\t\t$o.my(\"find\",\"#pic,#ico\").trigger(\"recalc\");\n\t\t\t\t\t\t\t}catch(e){\n\t\t\t\t\t\t\t\tconsole.log(e)\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcrop.data=\"\";\n\t\t\t\t\t\t\t$o.html(\"Change image...\").addClass(\"w75\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (d.pic) $o.html(\"Change image...\").addClass(\"w75\");\n\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"events\": \"click.my\"\n\t\t\t\t},\n\t\t\t\t\"#pic\": {\n\t\t\t\t\t\"bind\": \"pic\",\n\t\t\t\t\t\"css\": {\n\t\t\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\t\t\treturn !d.pic.length\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#ico\": {\n\t\t\t\t\t\"bind\": \"ico\",\n\t\t\t\t\t\"css\": {\n\t\t\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\t\t\treturn !d.ico.length\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"#nodecmd\": {\n\t\t\t\t\t\"bind\": \"nodecmd\",\n\t\t\t\t\t\"check\": function (d,v) {\n\n\t\t\tif (!this.IsEd(d)) return \"\";\n\t\t\tvar t=v.compact();\n\t\t\tif (!t.length) return \"Field to map editor command\";\n\t\t\tif (t.length>150) return \"Too long\";\n\t\t\tif (/^[\"']|[\"']$/.test(t)) return \"No quots for single string\";\n\t\t\treturn \"\";\n\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"watch\": \"#type\"\n\t\t\t\t},\n\t\t\t\t\"#cmd\": {\n\t\t\t\t\t\"bind\": \"_cmd\",\n\t\t\t\t\t\"manifest\": \"TypeLine\",\n\t\t\t\t\t\"check\": true,\n\t\t\t\t\t\"watch\": \"#btn-addcmd\"\n\t\t\t\t},\n\t\t\t\t\"#btn-addcmd\": {\n\t\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\tif (v!=null) {\n\t\t\t\td._cmd.push(Object.clone(this.TypeLine.data,true));\n\t\t\t}\n\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\"events\": \"click.my\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"TypeLine\": {\n\t\t\t\t\"data\": {\n\t\t\t\t\t\"type\": \"\",\n\t\t\t\t\t\"actions\": []\n\t\t\t\t},\n\t\t\t\t\"init\": [{\n\t\t\t\t\t\t\"row\": \"200px\",\n\t\t\t\t\t\t\"rowCss\": \"my-row pb7\"\n\t\t\t\t\t},\n\t\t\t\t\t[\"\",\n\t\t\t\t\t\t\"
\",\n\t\t\t\t\t\t\"inp#type.w70.fs90.vat.dib.pt3.pb5\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"plc\": \"Type\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"
\",\n\t\t\t\t\t\t\"inp#actions.w125.fs95\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"plc\": \"Actions\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"
\"]],\n\t\t\t\t\"ui\": {\n\t\t\t\t\t\"#type\": {\n\t\t\t\t\t\t\"bind\": function (d,v) {\n\n\t\t\t\tif (v!=null) d.type=(v+\"\").replace(/[^a-z0-9\\*]/ig,\"\");\n\t\t\t\treturn d.type;\n\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"#actions\": {\n\t\t\t\t\t\t\"bind\": \"actions\",\n\t\t\t\t\t\t\"init\": function ($o) {\n\n\t\t\t\t$o.select2({tags:[\"create\",\"edit\",\"view\",\"comment\",\"hide\",\"copy\",\"move\",\"delete\"]});\n\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"HTML\": [{\n\t\t\t\t\t\"row\": \"200px\",\n\t\t\t\t\t\"label\": \"75px\",\n\t\t\t\t\t\"rowCss\": \"my-row pt0 pb10\",\n\t\t\t\t\t\"labelCss\": \"fs85 gray\"\n\t\t\t\t},\n\t\t\t\t[\"\",\n\t\t\t\t\t\"inp#title.fs120\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"Component title\"\n\t\t\t\t\t},\n\t\t\t\t\t\"msg\"],\n\t\t\t\t[\"\",\n\t\t\t\t\t\"
\",\n\t\t\t\t\t\"inp#name.w150\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"IdName\"\n\t\t\t\t\t},\n\t\t\t\t\t\"msg\",\n\t\t\t\t\t\"
\",\n\t\t\t\t\t\"
\",\n\t\t\t\t\t\"inp#ver.w40\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"Ver\"\n\t\t\t\t\t},\n\t\t\t\t\t\"
\"],\n\t\t\t\t[\"\",\n\t\t\t\t\t\"txt#desc\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"Short description\"\n\t\t\t\t\t},\n\t\t\t\t\t\"msg\"],\n\t\t\t\t[\"\",\n\t\t\t\t\t\"spn#type.fs80\"],\n\t\t\t\t\"
\",\n\t\t\t\t{\n\t\t\t\t\t\"rowCss\": \"my-row mt-2\"\n\t\t\t\t},\n\t\t\t\t[\"\",\n\t\t\t\t\t\"State mask:\",\n\t\t\t\t\t\"txt#maskstate\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"String reference or JSON obj/array mask\"\n\t\t\t\t\t},\n\t\t\t\t\t\"msg\"],\n\t\t\t\t{\n\t\t\t\t\t\"rowCss\": \"my-row pt10\"\n\t\t\t\t},\n\t\t\t\t[\"Title node\",\n\t\t\t\t\t\"inp#nodetitle.fs90\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"Like item.title\"\n\t\t\t\t\t},\n\t\t\t\t\t\"msg\"],\n\t\t\t\t[\"Widths\",\n\t\t\t\t\t\"inp#width.fs90\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"Like 800,1200\"\n\t\t\t\t\t},\n\t\t\t\t\t\"msg\"],\n\t\t\t\t[\"Timeout\",\n\t\t\t\t\t\"inp#timeout.fs90.w70\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"plc\": \"Start in\"\n\t\t\t\t\t},\n\t\t\t\t\t\" ms\"],\n\t\t\t\t\"
\",\n\t\t\t\t[\"Doc node\",\n\t\t\t\t\t\"inp#nodedoc.fs90\",\n\t\t\t\t\t\"msg\"],\n\t\t\t\t[\"Cmd node\",\n\t\t\t\t\t\"inp#nodecmd.fs90\",\n\t\t\t\t\t\"msg\"],\n\t\t\t\t{\n\t\t\t\t\t\"rowCss\": \"my-row pt7\"\n\t\t\t\t},\n\t\t\t\t[\"\",\n\t\t\t\t\t\"spn#btn-addcmd.pseudolink.fs85\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"txt\": \"Add type/command...\"\n\t\t\t\t\t}],\n\t\t\t\t[\"\",\n\t\t\t\t\t\"
\"],\n\t\t\t\t\"
\",\n\t\t\t\t\"
\",\n\t\t\t\t\"
\",\n\t\t\t\t\"\",\n\t\t\t\t\"\",\n\t\t\t\t\"Add component image...\",\n\t\t\t\t\"
\"]\n\t\t},\n\t\t\"style\": {\n\t\t\t\" #cmcont .CodeMirror\": \"height:auto;line-height:1.4em;\",\n\t\t\t\" #xmanifesto .CodeMirror\": \"height:auto;line-height:1.4em;\",\n\t\t\t\" .maned\": function ($o) {\n\n\t\t\treturn \"width:\"+($o.width()<1300?\"950\":\"1100\")+\"px!important;\"\n\t\t\n\t\t\t\t}\n\t\t}\n\t},\n\t\"raw\": {\n\t\t\"_src\": \"\",\n\t\t\"_new\": false,\n\t\t\"_desc\": \"Manifest editor\",\n\t\t\"name\": \"Manifest\",\n\t\t\"version\": \"2\",\n\t\t\"timeout\": \"15000\",\n\t\t\"title\": \"App Editor\",\n\t\t\"author\": \"ermouth\",\n\t\t\"pic\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/wAARCACAAIADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+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gtuYgFwy/KRg819RaB+178EdYb7Jq2vaj4M1hTtmstYsZYZIGA5V2UMgP1atXWv2rvgDocBnm+IWnX7EErHZQTTs3t8iED/gRFdPt8VZws7v1OP6pheZTVrJbaGr8CfgZoXwM8N6ho2l6pqGuaheXH2m9vJxsExGQipECVQKvHGSxyScYC+O+O75fj98bvDfwx0Nmvfh/4Su11fxNdJhoZ7xCRFa5HBIIZCM/xS8ZjpL74gfGr9oAPoXwr8N6v8Kvh/MRHd+J9XQxXU0J4P2SEHOSM4ZSe3zxmvpP4YfDDwt8JvC1r4W8LWzJAp8y5uZMGa+mIG6WVh1Y4HsAAAABWMpODc5u83+Hm/wDI6IxU4qFNWgv6/wCHZ6JRRRXAegFFFFAHOa74P8JeKPLPibwt4c8RFBhPt1jFcbR6DepxWbpPw2+HWg3cd/ofgHwVo18h3JNaaVBDIp9QyqCKKK9GH8M82p/FO1ooorzj0gooooA//9k=\",\n\t\t\"maskstate\": \"\",\n\t\t\"nodetitle\": \"editor.title\",\n\t\t\"nodedoc\": \"editor\",\n\t\t\"nodecmd\": \"cmd\",\n\t\t\"types\": \"\",\n\t\t\"build\": 70,\n\t\t\"_opts\": {\n\t\t\t\"runWidth\": \"800\",\n\t\t\t\"runCss\": \"\",\n\t\t\t\"runId\": \"manifest-preview\",\n\t\t\t\"runMode\": [\"modal\"],\n\t\t\t\"compileTo\": [\"js\"]\n\t\t},\n\t\t\"_err\": [],\n\t\t\"com\": [{\n\t\t\t\t\"stamp\": \"1427389971106\",\n\t\t\t\t\"id\": \"Root\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\tparams:{delay:50, restyle:200},\\n\\tdata:{\\n\\t\\tcmd:\\\"\\\",\\n\\t\\teditor:{\\n\\t\\t\\t_id:\\\"\\\",\\n\\t\\t\\tname:\\\"\\\",\\n\\t\\t\\ttitle:\\\"\\\",\\n\\t\\t\\ttype:\\\"manifest\\\",\\n\\t\\t\\tdesc:\\\"\\\",\\n\\t\\t\\tbeta:false,\\n\\t\\t\\tmanifest:{\\n\\t\\t\\t\\tapp:{}\\n\\t\\t\\t},\\n\\t\\t\\traw:{\\n\\t\\t\\t\\t_src:\\\"\\\",\\n\\t\\t\\t\\t_new:false\\n\\t\\t\\t},\\n\\t\\t\\tlog:[]\\n\\t\\t},\\n\\t\\terr:[]\\n\\t},\\n\\tui:{},\\n\\tPostfix:{},\\n\\tSubs:{},\\n\\t\\\"Side\\\":{/* See tab */},\\n\\tstyle:{\\n\\t\\t' #cmcont .CodeMirror':'height:auto;line-height:1.4em;',\\n\\t\\t' #xmanifesto .CodeMirror':'height:auto;line-height:1.4em;',\\n\\t\\t\\\" .maned\\\":function($o){\\n\\t\\t\\treturn \\\"width:\\\"+($o.width()<1300?\\\"950\\\":\\\"1100\\\")+\\\"px!important;\\\"\\n\\t\\t}\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"err\": [],\n\t\t\t\t\"opts\": []\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1428901922554\",\n\t\t\t\t\"id\": \".init\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"(function ($o, form){\\n\\t\\t\\n\\tvar pi=$.Deferred(), that=this;\\n\\t\\t\\t\\t\\n\\t\\t$o.formgen([\\n\\t\\t'
',\\n\\t\\t\\t'
',\\n\\t\\t\\t\\t'',\\n\\t\\t\\t'
',\\n\\t\\t\\t'
',\\n\\t\\t\\t'
',\\n\\t\\t\\t\\t'
',\\n\\t\\t\\t\\t'
',\\n\\t\\t\\t\\t{row:\\\"200px\\\", rowCss:\\\"my-row mt15\\\"},\\n\\t\\t\\t\\t['', 'btn#btn-save.fs100.w90.tac.mr5.green',{val:\\\"Save\\\",title:\\\"Saves manifest\\\"},\\n\\t\\t\\t\\t \\t'btn#btn-close.fs100.w90.tac',{val:\\\"Close\\\",title:\\\"Close and discards changes\\\"}],\\n\\t\\t\\t\\t'
',\\n\\t\\t\\t'
',\\n\\t\\t'
'\\n\\t\\t]);\\n\\t\\t\\n\\t$o.find(\\\"#pane\\\").on(\\\"keyup\\\",\\\"textarea\\\", function (){\\n\\t\\tvar $t=$(this);\\n\\t\\t$t.height(0).height($t[0].scrollHeight-6);\\n\\t});\\n\\t\\n\\t//try {\\n\\t\\n\\tvar ed = form.data.editor;\\n\\t\\n\\tthat.$Ed = $o.find(\\\"#manifesto\\\");\\n\\n\\tthat.MakePostfix(ed._id);\\n\\tthat.MakeSubs(\\\"cw.\\\"+ed.raw.name);\\n\\t\\n\\tthat.Editor.Prefix = function(){\\n\\t\\treturn {id:form.data.editor.id};\\n\\t};\\n\\n\\tthat.Editor.Postfix = function(){\\n\\t\\treturn that.Postfix;\\n\\t};\\n\\t\\t\\n\\tthat.Editor.Subs = function(){\\n\\t\\treturn that.Subs;\\n\\t};\\n\\t\\t\\n\\t//} catch (err) {console.log(err);}\\n\\t\\n\\t(function(){pi.resolve();}).delay(1);\\n\\t\\t\\n\\treturn pi.promise();\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"green\"]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1428904276922\",\n\t\t\t\t\"id\": \".MakePostfix\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"(function(docid){\\n\\tvar that = this;\\n\\tthat.db.load(docid, true)\\n\\t.then(function(doc){\\n\\t\\tif ( doc && doc._attachments ) that.Postfix.files = doc._attachments;\\n\\n\\t})\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"violet\"]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1428904289854\",\n\t\t\t\t\"id\": \".MakeSubs\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"(function (formid){\\n\\tvar that = this,\\n\\t\\t\\ti, \\n\\t\\t\\tchilds = that.db.ram(function(e){\\n\\t\\t\\t\\treturn (e.type == \\\"manifest\\\" && e.manifest && e.manifest.id.startsWith(formid+\\\".\\\"))\\n\\t\\t\\t});\\n\\n\\tif (childs.length) {\\n\\t\\tchilds = childs.map(function(e){return Object.clone(e,true)});\\n\\t\\tchilds.forEach(function(e){\\n\\t\\t\\tvar man = cw.lib.unjson(e.manifest),\\n\\t\\t\\t\\t\\tref = man.id.from(formid.length+1);\\n\\t\\t\\t$.extend(!0, that.Subs, cw.lib.unmask(man, ref));\\n\\t\\t\\tman = cw.lib.getref(that.Subs, ref);\\n\\n\\t\\t\\t//has attaches?\\n\\t\\t\\tif (Object.size(e._attachments)) {\\n\\t\\t\\t\\tthat.db.load(e._id, true)\\n\\t\\t\\t\\t.then(function(man2){\\n\\t\\t\\t\\t\\tman.files = man2._attachments;\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\n\\t\\t});\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"violet\"]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427392095669\",\n\t\t\t\t\"id\": \".ui\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\n\\t\\\"#pane\\\":{\\n\\t\\tmanifest:\\\"Side\\\",\\n\\t\\tcheck:true,\\n\\t\\tbind:\\\"editor.raw\\\"\\n\\t},\\n\\t\\\"#manifesto\\\":{\\n\\t\\tbind:\\\"editor.raw\\\",\\n\\t\\tmanifest:\\\"Editor\\\",\\n\\t\\tcheck:true,\\n\\t\\tdelay:20,\\n\\t\\tevents:\\\"change.my\\\"\\n\\t},\\n\\t\\\"#warn\\\": { /*See tab*/ },\\n\\t\\\"#btn-save\\\":{\\n\\t\\tdelay:350,\\n\\t\\tbind:function(d,v,$o){\\n\\t\\t\\tvar dbid=this.db.name,\\n\\t\\t\\t\\t\\tthat=this; \\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\td.editor.stamp=Date.now();\\n\\t\\t\\t\\t\\n\\t\\t\\t\\tif (d.editor.manifest) {\\n\\t\\t\\t\\t\\tvar build = d.editor.raw.build || (d.editor._rev?+d.editor._rev.split(\\\"-\\\")[0]:null) || 0;\\n\\t\\t\\t\\t\\tif (!Object.isNumber(build)) build = 0;\\n\\t\\t\\t\\t\\td.editor.manifest.build = build+1;\\n\\t\\t\\t\\t\\td.editor.raw.build = build+1;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\n\\t\\t\\t\\tcw.read[dbid].trust[d.editor._id]=\\\"*\\\";\\n\\t\\t\\t\\tthis.db.save(d.editor)\\n\\t\\t\\t\\t.then(\\n\\t\\t\\t\\t\\tfunction (res){\\n\\n\\t\\t\\t\\t\\t\\t// mark manifest as trusted\\n\\t\\t\\t\\t\\t\\tcw.read[dbid].trust[res._id]=res._rev;\\n\\t\\t\\t\\t\\t\\tcw.read[dbid]._dirty=true;\\n\\n\\t\\t\\t\\t\\t\\t//push to app\\n\\t\\t\\t\\t\\t\\tObject.merge(\\n\\t\\t\\t\\t\\t\\t\\td.editor,\\n\\t\\t\\t\\t\\t\\t\\tObject.select(res,[/^_/, \\\"stamp\\\", \\\"log\\\"])\\n\\t\\t\\t\\t\\t\\t);\\n\\n\\t\\t\\t\\t\\t\\t//redraw file list\\n\\t\\t\\t\\t\\t\\t$o.my(\\\"find\\\",\\\"#atts\\\").trigger(\\\"redraw\\\");\\n\\n\\t\\t\\t\\t\\t\\t//rebuild \\n\\t\\t\\t\\t\\t\\tthat.MakePostfix(d.editor._id);\\n\\n\\t\\t\\t\\t\\t}, function (e,msg) {\\n\\t\\t\\t\\t\\t\\tconsole.log(msg, e);\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t);\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t},\\n\\t\\\"#btn-close\\\":{\\n\\t\\tbind:function(d,v,$o){\\n\\t\\t\\tif (v!=null) $o.trigger(\\\"cancel\\\");\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t},\\n\\t\\\"#atts\\\":{\\n\\t\\tinit: function ($o, form) {\\n\\t\\t\\t$o.my(\\\"cw.Sys.Attachments\\\", {\\n\\t\\t\\t\\tdoc:form.data.editor,\\n\\t\\t\\t\\ttruncate:18\\n\\t\\t\\t});\\n\\t\\t},\\n\\t\\tbind: function (){}\\n\\t}\\n})\",\n\t\t\t\t\"active\": true,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"blue\"]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427603546263\",\n\t\t\t\t\"id\": \".ui.#warn\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\tdelay:250,\\n\\tbind:function (d,v,$o){\\n\\n\\t\\tvar i,j,k, \\n\\t\\t\\t\\tthat = this,\\n\\t\\t\\t\\tr=d.editor.raw, \\n\\t\\t\\t\\tm=d.editor.manifest,\\n\\t\\t\\t\\t$ed = that.$Ed,\\n\\t\\t\\t\\ted = d.editor, \\n\\t\\t\\t\\tok=[\\\"Manifest structure is ok.\\\"],\\n\\t\\t\\t\\terr=[], js, app;\\n\\n\\t\\t//console.log(\\\"Root\\\",v);\\n\\t\\t\\n\\t\\tif (!$o.my(\\\"find\\\",\\\"#pane\\\").my(\\\"valid\\\")) {\\n\\t\\t\\terr.push(\\\"Component description has errors.\\\");\\n\\t\\t\\tdelete d.editor.app;\\n\\t\\t} else {\\n\\t\\t\\t//check if unique\\n\\t\\t\\tif (!ed._rev) {\\n\\t\\t\\t\\tif (false) {//(cw.form(r.name) || $.my.forms(\\\"cw.\\\"+r.name, \\\"exist\\\")) {\\n\\t\\t\\t\\t\\terr.push (\\\"Component name must be unique – and it’s not.\\\");\\n\\t\\t\\t\\t\\td.editor.id=\\\"\\\";\\n\\t\\t\\t\\t} else {\\n\\t\\t\\t\\t\\tr.author = cw.me();\\n\\t\\t\\t\\t\\td.editor.id = \\\"cw.\\\"+r.name;\\n\\t\\t\\t\\t\\td.editor._id = d.editor.id.replace(/\\\\./g,\\\"-\\\")+\\\"-\\\"+cw.lib.hash4(r.author+\\\"/\\\"+r.version);\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\tif (this.Side.IsApp(r)) {\\n\\t\\t\\t\\tvar trim=[/^_/,\\\"pic\\\",\\\"types\\\",\\\"com\\\"];\\n\\t\\t\\t\\tif (!this.Side.IsEd(r)) trim.push(\\\"nodecmd\\\",\\\"nodedoc\\\");\\n\\n\\t\\t\\t\\tapp = Object.clone(Object.reject(r,trim),true);\\n\\n\\t\\t\\t\\tif (this.Side.IsEd(r)) {\\n\\t\\t\\t\\t\\t//update maskstate\\n\\t\\t\\t\\t\\tapp.maskstate='[\\\"'+app.nodecmd+'\\\",\\\"'+app.nodedoc+'._id\\\"]';\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\tif (/^[\\\\[\\\\{]|[\\\\}\\\\]]$/.test(app.maskstate)) \\n\\t\\t\\t\\t\\tapp.maskstate = JSON.parse(app.maskstate);\\n\\n\\t\\t\\t\\t// mount editor-specific fields\\n\\t\\t\\t\\tvar tmp={}, ttype;\\n\\t\\t\\t\\tif (this.Side.IsEd(r)) {\\n\\n\\t\\t\\t\\t\\tif (r._cmd && r._cmd.length) for (i=0;i-1);\\n\\t\\t}\\n\\t\\tif (err.length) d.err=err; else d.err=[];\\n\\t\\treturn err.length?'
'+err.join(\\\"
\\\")+'
':'
'+ok.join(\\\"
\\\")+'
';\\n\\t},\\n\\twatch:\\\"#pane,#manifesto\\\"\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"blue\"]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427390431973\",\n\t\t\t\t\"id\": \".Side\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\t//sidepane component\\n\\tdata:{\\n\\t\\t_type:[\\\"manifest\\\"],\\n\\t\\t_cmd:[],\\n\\t\\t_src:\\\"\\\",\\n\\t\\t_desc:\\\"\\\",\\n\\t\\tname:\\\"\\\",\\n\\t\\tversion:\\\"1\\\",\\n\\t\\ttimeout:\\\"3000\\\",\\n\\t\\ttitle:\\\"\\\",\\n\\t\\tauthor:\\\"\\\",\\n\\t\\tpic:\\\"\\\",\\n\\t\\tico:\\\"\\\",\\n\\t\\tmaskstate:\\\"\\\",\\n\\t\\tnodetitle:\\\"\\\",\\n\\t\\tnodedoc:\\\"\\\",\\n\\t\\tnodecmd:\\\"\\\",\\n\\t\\ttypes:\\\"\\\",\\n\\t\\twidth:[]\\n\\t},\\n\\tIsApp:function (d) { return !(d._type.indexOf(\\\"app\\\")<0 && d._type.indexOf(\\\"editor\\\")<0);},\\n\\tIsEd:function (d) { return !(d._type.indexOf(\\\"editor\\\")<0);},\\n\\tinit:function ($o) {\\n\\t\\t\\n\\t\\t$o.formgen(this.HTML);\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"teal\"]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427391994821\",\n\t\t\t\t\"id\": \".Side.ui\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\t\\\"#type\\\":{\\n\\t\\tbind:\\\"_type\\\",\\n\\t\\tinit: function ($o) {\\n\\t\\t\\t$o.tags({tags:[[{\\\"App\\\":\\\"app\\\"},{\\\"Editor\\\":\\\"editor\\\"}],{\\\"βeta\\\":\\\"beta\\\"}], empty:{\\\"Manifest\\\":\\\"manifest\\\"}});\\n\\t\\t}\\n\\t},\\n\\t\\\"#title\\\":{\\n\\t\\tbind:\\\"title\\\",\\n\\t\\tcheck:function (d,v) {\\n\\t\\t\\tvar t=v.compact();\\n\\t\\t\\tif (t.length<3) return \\\"Enter title\\\";\\n\\t\\t\\tif (t.length>50) return \\\"Too long!\\\";\\n\\t\\t\\treturn \\\"\\\";\\n\\t\\t}\\n\\t},\\n\\t\\\"#name\\\":{\\n\\t\\tbind:function (d,v){\\n\\t\\t\\tif (v!=null) d.name=v.to(1).toUpperCase()+v.from(1);\\n\\t\\t\\treturn d.name;\\n\\t\\t},\\n\\t\\tcheck:function (d,v) {\\n\\t\\t\\tif (!/^[A-Z][A-Za-z0-9]{2,24}(\\\\.[A-Za-z0-9]{1,25}){0,4}$/.test(v)) return \\\"Like App.Some.Ext\\\";\\n\\t\\t\\tif (v.to(1).toUpperCase() !== v.to(1)) return \\\"First – cap\\\";\\n\\t\\t\\tif (v.length>129) return \\\"Too long\\\";\\n\\t\\t\\treturn \\\"\\\";\\n\\t\\t}\\n\\t},\\n\\t\\\"#ver\\\":{\\n\\t\\tbind:\\\"version\\\",\\n\\t\\tcheck:/^(|[0-9][a-z0-9\\\\.]{0,5})$/,\\n\\t\\terror:\\\"Like 12 or 5.6.8\\\"\\n\\t},\\n\\t\\\"#desc\\\":{\\n\\t\\tbind:\\\"_desc\\\",\\n\\t\\tcheck:/^.{0,140}$/,\\n\\t\\terror:'Short desc, please'\\n\\t},\\n\\t\\\"#isapp\\\":{\\n\\t\\tbind:function(){},\\n\\t\\tcss:{\\n\\t\\t\\thide:function(d) {return !this.IsApp(d)}\\n\\t\\t},\\n\\t\\twatch:\\\"#type\\\"\\n\\t},\\n\\t\\\"#maskstate\\\":{\\n\\t\\tdelay:50,\\n\\t\\tbind:\\\"maskstate\\\",\\n\\t\\tcheck:function(d,v){\\n\\t\\t\\t//v must be ref or json array or obj\\n\\t\\t\\tvar t=v.compact(), obj;\\n\\t\\t\\tif (!this.IsApp(d) || this.IsEd(d)) return \\\"\\\";\\n\\t\\t\\tif (t.length>150) return \\\"Too long\\\";\\n\\t\\t\\tif (/^[\\\"']|[\\\"']$/.test(t)) return \\\"No quots for single string\\\";\\n\\t\\t\\tif (/^[\\\\[\\\\{]|[\\\\}\\\\]]$/.test(t)){\\n\\t\\t\\t\\ttry{\\n\\t\\t\\t\\t\\tobj=JSON.parse(t);\\n\\t\\t\\t\\t} catch(e) {}\\n\\t\\t\\t\\tif (!obj) return \\\"Invalid JSON\\\";\\n\\t\\t\\t\\tif (Object.isArray(obj)) {\\n\\t\\t\\t\\t\\tif (!obj.length) return \\\"At least one elt\\\";\\n\\t\\t\\t\\t\\tfor (var i=0;i150) return \\\"Too long\\\";\\n\\t\\t\\tif (/^[\\\"']|[\\\"']$/.test(t)) return \\\"No quots for single string\\\";\\n\\t\\t\\treturn \\\"\\\";\\n\\t\\t},\\n\\t\\twatch:\\\"#type\\\"\\n\\t},\\n\\t\\\"#timeout\\\":{\\n\\t\\tbind:\\\"timeout\\\",\\n\\t\\tcheck:function(d,v){\\n\\t\\t\\tif (!this.IsApp(d)) return \\\"\\\";\\n\\t\\t\\tif (!/^\\\\d{1,5}$/.test(v)) return \\\"Num, 0 to 99K\\\";\\n\\t\\t\\treturn \\\"\\\";\\n\\t\\t},\\n\\t\\twatch:\\\"#type\\\"\\n\\t},\\n\\t\\\"#width\\\":{\\n\\t\\tbind:function (d,v,$o) {\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\td.width=v.split(/[\\\\s,]/).map(function(e){return parseInt(e)}).compact(true);\\n\\t\\t\\t\\treturn v;\\n\\t\\t\\t}\\n\\t\\t\\treturn d.width.join(\\\" \\\");\\n\\t\\t},\\n\\t\\tcheck:function(d,v){\\n\\t\\t\\tif (!this.IsApp(d)) return \\\"\\\";\\n\\t\\t\\tvar t=v.compact();\\n\\t\\t\\tif (!/^(\\\\d{3,4}([\\\\s,]\\\\d{3,4})*[\\\\s,]?)$/.test(t)) return \\\"Num list\\\";\\n\\t\\t\\treturn \\\"\\\";\\n\\t\\t},\\n\\t\\twatch:\\\"#type\\\"\\n\\t},\\n\\t\\\"#iseditor\\\":{\\n\\t\\tbind:function(){},\\n\\t\\tcss:{hide:function(d) {return !this.IsEd(d);}},\\n\\t\\twatch:\\\"#type\\\"\\n\\t},\\n\\t\\\"#nodedoc\\\":{\\n\\t\\tbind:\\\"nodedoc\\\",\\n\\t\\tcheck:function(d,v){\\n\\t\\t\\tif (!this.IsEd(d)) return \\\"\\\";\\n\\t\\t\\tvar t=v.compact();\\n\\t\\t\\tif (!t.length) return \\\"Field to map doc object to edit\\\";\\n\\t\\t\\tif (t.length>150) return \\\"Too long\\\";\\n\\t\\t\\tif (/^[\\\"']|[\\\"']$/.test(t)) return \\\"No quots for single string\\\";\\n\\t\\t\\treturn \\\"\\\";\\n\\t\\t},\\n\\t\\twatch:\\\"#type\\\"\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"blue\"]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427405316839\",\n\t\t\t\t\"id\": \".Side.ui\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\t\\\"#btn-addpic\\\":{\\n\\t\\tbind: function (d,v,$o){\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\t//console.log($o, $o.data(), this)\\n\\t\\t\\t\\t$.my.modal({\\n\\t\\t\\t\\t\\tmanifest:\\\"cw.Sys.Cropper.Square\\\",\\n\\t\\t\\t\\t\\tdata:{data:\\\"\\\",filename:\\\"\\\", size:250}\\n\\t\\t\\t\\t}).then(function (crop) {\\n\\t\\t\\t\\t\\tif (crop && crop.data) {\\t\\n\\t\\t\\t\\t\\t\\tvar I=new Image();\\n\\t\\t\\t\\t\\t\\tI.src=\\\"data:image/jpeg;base64,\\\"+crop.data;\\n\\t\\t\\t\\t\\t\\tI.onload=function(){\\n\\t\\t\\t\\t\\t\\t\\tvar img=cw.lib.image(I);\\n\\t\\t\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\t\\t\\td.pic = img.resample(128).sharpen(0.2).jpeg(0.95, true);\\n\\t\\t\\t\\t\\t\\t\\t\\td.ico = img.resample(50).brightness(1.05).contrast(1.05).sharpen(0.5).jpeg(0.96);\\n\\t\\t\\t\\t\\t\\t\\t\\t$o.my(\\\"find\\\",\\\"#pic,#ico\\\").trigger(\\\"recalc\\\");\\n\\t\\t\\t\\t\\t\\t\\t}catch(e){\\n\\t\\t\\t\\t\\t\\t\\t\\tconsole.log(e)\\n\\t\\t\\t\\t\\t\\t\\t}\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\tcrop.data=\\\"\\\";\\n\\t\\t\\t\\t\\t\\t\\t$o.html(\\\"Change image...\\\").addClass(\\\"w75\\\");\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t\\tif (d.pic) $o.html(\\\"Change image...\\\").addClass(\\\"w75\\\");\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t},\\n\\t\\\"#pic\\\":{\\n\\t\\tbind:\\\"pic\\\",\\n\\t\\tcss:{hide:function (d) {return !d.pic.length}}\\n\\t},\\n\\t\\\"#ico\\\":{\\n\\t\\tbind:\\\"ico\\\",\\n\\t\\tcss:{hide:function (d) {return !d.ico.length}}\\n\\t},\\n\\t\\\"#nodecmd\\\":{\\n\\t\\tbind:\\\"nodecmd\\\",\\n\\t\\tcheck:function(d,v){\\n\\t\\t\\tif (!this.IsEd(d)) return \\\"\\\";\\n\\t\\t\\tvar t=v.compact();\\n\\t\\t\\tif (!t.length) return \\\"Field to map editor command\\\";\\n\\t\\t\\tif (t.length>150) return \\\"Too long\\\";\\n\\t\\t\\tif (/^[\\\"']|[\\\"']$/.test(t)) return \\\"No quots for single string\\\";\\n\\t\\t\\treturn \\\"\\\";\\n\\t\\t},\\n\\t\\twatch:\\\"#type\\\"\\n\\t},\\n\\t\\\"#cmd\\\":{\\n\\t\\tbind:\\\"_cmd\\\",\\n\\t\\tmanifest:\\\"TypeLine\\\",\\n\\t\\tcheck:true,\\n\\t\\twatch:\\\"#btn-addcmd\\\"\\n\\t},\\n\\t\\\"#btn-addcmd\\\":{\\n\\t\\tbind: function (d,v) {\\n\\t\\t\\tif (v!=null) {\\n\\t\\t\\t\\td._cmd.push(Object.clone(this.TypeLine.data,true));\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\tevents:\\\"click.my\\\"\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"blue\"]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427391940215\",\n\t\t\t\t\"id\": \".Side.TypeLine\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"({\\n\\tdata:{\\n\\t\\ttype:\\\"\\\",\\n\\t\\tactions:[]\\n\\t},\\n\\tinit: [\\n\\t\\t{row:\\\"200px\\\",rowCss:\\\"my-row pb7\\\"},\\n\\t\\t[\\\"\\\",'
','inp#type.w70.fs90.vat.dib.pt3.pb5',{plc:\\\"Type\\\"}\\n\\t\\t ,'
','inp#actions.w125.fs95',{plc:\\\"Actions\\\"},'
']\\n\\t],\\n\\tui:{\\n\\t\\t\\\"#type\\\":{\\n\\t\\t\\tbind:function(d,v) {\\n\\t\\t\\t\\tif (v!=null) d.type=(v+\\\"\\\").replace(/[^a-z0-9\\\\*]/ig,\\\"\\\");\\n\\t\\t\\t\\treturn d.type;\\n\\t\\t\\t}\\n\\t\\t},\\n\\t\\t\\\"#actions\\\":{\\n\\t\\t\\tbind:\\\"actions\\\",\\n\\t\\t\\tinit: function($o) {\\n\\t\\t\\t\\t$o.select2({tags:[\\\"create\\\",\\\"edit\\\",\\\"view\\\",\\\"comment\\\",\\\"hide\\\",\\\"copy\\\",\\\"move\\\",\\\"delete\\\"]});\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n})\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"teal\"]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"stamp\": \"1427390537922\",\n\t\t\t\t\"id\": \".Side.HTML\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"([\\n\\t{row:\\\"200px\\\", label:\\\"75px\\\", rowCss:\\\"my-row pt0 pb10\\\", labelCss:\\\"fs85 gray\\\"},\\n\\t[\\\"\\\", \\\"inp#title.fs120\\\", {plc:\\\"Component title\\\"},\\\"msg\\\"],\\n\\t[\\\"\\\", '
', 'inp#name.w150', {plc:\\\"IdName\\\"},'msg','
',\\n\\t\\t'
', 'inp#ver.w40', {plc:\\\"Ver\\\"},'
'],\\n\\t[\\\"\\\",\\\"txt#desc\\\",{plc:\\\"Short description\\\"},\\\"msg\\\"],\\n\\t[\\\"\\\",'spn#type.fs80'],\\n\\t'
',\\n\\t\\t{rowCss:\\\"my-row mt-2\\\"},\\n\\t\\t[\\\"\\\",'State mask:',\\n\\t\\t\\t\\t\\\"txt#maskstate\\\", {plc:\\\"String reference or JSON obj/array mask\\\"}, \\\"msg\\\"],\\n\\t\\t{rowCss:\\\"my-row pt10\\\"},\\n\\t\\t[\\\"Title node\\\",\\\"inp#nodetitle.fs90\\\",{plc:\\\"Like item.title\\\"},\\\"msg\\\"],\\n\\t\\t[\\\"Widths\\\",\\\"inp#width.fs90\\\",{plc:\\\"Like 800,1200\\\"},\\\"msg\\\"],\\n\\t\\t[\\\"Timeout\\\",\\\"inp#timeout.fs90.w70\\\",{plc:\\\"Start in\\\"},\\n\\t\\t\\t' ms'],\\n\\t\\t'
',\\n\\t\\t\\t[\\\"Doc node\\\",\\\"inp#nodedoc.fs90\\\",\\\"msg\\\"],\\n\\t\\t\\t[\\\"Cmd node\\\",\\\"inp#nodecmd.fs90\\\",\\\"msg\\\"],\\n\\t\\t\\t{rowCss:\\\"my-row pt7\\\"},\\n\\t\\t\\t[\\\"\\\",'spn#btn-addcmd.pseudolink.fs85',{txt:\\\"Add type/command...\\\"}],\\n\\t\\t\\t[\\\"\\\",'
'],\\n\\t\\t'
',\\n\\t\\t\\t\\t\\t\\n\\t'
',\\n\\t\\t\\t\\t\\n\\t'
',\\n\\t\\t'',\\n\\t\\t'',\\n\\t\\t'Add component image...',\\n\\t'
'\\t\\t\\t\\n])\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"err\": [],\n\t\t\t\t\"color\": [\"orange\"]\n\t\t\t}],\n\t\t\"width\": [1320,\n\t\t\t1170],\n\t\t\"_cmd\": [{\n\t\t\t\t\"type\": \"manifest\",\n\t\t\t\t\"actions\": [\"edit\",\n\t\t\t\t\t\"create\"]\n\t\t\t}],\n\t\t\"_type\": [\"editor\"],\n\t\t\"collapsed\": []\n\t},\n\t\"log\": [[1441369997870,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t70,\n\t\t\t\"CloudWall\"],\n\t\t[1441369155401,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t68,\n\t\t\t\"CloudWall\"],\n\t\t[1441368224904,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t65,\n\t\t\t\"CloudWall\"],\n\t\t[1441367497630,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t60,\n\t\t\t\"CloudWall\"],\n\t\t[1441366718569,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t58,\n\t\t\t\"CloudWall\"],\n\t\t[1441366110155,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t55,\n\t\t\t\"CloudWall\"],\n\t\t[1439773536752,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t53,\n\t\t\t\"CloudWall\"],\n\t\t[1438217285981,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t52,\n\t\t\t\"CloudWall\"],\n\t\t[1438053017446,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t51,\n\t\t\t\"CloudWall\"],\n\t\t[1436999191984,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t50,\n\t\t\t\"CloudWall\"],\n\t\t[1435598701450,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t48,\n\t\t\t\"CloudWall\"],\n\t\t[1428926089522,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t45,\n\t\t\t\"CloudWall\"],\n\t\t[1428907524975,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t44,\n\t\t\t\"CloudWall\"],\n\t\t[1428905271804,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t38,\n\t\t\t\"CloudWall\"],\n\t\t[1428904619837,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t34,\n\t\t\t\"CloudWall\"],\n\t\t[1428903756236,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t33,\n\t\t\t\"CloudWall\"],\n\t\t[1428253367026,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t32,\n\t\t\t\"CloudWall\"],\n\t\t[1428252197207,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t31,\n\t\t\t\"CloudWall\"],\n\t\t[1428251413683,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t29,\n\t\t\t\"CloudWall\"],\n\t\t[1427834100102,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t28,\n\t\t\t\"CloudWall\"],\n\t\t[1427833472267,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t27,\n\t\t\t\"CloudWall\"],\n\t\t[1427604847097,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t24,\n\t\t\t\"CloudWall\"],\n\t\t[1427603475116,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t22,\n\t\t\t\"CloudWall\"],\n\t\t[1427602760056,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t17,\n\t\t\t\"CloudWall\"],\n\t\t[1427493312597,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t15,\n\t\t\t\"CloudWall\"],\n\t\t[1427492629378,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t13,\n\t\t\t\"CloudWall\"],\n\t\t[1427469140405,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t12,\n\t\t\t\"CloudWall\"],\n\t\t[1427468261671,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t11,\n\t\t\t\"CloudWall\"],\n\t\t[1427407941428,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t10,\n\t\t\t\"CloudWall\"],\n\t\t[1427405247308,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t8,\n\t\t\t\"CloudWall\"],\n\t\t[1427404498447,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t4,\n\t\t\t\"CloudWall\"],\n\t\t[1427403256799,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t3,\n\t\t\t\"CloudWall\"],\n\t\t[1427392168542,\n\t\t\t\"update\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t2,\n\t\t\t\"CloudWall\"],\n\t\t[1427390269767,\n\t\t\t\"create\",\n\t\t\t\"ermouth-1ermouth\",\n\t\t\t1,\n\t\t\t\"CloudWall\"]],\n\t\"_id\": \"cw-Manifest-4vx1\",\n\t\"_rev\": \"71-b1c5797ba0e64d2d08e6aa23cca05e2f\"\n}", "parser": "(function (item, atts){\n\tvar z, src = eval('('+ item.data+')');\n\t\n\tz = Object.reject(src.manifest,\"files\");\n\tif (src._attachments) z.files = src._attachments;\n\t\n\tz.app.name = \"Manifest\";\n\tsrc = null;\n\treturn cw.lib.js2txt(z,'\\t');\n})", "parserActive": true, "Uglify": false, "noIncludes": true, "external": "pouch://cw-Manifest-4vx1", "state": { "savedSdbm": "-4sceuw22", "sdbm": "-4sceuw22", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "18t27xjn", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Manifest.Editor", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"id\": \"cw.Manifest.Editor\",\n\t\"build\": 110,\n\t\"getCollapsed\": function () {\n\t\treturn this.Collapsed\n\t\t},\n\t\"GetTabHash\": function (item,idx) {\n\n\t\treturn $.my.f.sdbmCode(Object.reject(item,\"data\"))+this.Collapsed;\n\t\n\t\t},\n\t\"GetTabId\": function (e) {\n\t\treturn e.stamp + e.id\n\t\t},\n\t\"Postfix\": function () {\n\t\treturn {}\n\t\t},\n\t\"Prefix\": function () {\n\t\treturn {}\n\t\t},\n\t\"init\": function ($form,form) {\n\t\n\tvar d = form.data, that = this;\n\t\n\t$form.html(this.HTML);\t\n\n\tthis.js2txt = cw.lib.js2txt;\n\t\n\t$.extend (this.Ed, {NewTab: Object.clone(this.NewTab, true), Types: this.Types});\n\t\n\t$.extend(this.Tab, {Types: this.Types});\n\n\tif (this.Mode.saveToLs) {\n\t\t// Saved?\n\t\tvar ls = localStorage, old = ls.getItem(\"Manifesto\");\n\t\tif (old) Object.merge(d, JSON.parse(old));\n\t\t// localStorage saver\n\t\t$form.then(function(){\n\t\t\t$form.on(\"change\", function (){\n\t\t\t\tls.setItem(\"Manifesto\", JSON.stringify($form.my(\"data\")));\n\t\t\t}.debounce(500));\n\t\t});\n\t}\n\t\n\tif (d._preview!==void 0) delete d._preview;\n\t\n\tif (!d.com) d.com = [];\n\td.com = d.com.map(function(e){\n\t\tif (!Object.isObject(e) || !e.id || !(\"data\" in e)) return null;\n\t\tif (!that.Types[e.type]) e.type=\"text\";\n\t\treturn e;\n\t}).compact(true);\n\tif (!d.com.length) {\n\t\td.com.push(Object.clone(this.Item, !0));\n\t\td.com[0].stamp = Date.now()+\"\";\n\t\td.com[0].data = that.NewAppSrc;\n\t}\n\t\n\td._src=\"\";\n\t\n\tvar act = d.com.find(function(e){return e.active}) || d.com[0];\n\tact.active = true;\n\tthis.Editors.push(act);\t\n\t\n\t// Remove tab\n\t\n\t$form.on(\"removetab.my\", function(evt, data){\n\t\tvar t = d.com, e = that.Editors;\n\t\tt.removeAt(t.indexOf(data));\n\t\te.removeAt(e.indexOf(data));\n\t\tt[0].active=true;\n\t\t\n\t\tthat.TabCollapse();\n\t\t$form.find(\"#coms,#eds\").trigger(\"recalc\");\n\t});\n\t\n\t// Tab Collapser\n\tif (d.collapsed) that.Collapsed = d.collapsed.map(function(e){return [e, true,1]});\n\tthat.TabCollapse();\n\t\n\t\t\n\t\t},\n\t\"NewAppSrc\": \"// More detailed manifest structure description \\n// read at http://jquerymy.com/api.html\\n({\\n\\tparams:{},\\n\\tdata:{\\n\\t\\t// Data to bind with controls,\\n\\t\\t// freeform like \\n\\t\\t// { type:\\\"box\\\", size:{x:\\\"7\\\", y:\\\"5\\\"}, count:\\\"6\\\" }\\n\\t},\\n\\tinit: function ($form, form) {\\n\\t\\t// Init function, executed before controls init.\\n\\t\\t// Renders ui skeleton and prepares data if needed.\\n\\t\\t// Any init function can return promise to become async.\\n\\t},\\n\\tui:{\\n\\t\\t/*\\n\\t\\t\\\"#someControl\\\":{\\n\\t\\t\\tbind:\\\"size.x\\\",\\n\\t\\t\\tcheck:/someRegexp/\\n\\t\\t}, ...\\n\\t\\t*/\\n\\t},\\n\\tstyle:{\\n\\t\\t/*\\n\\t\\t// Creates runtime stylesheet with rules\\n\\t\\t// selective for manifest, like\\n\\t\\t\\t\\\" .red\\\":\\\"color:red\\\",\\n\\t\\t\\t\\\" .item\\\":{\\n\\t\\t\\t\\t\\\" .red\\\":\\\"color:#c02\\\"\\n\\t\\t\\t}\\n\\t\\t*/\\n\\t}\\n})\",\n\t\"TabCollapse\": function (reflist) {\n\n\t\n\t// Re-builds collapse list for tabs\n\n\tvar that = this,\n\t\t\tcurr = that.Collapsed,\n\t\t\tcoll = curr.reduce(function(a,b,i){a[b[0]] = i;return a;},{}),\n\t\t\tres = [],\n\t\t\tc;\n\t\n\t// Need optimization!\n\t\n\tc= (reflist || that.data.com.map(function(e){return e.id}))\n\t.sortBy()\n\t.reduce(function(a,b){\n\t\tvar ins = -1;\n\t\tif(!a.a[b]) {\n\t\t\tvar k = Object.keys(a.a);\n\t\t\tk.forEach(function(e,i){\n\t\t\t\tif (ins==-1 && b.startsWith(e+\".\")) ins=i;\n\t\t\t});\n\t\t}\n\t\tif (ins>-1) {\n\t\t\ta.coll[k[ins]] = (a.coll[k[ins]] || 0)+1;\n\t\t}\n\t\telse a.a[b]=0;\n\t\treturn a;\n\t},{a:{},coll:{}})[\"coll\"];\n\t\n\tObject.keys(c)\n\t.forEach(function(k){\n\t\tif (k in coll) res.push([k, curr[coll[k]][1], c[k]]);\n\t\telse res.push([k, false, c[k]]);\n\t});\n\t\n\tthat.data.collapsed = res.map(function(e){\n\t\tif (e[1]) return e[0];\n\t}).compact();\n\t\n\treturn that.Collapsed = res;\n\t\n\t\t\n\t\t},\n\t\"Build\": function (buildPreview) {\n\n\tvar that=this,\n\t\t\td = that.data,\n\t\t\topts = that.Types, \n\t\t\terr=[], r={}, p={}, \n\t\t\trow, ext, conv, a;\n\tif (Object.isFunction(that.Prefix)) $.extend(true, r, that.Prefix());\n\t\n\tif (buildPreview) $.extend(true, p, r);\n\n\tfor (var i=0;i\\n
\\n\\t\\n
\\n\\n
\\n\\t
\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t
\\n
\\n\\n\\n
\\n\\n
\",\n\t\"params\": {\n\t\t\"restyle\": 200\n\t},\n\t\"require\": [{\n\t\t\t\"UglifyJS\": \"lib/uglify.js\"\n\t\t}],\n\t\"inherit\": [\"db\"],\n\t\"data\": {\n\t\t\"_src\": \"\",\n\t\t\"com\": [],\n\t\t\"_err\": [],\n\t\t\"_opts\": {\n\t\t\t\"runWidth\": \"800\",\n\t\t\t\"runCss\": \"\",\n\t\t\t\"runId\": \"manifest-preview\",\n\t\t\t\"compileTo\": [\"js\"],\n\t\t\t\"runMode\": [\"modal\"]\n\t\t}\n\t},\n\t\"Item\": {\n\t\t\"stamp\": 0,\n\t\t\"id\": \"Root\",\n\t\t\"type\": \"js\",\n\t\t\"data\": \"({})\",\n\t\t\"active\": true,\n\t\t\"opts\": []\n\t},\n\t\"Mode\": {\n\t\t\"saveToLs\": false,\n\t\t\"previewParent\": \"#cw-body\",\n\t\t\"fullscreenStyle\": \"padding:50px; min-width:150px;\"\n\t},\n\t\"Editors\": [],\n\t\"Collapsed\": [],\n\t\"ui\": {\n\t\t\"#btn-opts\": function (d,v,$o) {\n\n\t\tif (v!=null) {\n\t\t\t$o.modal({\n\t\t\t\tmanifest: this.Settings,\n\t\t\t\tdata:Object.clone(d._opts,true),\n\t\t\t\twidth:500,\n\t\t\t\tesc:true,\n\t\t\t\tenter:true,\n\t\t\t\tglobal:true,\n\t\t\t\tscreen:true\n\t\t\t\t//align:\"top:-3px;right:-3px\"\n\t\t\t}).then(function(r){\n\t\t\t\tObject.merge(d._opts,r,true)\n\t\t\t})\n\t\t}\n\t\n\t\t\t},\n\t\t\"#coms\": {\n\t\t\t\"bind\": \"com\",\n\t\t\t\"check\": true,\n\t\t\t\"init\": function ($o,form) {\n\n\t\tvar d = form.data,\n\t\t\t\tthat = this;\n\n\t\t$o.sortable({handle:\"#xtitle\"});\n\t\t\n\t\t// Switch tab\n\n\t\t$o.on(\"switch.my\", function(evt, data){\t\n\t\t\tvar $f = $(this).my().root, e = that.Editors, i = 0;\t\t\t\n\t\t\tfor (;idiv\",\n\t\t\t\"delay\": 20,\n\t\t\t\"css\": {\n\t\t\t\t\"fs90 lh160 mb10\": function (d) {\n\n\t\t\treturn d.com.length>25;\n\t\t\n\t\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"#eds\": {\n\t\t\t\"bind\": \"this.Editors\",\n\t\t\t\"watch\": \"#coms\",\n\t\t\t\"recalc\": \"#coms\",\n\t\t\t\"recalcDepth\": 1,\n\t\t\t\"manifest\": \"Ed\",\n\t\t\t\"hash\": \"GetTabHash\",\n\t\t\t\"id\": \"GetTabId\",\n\t\t\t\"list\": \"
\",\n\t\t\t\"delay\": 110\n\t\t},\n\t\t\"#btn-add\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tvar that=this;\n\t\t\tif (v!=null) {\n\t\t\t\tif (!$o.data(\"modal\")) $o.modal({\n\t\t\t\t\tmanifest:this.NewTab,\n\t\t\t\t\tdata:{},\n\t\t\t\t\tesc: true,\n\t\t\t\t\tenter:true,\n\t\t\t\t\troot:$o.parent(),\n\t\t\t\t\talign:\"top:100%\",\n\t\t\t\t\tbound:0,\n\t\t\t\t\tcss:\"mt10\", \n\t\t\t\t\tnose:\"top\",\n\t\t\t\t\tscreen:'rgba(255,255,255,0.5)'\n\t\t\t\t}, function (e){ \n\t\t\t\t\treturn !!(e && Object.size(e)) \n\t\t\t\t}).then(function(r){\n\t\t\t\t\t$o.my(\"find\",\"#coms\").trigger(\"insert\", {\n\t\t\t\t\t\twhere:1e6,\n\t\t\t\t\t\twhat:r.result\n\t\t\t\t\t});\n\t\t\t\t\tthat.TabCollapse();\n\t\t\t\t});\n\t\t\t\telse $o.modal(true);\n\t\t\t}\n\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\"\n\t\t},\n\t\t\"#btn-compile\": {\n\t\t\t\"delay\": 150,\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\tvar that = this;\n\t\tif (v!=null) {\n\t\t\tif (d._err.length) cw.lib.note(d._err.join(\"
\"),\"error\");\n\t\t\telse {\n\t\t\t\t$o.modal({\n\t\t\t\t\tmanifest: $.extend({ParseJS:this.ParseJS},this.Compiler),\n\t\t\t\t\tdata:{\n\t\t\t\t\t\t_src:that._src,\n\t\t\t\t\t\topts:d._opts.compileTo,\n\t\t\t\t\t\tSubs:that.Subs\n\t\t\t\t\t},\n\t\t\t\t\twidth:920,\n\t\t\t\t\tesc:true,\n\t\t\t\t\tenter:true,\n\t\t\t\t\tglobal:true,\n\t\t\t\t\tscreen:true\n\t\t\t\t}).then(function(r){\n\t\t\t\t\td._opts.compileTo=r.opts.slice(0);\n\t\t\t\t})\n\n\t\t\t}\n\t\t}\n\t\n\t\t\t\t}\n\t\t},\n\t\t\"#warnM\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\n\t\tvar err = this.Build (false);\n\t\t\n\t\tif (err.length) $o.my(\"find\",\".validate\").addClass(\"red\");\n\t\telse $o.my(\"find\",\".validate\").removeClass(\"red\");\n\t\t\n\t\t$o.trigger(\"change\");\n\t\n\t\t\t\t},\n\t\t\t\"watch\": \"#eds\",\n\t\t\t\"delay\": 110\n\t\t},\n\t\t\"#btn-run\": {\n\t\t\t\"delay\": 150,\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\tvar $r, $e, $p, dui, ref, doc, parentapp, _prefix, that=this, runnow=true;\n\t\tif (v!=null) {\n\t\t\tthat.Build (true);\n\t\t\tif (d._err.length) cw.lib.note(d._err.join(\"
\"),\"error\");\n\t\t\telse {\n\t\t\t\t$r = $o.my().root;\n\t\t\t\tif ($r) dui = $r.my().dui;\n\n\t\t\t\tif (dui) {\n\t\t\t\t\tref = dui.bind.split(\".\").to(-1).join(\".\");\n\t\t\t\t\tdoc = $.my.f.getref($r.my().ddata, ref);\n\t\t\t\t\tif (doc && Object.isObject(doc._attachments) && Object.size(doc._attachments)) {\n\t\t\t\t\t\t// try read attaches\n\t\t\t\t\t\tparentapp = $r.my().root.data(\"app\");\n\t\t\t\t\t\tif (parentapp && parentapp.db && parentapp.db.load) {\n\t\t\t\t\t\t\trunnow = false;\n\t\t\t\t\t\t\tparentapp.db.load(doc._id, true)\n\t\t\t\t\t\t\t.then(function(res){\n\t\t\t\t\t\t\t\tif (res._attachments) _prefix = {files:res._attachments};\n\t\t\t\t\t\t\t\t_runPreview();\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} \n\t\t\t\t\t}\t\n\t\t\t\t} \n\t\t\t\tif (runnow) _runPreview();\n\t\t\t}\n\t\t}\n\n\t\tfunction _runPreview(){ \n\t\t\t// Preview in modal\n\t\t\tif (d._opts.runMode==\"modal\") {\n\t\t\t\tvar $r = $o.parents(\"#manedframe\").eq(0);\n\t\t\t\t$r.modal({\n\t\t\t\t\troot:$r.parent(),\n\t\t\t\t\tmanifest: that.Preview,\n\t\t\t\t\tdata:{\n\t\t\t\t\t\t_opts:d._opts,\n\t\t\t\t\t\t_src:that._preview,\n\t\t\t\t\t\t_prefix:_prefix,\n\t\t\t\t\t\t_subs:that.Subs,\n\t\t\t\t\t\t_db:that.db\n\t\t\t\t\t},\n\t\t\t\t\twidth:d._opts.runWidth||1000,\n\t\t\t\t\tesc:true,\n\t\t\t\t\tglobal:false,\n\t\t\t\t\tscreen:'rgba(255,255,255,0.5)',\n\t\t\t\t\tdrag:true\n\t\t\t\t}).then(function(r){\n\t\t\t\t\t//Object.merge(d._opts,r,true)\n\t\t\t\t})\n\t\t\t\t/*.fail(function(res){\n\t\t\t\t\tcw.lib.note(\"Preview failed to init. \"\n\t\t\t\t\t\t+\"See console for details\", \"error\");\n\t\t\t\t});*/\n\t\t\t}\n\n\t\t\t// Preview fullscreen\n\t\t\telse if (d._opts.runMode==\"fullscreen\") {\n\t\t\t\t$p = $(that.Mode.previewParent||\"body\");\n\n\t\t\t\t$p.find(\">*:visible\").each(function(){\n\t\t\t\t\tvar $t = $(this);\n\t\t\t\t\tif (\n\t\t\t\t\t\t!$t.is(\".my-modal\")\n\t\t\t\t\t\t&& !$t.is(\".my-modal-screen\")\n\t\t\t\t\t\t&& !$t.is(\".my-modal-proxy\")\n\t\t\t\t\t) $t.addClass(\"hide my-manifesto-preview-hide\");\n\t\t\t\t});\t\t\n\n\t\t\t\t$e = $(\n\t\t\t\t\t'
'\n\t\t\t\t);\n\n\t\t\t\t$e.appendTo($p)\n\t\t\t\t.my(that.Preview, {\n\t\t\t\t\t_opts:d._opts,\n\t\t\t\t\t_src:that._preview,\n\t\t\t\t\t_prefix:_prefix,\n\t\t\t\t\t_subs:that.Subs,\n\t\t\t\t\t_db:that.db\n\t\t\t\t}).fail(function(){\n\t\t\t\t\tcw.lib.note(\"Preview failed to init. \"\n\t\t\t\t\t\t\t\t\t\t\t+\"See console for details\", \"error\");\n\t\t\t\t\t_kill();\n\t\t\t\t}.debounce(50));\n\t\t\t\t$e.on(\"cancel.my\", _kill.debounce(50));\n\n\t\t\t}\n\t\t}\n\n\t\tfunction _kill (){\n\t\t\ttry {\n\t\t\t\t$e.my(\"remove\");\n\t\t\t} catch (e) {}\n\t\t\t$e.unbind(\".my\");\n\t\t\t$e.remove();\n\t\t\t$p.find(\".my-manifesto-preview-hide\")\n\t\t\t.removeClass(\"hide my-manifesto-preview-hide\");\n\t\t}\n\t\n\t\t\t\t}\n\t\t}\n\t},\n\t\"Tab\": {\n\t\t\"id\": \"Manifest.Editor.Tab\",\n\t\t\"inherit\": [\"getCollapsed\",\n\t\t\t\"ParseJS\"],\n\t\t\"Colors\": {\n\t\t\t\"blue\": [\"rgb(14, 85, 163)\",\n\t\t\t\t\"rgba(142, 211, 255, 0.25)\"],\n\t\t\t\"red\": [\"#A3293D\",\n\t\t\t\t\"rgba(255, 200, 200, 0.75)\"],\n\t\t\t\"green\": [\"rgb(75, 129, 1)\",\n\t\t\t\t\"#E3F3CB\"],\n\t\t\t\"teal\": [\"#07AB8F\",\n\t\t\t\t\"rgba(198, 252, 234, 0.67)\"],\n\t\t\t\"orange\": [\"#F77400\",\n\t\t\t\t\"rgb(255, 227, 185)\"],\n\t\t\t\"violet\": [\"rgba(109, 37, 179, 0.9);\",\n\t\t\t\t\"rgba(210, 142, 255, 0.25);\"]\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#xtitle\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tvar that = this,\n\t\t\t\t\t\tColl=false,\n\t\t\t\t\t\tclr = d.color?d.color+\"\":\"\",\n\t\t\t\t\t\tcolors = that.Colors;\n\t\t\t\tif (clr) {\n\t\t\t\t\t$o.css({ color:colors[clr][0] });\n\t\t\t\t\tif (d.active) { $o.css({ \"background-color\":colors[clr][1] }); } \n\t\t\t\t\telse { \t$o.css({ \"background-color\":\"\" }); }\n\t\t\t\t}\n\t\t\t\telse $o.css({ color:\"\", \"background-color\":\"\" });\n\t\t\t\t\n\t\t\t\t$o.css({opacity:d.active?\"1\":\"0.7\"});\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"watch\": \"#title\",\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"active\": function (d) {\n\t\t\t\t\t\t return d.active \n\t\t\t\t\t\t},\n\t\t\t\t\t\"bold fs105\": function (d) {\n\t\t\t\t\t\t return (d.id||\"\").to(1)!==\".\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\"itl\": function (d) {\n\t\t\t\t\t\t return (d.opts||[]).indexOf(\"nocompile\")>-1\n\t\t\t\t\t\t},\n\t\t\t\t\t\"haserror\": function (d) {\n\t\t\t\t\t\treturn d.err && d.err.length\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\".fold\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tvar that = this, \n\t\t\t\t\t\t$p,\n\t\t\t\t\t\thtml=\"\";\n\t\t\t\t\t\t\n\t\t\t\tif (v==null) {\n\t\t\t\t\t$p = $o.my().root;\n\t\t\t\t\tthat.getCollapsed().forEach(function(e){\n\t\t\t\t\t\tif (d.id==e[0]) {\n\t\t\t\t\t\t\t\thtml = e[1]?''+e[2]\n\t\t\t\t\t\t\t\t:''+e[2]\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (d.id.startsWith(e[0]+\".\")) {\n\n\t\t\t\t\t\t\tvar folded = !!$p.is(\".w00\");\n\t\t\t\t\t\t\t$p.toggleClass(\"w00\", !!e[1] && !d.active);\n\t\t\t\t\t\t\tif (folded) {\n\t\t\t\t\t\t\t\t$p.css({\"background-color\":\"rgba(255,240,0,0.5)\"});\n\t\t\t\t\t\t\t\t(function(){$p.css({\"background-color\":\"rgba(255,255,255,0)\"});}).delay(150);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\treturn html;\n\t\t\t\t}\n\t\t\t\telse return v;\n\t\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#title\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (null != v) {\n\t\t\t\t\tif (!d.active) $o.trigger(\"switch\", d);\n\t\t\t\t\telse if (d.err && d.err.length) {\n\t\t\t\t\t\tvar e = this.ParseJS(\"(\"+d.data+\")\");\n\t\t\t\t\t\td.err=e.errors;\n\t\t\t\t\t\t$o.modal({\n\t\t\t\t\t\t\troot:$o.my().root.parents(\".my-form\").eq(0),\n\t\t\t\t\t\t\twidth:250,\n\t\t\t\t\t\t\tnose:\"top\",\n\t\t\t\t\t\t\tbound:0,\n\t\t\t\t\t\t\talign:\"top:120%;\",\n\t\t\t\t\t\t\tesc:true,\n\t\t\t\t\t\t\tenter:true,\n\t\t\t\t\t\t\tmanifest:{\n\t\t\t\t\t\t\t\tinit:[''],\n\t\t\t\t\t\t\t\tui:{\"#t\":\"t\",\"input\":\"x\"}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdata:{t:e.errors.join(\"
\")},\n\t\t\t\t\t\t\tscreen:'rgba(255,255,255,0.5)'\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn d.id;\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\",\n\t\t\t\t\"init\": function ($o,form) {\n\n\t\t\t\tvar d = form.data;\n\t\t\t\t$o.parent().parent().find(\".ctype\")\n\t\t\t\t.addClass(this.Types[d.type].css||\"hide\");\n\t\t\t\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"Ed\": {\n\t\t\"id\": \"cw.Manifesto.CM\",\n\t\t\"init\": function ($o,form) {\n\n\t\t$o.html([\n\t\t\t'
',\n\t\t\t'',\n\t\t\t'
',\n\t\t\t'
',\n\t\t\t'',\n\t\t\t'
',\n\t\t\t'
'\n\t\t].join(\"\"))\n\t\t//console.log(form)\n\t\n\t\t\t},\n\t\t\"params\": {\n\t\t\t\"restyle\": 200\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#cm\": {\n\t\t\t\t\"bind\": \"data\",\n\t\t\t\t\"init\": function ($o,form) {\n\n\t\t\tvar opts = this.Types[form.data.type];\n\t\t\tCodeMirror.fromTextArea($o[0], {\n\t\t\t\tmode:opts.CM.mode,\n\t\t\t\tlineNumbers:true,\n\t\t\t\tindentWithTabs:!0,\n\t\t\t\tindentUnit:2,\n\t\t\t\ttabSize:2,\n\t\t\t\ttheme: opts.CM.theme||\"default\"\n\t\t\t});\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"delay\": 30,\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\t\treturn !d.active\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"#btn-opts\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tif (null!=v) {\n\t\t\t\t$o.modal({\n\t\t\t\t\tmanifest: Object.merge(\n\t\t\t\t\t\tthis.NewTab,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tOpts:{apply:\"Save\", title:\"Tab settings\", del:\"Del tab\"},\n\t\t\t\t\t\t\tstyle:{\" #xtype\":\"display:none;\"}\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\tdata:{result:Object.clone(d,true)},\n\t\t\t\t\twidth:400,\n\t\t\t\t\talign:\"top:0px,right:0px\", css:\"fs90\", xnose:\"top\"\n\t\t\t\t}).then(function(r){\n\t\t\t\t\tif (r.op === \"Del\") {\n\t\t\t\t\t\t$o.trigger(\"removetab\", d);\n\t\t\t\t\t\t//$o.trigger(\"remove\");\t\n\t\t\t\t\t} else if (r.op === \"Save\") {\n\t\t\t\t\t\tObject.merge(d, Object.reject(r.result, [\"data\",\"stamp\",\"type\"]));\n\t\t\t\t\t\t$o./*my(\"find\",\".warn\").*/trigger(\"change\");\n\t\t\t\t\t}\n\t\t\t\t}.debounce(50));\n\t\t\t}\n\t\t\t//if (d.id.to(1)!==\".\") $o.addClass(\"hide\");\n\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\".warn\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\tvar row = d, ext = {}, ins={}, err=[];\n\n\t\t\tvar $r, cmp = this.Types[d.type].compile,\n\t\t\t\t\ta = cmp?cmp(d.data):[[], d.data],\n\t\t\t\t\terr=a[0].slice(0);\n\n\t\t\tif ((d.err||[]).length!=err.length) {\n\t\t\t\td.err = err;\n\t\t\t\t$o.trigger(\"change\");\n\t\t\t}\n\t\t\telse d.err = err;\n\t\t\t$r = $o.my().root;\n\t\t\t$r.toggleClass(\"hide\", !d.active);\n\t\t\t$r.toggleClass(\"ed-error\", !!err.length);\n\t\t\t\n\t\t\n\t\t\t\t\t},\n\t\t\t\t\"watch\": \"#cm\",\n\t\t\t\t\"delay\": 70\n\t\t\t}\n\t\t},\n\t\t\"style\": {\n\t\t\t\" #btn-opts\": \"border-radius:100px;padding:5px 7px;transition: opacity 0.3s;opacity:0.5;margin:0px!important;line-height:0.95em;\",\n\t\t\t\" #btn-opts:hover\": \"opacity:1;\",\n\t\t\t\" .CodeMirror \": function ($o) {\n\n\t\t\tvar ofs = $(\"#cw-header\").is(\":visible\")?$(\"#cw-header\").outerHeight(true):0,\n\t\t\t\t\tpad = parseInt($(\"#cw-space\").css(\"paddingTop\")) || 0,\n\t\t\t\t\ttab = $o.parents(\".my-manifest-1a9u4bgu\").find(\"#coms\").outerHeight(true),\n\t\t\t\t\tcss = \"height:\"+($(window).height()-(pad+ofs+tab+15))+\"px;\";\n\t\t\treturn css;\n\t\t\n\t\t\t\t}\n\t\t}\n\t},\n\t\"NewTab\": {\n\t\t\"init\": function ($o,form) {\n\n\t\t$o.formgen(this.HTML);\n\t\tform.data.result.stamp = form.data.result.stamp || (Date.now()+\"\");\n\t\n\t\t\t},\n\t\t\"params\": {\n\t\t\t\"width\": 400\n\t\t},\n\t\t\"Opts\": {\n\t\t\t\"apply\": \"Create\",\n\t\t\t\"title\": \"New tab\"\n\t\t},\n\t\t\"data\": {\n\t\t\t\"op\": \"Save\",\n\t\t\t\"root\": {\n\t\t\t},\n\t\t\t\"result\": {\n\t\t\t\t\"stamp\": 0,\n\t\t\t\t\"id\": \"\",\n\t\t\t\t\"type\": \"js\",\n\t\t\t\t\"data\": \"\",\n\t\t\t\t\"active\": false,\n\t\t\t\t\"err\": [],\n\t\t\t\t\"opts\": [],\n\t\t\t\t\"color\": []\n\t\t\t}\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"input[name=\\\"opts\\\"]\": \"result.opts\",\n\t\t\t\"#btn-cancel\": function (d,v,$o) {\n\n\t\t\tif (v!=null) $o.trigger(\"cancel\");\n\t\t\n\t\t\t\t},\n\t\t\t\"#btn-apply\": function (d,v,$o) {\n\n\t\t\tif (v!=null) $o.trigger(\"commit\");\n\t\t\treturn this.Opts.apply;\n\t\t\n\t\t\t\t},\n\t\t\t\"#title\": \"this.Opts.title\",\n\t\t\t\"#id\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\tif (d.result.type==\"js\") d.result.data = \"({\\n\\n})\";\n\t\t\t\t\tif (d.result.type==\"html\") d.result.data = \"
\\n\\n
\";\n\t\t\t\t\td.result.id=v;\n\n\t\t\t\t}\n\t\t\t\treturn d.result.id;\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"check\": /^(\\.[^\\.\\s\\t\\r\\n]+)+\\.?$/i,\n\t\t\t\t\"error\": \"Branch name like .Branch or .Branch.Leaf\",\n\t\t\t\t\"delay\": 100\n\t\t\t},\n\t\t\t\"#type\": {\n\t\t\t\t\"bind\": \"result.type\",\n\t\t\t\t\"init\": function ($o) {\n\n\t\t\t\t$o.select2();\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"watch\": \"#id\"\n\t\t\t},\n\t\t\t\"#ncolor\": {\n\t\t\t\t\"init\": function ($o) {\n\n\t\t\t\tvar clr = [\n\t\t\t\t\t{'':'blue'},\n\t\t\t\t\t{'':'red'},\n\t\t\t\t\t{'':'orange'},\n\t\t\t\t\t{'':'green'},\n\t\t\t\t\t{'':'teal'},\n\t\t\t\t\t{name:'', value:'violet', css:\"violet\"}\n\t\t\t\t];\n\t\t\t\t$o.tags({tags:[clr], tagshim:\"\", tagcss:\"tag pt3 pl4 pb2 pr6 lh100 cp\"});\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"bind\": \"result.color\"\n\t\t\t},\n\t\t\t\"#btn-del\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\td.op = \"Del\";\n\t\t\t\t\t$o.trigger(\"commit\");\n\t\t\t\t}\n\t\t\t\treturn this.Opts.del||\"\";\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"css\": {\n\t\t\t\t\t\"hide\": function () {\n\t\t\t\t\t\treturn !this.Opts.del\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"HTML\": [\"

\",\n\t\t\t{\n\t\t\t\t\"row\": \"400px\",\n\t\t\t\t\"label\": \"70px\",\n\t\t\t\t\"rowCss\": \"my-row pt10 pb2\",\n\t\t\t\t\"labelCss\": \"xgray fs85 lh110\"\n\t\t\t},\n\t\t\t[\"\",\n\t\t\t\t\"inp#id.fs120\",\n\t\t\t\t{\n\t\t\t\t\t\"plc\": \"Property name\"\n\t\t\t\t},\n\t\t\t\t\"msg\"],\n\t\t\t[\"Type\",\n\t\t\t\t\"\",\n\t\t\t\t\"sel#type.w140.mt-3\",\n\t\t\t\t{\n\t\t\t\t\t\"vals\": [\"js\",\n\t\t\t\t\t\t\"html\",\n\t\t\t\t\t\t\"text\",\n\t\t\t\t\t\t\"css\"]\n\t\t\t\t},\n\t\t\t\t\"\",\n\t\t\t\t\"\"],\n\t\t\t[\"Tab color\",\n\t\t\t\t\"\"],\n\t\t\t{\n\t\t\t\t\"rowCss\": \"my-row mt15 pt15 btd\"\n\t\t\t},\n\t\t\t[\"\",\n\t\t\t\t\"btn#btn-apply.green.mr5\",\n\t\t\t\t{\n\t\t\t\t\t\"val\": \"Create tab\"\n\t\t\t\t},\n\t\t\t\t\"\",\n\t\t\t\t\"btn#btn-del.red.mr0\",\n\t\t\t\t{\n\t\t\t\t\t\"val\": \"Delete\"\n\t\t\t\t},\n\t\t\t\t\"\",\n\t\t\t\t\"btn#btn-cancel\",\n\t\t\t\t{\n\t\t\t\t\t\"val\": \"Cancel\"\n\t\t\t\t}]],\n\t\t\"style\": {\n\t\t}\n\t},\n\t\"Settings\": {\n\t\t\"init\": function ($o) {\n\t\t\t $o.formgen(this.HTML); \n\t\t\t},\n\t\t\"data\": {\n\t\t\t\"runWidth\": \"500\",\n\t\t\t\"runCss\": \"\",\n\t\t\t\"runId\": \"manifest-preview\",\n\t\t\t\"compileTo\": [\"js\"],\n\t\t\t\"runMode\": [\"modal\"]\n\t\t},\n\t\t\"params\": {\n\t\t\t\"width\": 500\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#runwidth\": \"runWidth\",\n\t\t\t\"#runcss\": \"runCss\",\n\t\t\t\"#runid\": \"runId\",\n\t\t\t\"#btn-apply\": function (d,v,$o) {\n\t\t\t\tif (null!=v) $o.trigger(\"commit\");\n\t\t\t\t},\n\t\t\t\"#btn-cancel\": function (d,v,$o) {\n\t\t\t\tif (null!=v) $o.trigger(\"cancel\");\n\t\t\t\t},\n\t\t\t\"#runmode\": {\n\t\t\t\t\"bind\": \"runMode\",\n\t\t\t\t\"init\": function ($o) {\n\n\t\t\t\t$o.tags({\n\t\t\t\t\ttags:[[\n\t\t\t\t\t\t//{\"Inline\":\"inline\"},\n\t\t\t\t\t\t{\"Fullscreen\":\"fullscreen\"}\n\t\t\t\t\t]], \n\t\t\t\t\tempty:{\"Modal\":\"modal\"}\n\t\t\t\t})\n\t\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#compileto\": {\n\t\t\t\t\"bind\": \"compileTo\",\n\t\t\t\t\"init\": function ($o,form) {\n\n\t\t\t\t$o.tags({tags:[[\n\t\t\t\t\t{\"JS min\":\"jsmin\"},\n\t\t\t\t\t{\"JSON\":\"json\"},\n\t\t\t\t\t{\"JSON min\":\"cjson\"}\n\t\t\t\t\t//{\"Apply over...\":\"selector\"}\n\t\t\t\t]], empty:{\"JS object\":\"js\"}})\n\t\t\t\n\t\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"HTML\": [{\n\t\t\t\t\"row\": \"500px\",\n\t\t\t\t\"label\": \"120px\",\n\t\t\t\t\"rowCss\": \"my-row pt15 fs90\"\n\t\t\t},\n\t\t\t\"

Form’s settings

\",\n\t\t\t[\"Compile mode\",\n\t\t\t\t\"spn#compileto.fs90\"],\n\t\t\t[\"Preview mode\",\n\t\t\t\t\"spn#runmode.fs90\"],\n\t\t\t[\"Preview CSS\",\n\t\t\t\t\"inp#runcss.fs90\"],\n\t\t\t[\"Preview id\",\n\t\t\t\t\"inp#runid.fs90.w150\"],\n\t\t\t[\"Preview width\",\n\t\t\t\t\"inp#runwidth.fs90.w100\",\n\t\t\t\t\" px\"],\n\t\t\t{\n\t\t\t\t\"rowCss\": \"my-row pt15 mt25 btd fs90\"\n\t\t\t},\n\t\t\t[\"\",\n\t\t\t\t\"btn#btn-apply.green.mr5\",\n\t\t\t\t{\n\t\t\t\t\t\"val\": \"Save\"\n\t\t\t\t},\n\t\t\t\t\"btn#btn-cancel\",\n\t\t\t\t{\n\t\t\t\t\t\"val\": \"Cancel\"\n\t\t\t\t}]]\n\t},\n\t\"Compiler\": {\n\t\t\"init\": function ($o) {\n\t\t\t \n\t\t$o.formgen(this.HTML); \n\t\n\t\t\t},\n\t\t\"Stats\": 0,\n\t\t\"About\": {\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#btn-apply\": function (d,v,$o) {\n\t\t\t\tif (null!=v) $o.trigger(\"commit\");\n\t\t\t\t},\n\t\t\t\"#btn-cancel\": function (d,v,$o) {\n\t\t\t\tif (null!=v) $o.trigger(\"cancel\");\n\t\t\t\t},\n\t\t\t\"#opts\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tvar that = this,\n\t\t\t\t\t\tjsmin = cw.lib.jsmin, \n\t\t\t\t\t\ttoj = $.my.tojson;\n\t\t\t\tif (v!=null) {\n\t\t\t\t\tvar i = cw.lib.a2o(v),\n\t\t\t\t\t\t\t//_src = d._src;\n\t\t\t\t\t\t\t_src;\n\t\t\t\t\t\n\t\t\t\t\tif (i.childs) {\n\t\t\t\t\t\t//_src = \"(\"+cw.lib.js2txt($.extend(!0, eval(d._src), d.Subs()),'\\t')+\")\";\n\t\t\t\t\t\t_src = \"(\"+cw.lib.js2txt($.extend(!0, cw.lib.unjson(d._src), d.Subs?d.Subs():{}),'\\t')+\")\";\n\t\t\t\t\t} \n\t\t\t\t\telse {\n\t\t\t\t\t\t_src = \"(\"+cw.lib.js2txt(cw.lib.unjson(d._src),'\\t')+\")\";\n\t\t\t\t\t}\n\t\t\t\t\t//else _src = d._src;\n\t\t\t\t\t\n\t\t\t\t\tif (i.json) d.src = toj(eval(jsmin(_src)), '\\t');\n\t\t\t\t\telse if (i.cjson) d.src = toj(eval(jsmin(_src)));\n\t\t\t\t\telse if (i.jsmin) d.src = jsmin(_src);\n\t\t\t\t\telse if (i.uglify) {\n\t\t\t\t\t\t// compress and uglify \n\t\t\t\t\t\tvar u = UglifyJS,\n\t\t\t\t\t\t\t\tast = u.parse(_src);\n\t\t\t\t\t\tast.figure_out_scope();\n\t\t\t\t\t\tast = ast.transform(u.Compressor({side_effects: false}));\n\t\t\t\t\t\tast.figure_out_scope();\n\t\t\t\t\t\t// No char freq opt to avoid \n\t\t\t\t\t\t// different results from the same code\n\t\t\t\t\t\t//ast.compute_char_frequency();\n\t\t\t\t\t\tast.mangle_names();\n\t\t\t\t\t\td.src = ast.print_to_string().replace(/<\\/script>/ig,'<\\\\u002fscript>').replace(/;$/,'');\n\t\t\t\t\t}\n\t\t\t\t\telse d.src=_src;\n\t\t\t\t\t\n\t\t\t\t\tthis.Stats = unescape(encodeURIComponent(d.src)).length;\n\t\t\t\t\tthis.About = this.ParseJS(\"(\"+(i.json||i.cjson?_src:d.src) +\")\", true);\n\n\t\t\t\t\td.opts = v;\n\t\t\t\t}\n\t\t\t\treturn d.opts;\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"init\": function ($o,form) {\n\n\t\t\t\t$o.tags({\n\t\t\t\t\ttags:[\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\"JS object\":\"js\"},\n\t\t\t\t\t\t\t{\"JS min\":\"jsmin\"},\n\t\t\t\t\t\t\t{\"JS ugly\":\"uglify\"},\n\t\t\t\t\t\t\t{\"JSON\":\"json\"},\n\t\t\t\t\t\t\t{\"JSON min\":\"cjson\"}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\"Include childs\":\"childs\"}\n\t\t\t\t\t\t]\n\t\t\t\t\t], \n\t\t\t\t\tgroupshim:'  |  '\n\t\t\t\t})\n\t\t\t\n\t\t\t\t\t}\n\t\t\t},\n\t\t\t\"#critic\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tvar a=[];\n\t\t\t\ta.push( 'Globals '+((this.About.globals||[]).join(\", \")||\"—\") );\n\t\t\t\treturn a.join(\"
\");\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"watch\": \"#opts\"\n\t\t\t},\n\t\t\t\"#src\": {\n\t\t\t\t\"init\": function ($o) {\n\n\t\t\t\tCodeMirror.fromTextArea($o[0], {\n\t\t\t\t\tmode:\"javascript\",\n\t\t\t\t\tlineNumbers:false,\n\t\t\t\t\tindentWithTabs:!0,\n\t\t\t\t\tindentUnit:2,\n\t\t\t\t\ttabSize:2,\n\t\t\t\t\ttheme:\"default\",\n\t\t\t\t\treadOnly:true,\n\t\t\t\t\tlineWrapping:true\n\t\t\t\t});\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"bind\": \"src\",\n\t\t\t\t\"watch\": \"#opts\"\n\t\t\t},\n\t\t\t\"#stats\": {\n\t\t\t\t\"bind\": function () {\n\n\t\t\t\treturn \"Code is \"+(this.Stats||0).bytes(2)+\" long.\"\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"watch\": \"#opts\"\n\t\t\t}\n\t\t},\n\t\t\"style\": {\n\t\t\t\" .CodeMirror\": \"font:13px 'PT Mono',Monaco,monospace;overflow:scroll; height:300px;line-height:1.3em;border:1px solid #cde;\"\n\t\t},\n\t\t\"HTML\": [\"
\",\n\t\t\t\"

Compiler

\",\n\t\t\t\"
\",\n\t\t\t\"\",\n\t\t\t\"
\",\n\t\t\t\"
\",\n\t\t\t{\n\t\t\t\t\"rowCss\": \"my-row pt15 fs90 fr\"\n\t\t\t},\n\t\t\t[\"\",\n\t\t\t\t\"btn#btn-apply.green.mr5\",\n\t\t\t\t{\n\t\t\t\t\t\"val\": \"Remember mode\"\n\t\t\t\t},\n\t\t\t\t\"btn#btn-cancel\",\n\t\t\t\t{\n\t\t\t\t\t\"val\": \"Cancel\"\n\t\t\t\t}],\n\t\t\t\"
\"]\n\t},\n\t\"Preview\": {\n\t\t\"id\": \"cw.Manifesto.Preview\",\n\t\t\"init\": function ($o,form) {\n\n\t\tvar d=form.data, \n\t\t\t\tp = d._opts, \n\t\t\t\tm = d._src,\n\t\t\t\tpi = $.Deferred();\n\t\t\n\t\ttry {\n\t\t\tthis.Manifest = $.extend({db:d._db},(d._prefix||{}),eval(d._src));\n\t\t\t$.extend(!0, this.Manifest, d._subs());\n\t\t} catch (err){\n\t\t\tconsole.log(err, err.stack)\n\t\t\tpi.reject(err);\n\t\t}\n\n\t\t\n\t\t$o.html(\n\t\t\t'
×
'\n\t\t\t+'
'\n\t\t);\n\t\tpi.resolve();\n\t\t\n\t\treturn pi.promise();\n\t\n\t\t\t},\n\t\t\"data\": {\n\t\t\t\"_runtime\": {\n\t\t\t}\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#btn-close\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (null!=v) {\t\t\t\t\t\n\t\t\t\t\tif (/^(full|modal)/.test(d._opts.runMode+\"\")) {\n\t\t\t\t\t\t$o.trigger(\"cancel\");\n\t\t\t\t\t} \n\t\t\t\t}\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\">div:eq(1)\": {\n\t\t\t\t\"bind\": \"_runtime\",\n\t\t\t\t\"manifest\": \"Manifest\"\n\t\t\t}\n\t\t},\n\t\t\"style\": {\n\t\t\t\">#btn-close\": \"position:absolute;top:0;right:0;cursor:pointer;z-index:+100;font-size:50px;line-height:1em; padding:0 10px;transition:color 0.3s; color:rgba(0,0,0,0.2);\",\n\t\t\t\">#btn-close:hover\": \"color:#c02\"\n\t\t}\n\t},\n\t\"Types\": {\n\t\t\"html\": {\n\t\t\t\"css\": \"fi-html5\",\n\t\t\t\"compile\": null,\n\t\t\t\"CM\": {\n\t\t\t\t\"mode\": \"htmlmixed\",\n\t\t\t\t\"theme\": \"base16-light\"\n\t\t\t}\n\t\t},\n\t\t\"text\": {\n\t\t\t\"compile\": null,\n\t\t\t\"CM\": {\n\t\t\t\t\"mode\": \"\"\n\t\t\t}\n\t\t},\n\t\t\"js\": {\n\t\t\t\"compile\": function (s) {\n\n\t\t\tvar err=[], res = null;\n\t\t\ttry {\n\t\t\t\t// Eval is unsafe and resource-consuming\n\t\t\t\t//res = eval(s);\n\t\t\t\t\n\t\t\t\t// More safe way\n\t\t\t\tres = (new Function (\"\", \"return (\"+s+\");\"))();\n\n\t\t\t} catch (e) {\n\t\t\t\terr.push(e.message+\".\");\n\t\t\t}\n\t\t\treturn err.length?[err, undefined]:[err,res];\n\t\t\n\t\t\t\t},\n\t\t\t\"CM\": {\n\t\t\t\t\"mode\": \"javascript\"\n\t\t\t}\n\t\t},\n\t\t\"css\": {\n\t\t\t\"css\": \"fi-css3\",\n\t\t\t\"compile\": function (css) {\n\n\t\t\tvar err=[], res=\"\";\n\t\t\tres = ((css+\"\")\n\t\t\t.replace(/\\/\\*[\\s\\S]+?\\*\\//gm,\"\")\n\t\t\t.replace(/@charset[^;]+?;/gim,'')\n\t\t\t.replace(/[\\n\\t\\s]+/g,' ')\n\t\t\t.replace(/\\}/g,'}⊻')\n\t\t\t.replace(/^\\n+/g,\"\").replace(/[\\n\\s]+$/g,\"\")\n\t\t\t.split('⊻')\n\t\t\t.compact(true)\n\t\t\t.reduce(function(a,b){\n\t\t\t\tvar t = b.trim(), p, k, v;\n\t\t\t\tif (/^[^{]+\\{[^\\}]+\\}$/.test(t)) {\n\t\t\t\t\tp = t.to(-1).split(\"{\");\n\t\t\t\t\tk = \" \"+p[0].trim();\n\t\t\t\t\tv = p[1].trim();\n\t\t\t\t\tif (v.last()!=\";\") v+=\";\";\n\t\t\t\t\tif (!a[k]) a[k]=\"\";\n\t\t\t\t\ta[k]+=v;\n\t\t\t\t} else {\n\t\t\t\t\terr.push(\"Invalid rule \"+t.truncate(40));\n\t\t\t\t}\n\t\t\t\treturn a;\n\t\t\t},{}));\n\t\t\treturn [err, res];\n\t\t\n\t\t\t\t},\n\t\t\t\"CM\": {\n\t\t\t\t\"mode\": \"css\",\n\t\t\t\t\"theme\": \"base16-light\"\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": {\n\t\t\"\": \"width:100%;\",\n\t\t\" .violet\": \"color:rgb(109, 37, 179);\",\n\t\t\" .o0\": \"opacity:0;\",\n\t\t\" .w00\": \"width:0!important;margin-right:0!important;overflow:hidden;white-space: nowrap;\",\n\t\t\" .fold\": \"font-family:'PT Mono',Monaco,monospace; font-size:70%;font-weight:bold;letter-spacing:-1px;opacity:0.7;text-shadow:0 1px 3px white;cursor:pointer; display: inline-block;vertical-align: top; margin-top: -2px;\",\n\t\t\" .CodeMirror\": \"font:13px 'PT Mono',Monaco,monospace;line-height:1.4em;\",\n\t\t\" button:focus\": \"outline:none;\",\n\t\t\" .itl\": \"font-style:italic;\",\n\t\t\" .itl:after\": \"content:\\\"*\\\";font-style:normal;margin-left:1px;\",\n\t\t\" #coms\": {\n\t\t\t\"\": \"float: left;margin-bottom: 15px;max-width: 85%;\",\n\t\t\t\" .tab\": \"margin-right:2px;\",\n\t\t\t\" #xtitle\": \"padding:4px 7px; cursor:move; border-radius:2px; transition: color 0.2s, background-color 0.2s, opacity 0.2s;\",\n\t\t\t\" .haserror\": \"color:#FF2A4D!important;\",\n\t\t\t\" #title\": \"cursor:pointer;\",\n\t\t\t\" .active\": \"background-color:rgba(220,220,220, 0.5);color:#505560;\",\n\t\t\t\" .active.haserror\": \"color:white!important;background-color:#EE637A!important;\",\n\t\t\t\" .ctype\": \"font-size:80%; opacity:0.7; display:block;position:absolute;top:-8px;right:-5px;\"\n\t\t},\n\t\t\" .tab\": {\n\t\t\t\"\": \"transition: color 0.2s, background-color 0.15s;background-color:rgba(255,255,255,0);\"\n\t\t},\n\t\t\" #eds\": {\n\t\t\t\"\": \"border:1px solid #ddd; margin-top:10px;border-radius:2px\",\n\t\t\t\">xdiv\": \"height:0;overflow:hidden;\",\n\t\t\t\">xdiv:first-child\": \"height:auto;\",\n\t\t\t\" .CodeMirror-linenumbers\": \"transition: background-color 0.3s\",\n\t\t\t\" .ed-error .CodeMirror-linenumbers\": \"background-color:rgba(255, 200, 200, 0.75)\"\n\t\t},\n\t\t\" #cmd\": {\n\t\t\t\" .button\": \"margin:0 0 0 2px; border-radius:0; padding: 5px 8px;\",\n\t\t\t\" .btnl\": \"border-radius: 4px 0 0 4px;\",\n\t\t\t\" .btnr\": \"border-radius: 0 4px 4px 0;\"\n\t\t}\n\t}\n}", "parser": "(function (item, atts){\n\tvar z = eval('('+ item.data+')');\n\t\n\tz.app.name = \"List\";\n\t\n\treturn cw.lib.js2txt(z,'\\t');\n})", "parserActive": false, "Uglify": false, "external": "pouch://cw-Manifest-Editor-4vx1 manifest", "noIncludes": true, "state": { "savedSdbm": "-2mo8qln", "sdbm": "-2mo8qln", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "19ip3zjf", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Sys.Trust", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"id\": \"cw.Sys.Trust\",\n\t\"init\": function ($o) {\n\n\t\t$o.formgen([\n\t\t '

Confirm trust

',\n\t\t\t{label:\"70px\", row:\"350px\", rowCss:\"my-row mt10 fs80 xgray\"},\n\t\t\t['', '

These app components are untrusted or were changed since last used:

'],\n\t\t\t['','div#list.lh140'],\n\t\t\t{rowCss:\"my-row mt20 pt15 fs80 xgray btd\"},\n\t\t\t['', 'btn#btn-ok.green.mr5',{val:\"Trust this version\"}, \n\t\t\t\t'btn#btn-all.green.mr5',{val:\"Trust forever\"},\n\t\t\t\t'btn#btn-cancel',{val:\"Stop\"}]\n\t\t]);\n\t\n\t\t},\n\t\"params\": {\n\t\t\"delay\": 5,\n\t\t\"width\": 350\n\t},\n\t\"data\": {\n\t\t\"trust\": []\n\t},\n\t\"ui\": {\n\t\t\"#list\": function (d) {\n\n\t\t\tvar i=0, html=\"\";\n\t\t\tfor (i;i';\n\t\t\t}\n\t\t\treturn html; \n\t\t\n\t\t\t},\n\t\t\"#btn-ok\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\t$o.trigger(\"commit\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click\"\n\t\t},\n\t\t\"#btn-cancel\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\t$o.trigger(\"cancel\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click\"\n\t\t},\n\t\t\"#btn-all\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\tfor (var i=0;i'+d.text+'',\n\t\t\t{label:\"70px\", row:\"350px\", rowCss:\"my-row mt15 pt15 fs90 mb-5 xgray btd\"},\n\t\t\t['', 'spn#btn-ok.mr5.button.green',{txt:d.ok}, \n\t\t\t\t'span#btn-cancel.button',{txt:d.cancel}]\n\t\t]);\n\t\n\t\t},\n\t\"params\": {\n\t\t\"delay\": 5,\n\t\t\"width\": 350\n\t},\n\t\"data\": {\n\t\t\"text\": \"\",\n\t\t\"css\": \"xgray\",\n\t\t\"ok\": \"Ok\",\n\t\t\"cancel\": \"Cancel\",\n\t\t\"cmd\": \"\"\n\t},\n\t\"ui\": {\n\t\t\"#btn-ok\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\td.cmd=\"commit\";\n\t\t\t\t\t$o.trigger(\"commit\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\"\n\t\t},\n\t\t\"#btn-cancel\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\td.cmd=\"cancel\";\n\t\t\t\t\t$o.trigger(\"cancel\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\"\n\t\t}\n\t}\n}", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "Uglify": false, "noIncludes": true, "external": "pouch://cw-Sys-Confirm-4vx1 manifest", "state": { "savedSdbm": "2qfesd3l", "sdbm": "2qfesd3l", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "15q63gpp", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Sys.YesNoCancel", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"id\": \"cw.Sys.YesNoCancel\",\n\t\"init\": function ($o,form) {\n\n\t\tvar d=form.data;\n\t\t$o.formgen([\n\t\t '
'+d.text+'
',\n\t\t\t{label:\"70px\", row:\"450px\", rowCss:\"my-row mt15 pt15 fs90 mb-5 xgray btd\"},\n\t\t\t['', 'spn#btn-yes.button.green.mr5',{txt:d.yes}, \n\t\t\t \t'spn#btn-no.button.mr5',{txt:d.no}, \n\t\t\t\t'spn#btn-cancel.button.fr',{txt:d.cancel}]\n\t\t]);\n\t\n\t\t},\n\t\"build\": 6,\n\t\"params\": {\n\t\t\"delay\": 5,\n\t\t\"width\": 450\n\t},\n\t\"data\": {\n\t\t\"text\": \"\",\n\t\t\"css\": \"xgray\",\n\t\t\"yes\": \"Yes\",\n\t\t\"no\": \"No\",\n\t\t\"cancel\": \"Cancel\",\n\t\t\"cmd\": \"\"\n\t},\n\t\"ui\": {\n\t\t\"#btn-yes\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\td.cmd=\"yes\";\n\t\t\t\t\t$o.trigger(\"commit\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\",\n\t\t\t\"css\": {\n\t\t\t\t\"self:hide\": function (d) {\n\t\t\t\t\t return !d.yes\n\t\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"#btn-no\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\td.cmd=\"no\";\n\t\t\t\t\t$o.trigger(\"commit\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\",\n\t\t\t\"css\": {\n\t\t\t\t\"self:hide\": function (d) {\n\t\t\t\t\t return !d.no\n\t\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"#btn-cancel\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\td.cmd=\"cancel\";\n\t\t\t\t\t$o.trigger(\"cancel\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\",\n\t\t\t\"css\": {\n\t\t\t\t\"self:hide\": function (d) {\n\t\t\t\t\t return !d.cancel\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "Uglify": false, "noIncludes": true, "external": "pouch://cw-Sys-YesNoCancel-4vx1 manifest", "state": { "savedSdbm": "2o8iregq", "sdbm": "2o8iregq", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "193wxfzg", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Sys.Cropper.Square", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"id\": \"cw.Sys.Cropper.Square\",\n\t\"init\": function ($o,form) {\n\n\t\tvar html = $.my.formgen([\n\t\t'
',\n\t\t \t\t\t'',\n\t\t \t\t\t'
',\n\t\t \t\t\t\t'',\n\t\t \t\t\t\t\t'  Select Image',\n\t\t \t\t\t\t'',\n\t \t\t'',\n\t \t'
',\n\t\t \t\t'
',\n\t\t \t\t'
',\n\t\t \t\t\t'',\n\t\t \t\t\t{row:\"200px\",rowCss:\"mt10 pt15 btd fs90 tac\"},\n\t\t \t\t[\"\",\"btn#btn-apply.mr5.green\",{val:\"Apply\"}, \"btn#btn-close.mr0\",{val:\"Cancel\"}],\n\t\t \t\t'
',\n\t\t \t\t'
',\n\t\t \t\t\t\n\t\t \t\t'
',\n\t\t \t\t'
'\n\t\t]);\n\t\t$o.html(html);\n\t\n\t\t},\n\t\"params\": {\n\t\t\"width\": 820\n\t},\n\t\"data\": {\n\t\t\"filename\": \"\",\n\t\t\"data\": \"\",\n\t\t\"cropped\": false,\n\t\t\"size\": 200\n\t},\n\t\"style\": {\n\t\t\" .jcrop-holder\": \"display:inline-block;vertical-align:middle\"\n\t},\n\t\"ui\": {\n\t\t\"#file\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\n\t\tvar f,\n\t\t\t\t$r = $o.my().root,\n\t\t\t\t$c = $r.find(\"#preview\"),\n\t\t\t\t$img = $r.find(\"#source\"),\n\t\t\t\t$c2 = $r.find(\"#x2\"),\n\t\t\t\tn={k:1}, img=\"\";\n\n\n\t\tif (v!=null && v) {\n\t\t\tf = $o[0].files[0];\n\t\t\tif (f) (function(){\n\t\t\t\td.filename = f.name;\n\n\t\t\t\tvar fr = new FileReader(), ri, sb64 = [];\n\t\t\t\tfr.onload=function(e){\n\t\t\t\t\tri = new Uint8Array(e.target.result);\n\t\t\t\t\tfor (var i=0; i 0) {\n\t\t\t\t// Show image preview\n\t\t\t\tvar img = $img[0], cs, ctx, cs2, ctx2, \n\t\t\t\t\t\tk = n.k,\n\t\t\t\t\t\tw = c.w*k; //width to scale in 200px\n\t\t\t\tif (w>d.size*2) {\n\t\t\t\t\t// double downsample to remove\n\t\t\t\t\t// bilinear-scaler artifacts\n\t\t\t\t\tcs2 = $c2[0];\n\t\t\t\t\tctx2 = cs2.getContext(\"2d\");\n\t\t\t\t\tctx2.fillStyle=\"white\";\n\t\t\t\t\tctx2.fillRect(0,0,d.size*2, d.size*2);\n\t\t\t\t\tctx2.drawImage(img, c.x*k, c.y*k, w, w, 0, 0, d.size*2, d.size*2);\n\t\t\t\t\tcs = $c[0];\n\t\t\t\t\tctx = cs.getContext(\"2d\");\n\t\t\t\t\tctx.drawImage(cs2, 0, 0, d.size*2, d.size*2, 0, 0, d.size, d.size);\n\t\t\t\t} else {\n\t\t\t\t\tcs = $c[0];\n\t\t\t\t\tctx = cs.getContext(\"2d\");\n\t\t\t\t\tctx.fillStyle=\"white\";\n\t\t\t\t\tctx.fillRect(0,0,d.size, d.size);\n\t\t\t\t\tctx.drawImage(img, c.x*k, c.y*k, w, w, 0, 0, d.size, d.size);\n\t\t\t\t}\n\t\t\t\td.cropped=true;\n\t\t\t}\n\t\t}\n\t\n\t\t\t\t}\n\t\t},\n\t\t\"#btn-apply\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null && d.cropped) {\n\t\t\t\t\td.data = $o.my().root.find(\"#preview\")[0]\n\t\t\t\t\t\t.toDataURL('image/jpeg',0.95)\n\t\t\t\t\t\t.substr(23);\n\t\t\t\t\t$o.my().root.trigger(\"commit\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\"\n\t\t},\n\t\t\"#btn-close\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\t\t\t\tif (v!=null) $o.my().root.trigger(\"cancel\");\n\t\t\t\t},\n\t\t\t\"events\": \"click.my\"\n\t\t}\n\t}\n}", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "Uglify": false, "noIncludes": true, "external": "pouch://cw-Sys-Cropper-Square-4vx1 manifest", "state": { "savedSdbm": "1vtwlnuq", "sdbm": "1vtwlnuq", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "1bvzcpmv", "type": "js", "snippet": true, "folder": "-sys", "name": "cw.Sys.Attachments", "ext": "js", "mime": "text/javascript", "desc": "", "data": "{\n\t\"id\": \"cw.Sys.Attachments\",\n\t\"build\": 6,\n\t\"init\": function ($o,form) {\n\n\t\tvar that=this,\n\t\t\td = form.data;\n\t\t$o.addClass(d.css);\n\t\t\n\t\t//preload\n\t\t$o.html(\n\t\t\t'
'\n\t\t\t+'
'\n\t\t\t+'
'\n\t\t\t\t+''\n\t\t\t\t+''\n\t\t\t+'
'\n\t\t);\n\t\t$o.on(\"click\",\".cw-att-dl\", function(){\n\t\t\tvar fname =$(this).data(\"fname\"), \n\t\t\t\ttext = $(this).attr(\"title\"),\n\t\t\t\toatt;\n\t\t\t\n\t\t\tif (d.doc._attachments && d.doc._attachments[fname] && !d.doc._attachments[fname].stub) {\n\t\t\t\tvar att = {}; \n\t\t\t\tatt[fname] = d.doc._attachments[fname];\n\t\t\t\tif (null != att[fname].data) processAtt(fname, att);\n\t\t\t} else {\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\toatt = cw.db(d.doc._db).att(d.doc._id);\n\t\t\t\t} catch (e) {}\n\t\t\t\tif (oatt) oatt.url(fname).then(processAtt.fill(fname));\n\t\t\t} \n\t\t});\n\t\t\n\t\tfunction processAtt (fname, att){\n\t\t\tvar o, html=\"\", width=450, file, \n\t\t\t\tmod = Object.clone(that.ModalManageAtt, true);\n\t\t\tif (Object.size(att)) {\n\t\t\t\to = att[Object.keys(att)[0]];\n\t\t\t\tfile = o.url||(\"data:\"+o.content_type+\";base64,\"+o.data);\n\t\t\t\t\n\t\t\t\tif (/^image/.test(o.content_type)) width=800;\n\t\t\t\t$.my.modal({manifest:mod, data:{\n\t\t\t\t\tname:fname,\n\t\t\t\t\tsize:o.size,\n\t\t\t\t\tdigest:o.digest,\n\t\t\t\t\turl:file,\n\t\t\t\t\tmime:o.content_type\n\t\t\t\t}, width:width, esc:true}).then(function(res){\n\t\t\t\t\tif (Object.isObject(res)) {\n\t\t\t\t\t\tif (res.cmd===\"delete\") {\n\t\t\t\t\t\t\tdelete d.doc._attachments[fname];\n\t\t\t\t\t\t\t$o.find(\"#att-fpanel\").trigger(\"redraw\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} \n\t\t}\n\t\n\t\t},\n\t\"Unfold\": function (A,elt,doc) {\n\n\t\tvar r;\n\t\ttry {\n\t\t\tif (Object.isFunction(A)) r = A(elt, elt.name, doc);\n\t\t\telse if (typeof A === \"string\") r=A;\n\t\t} catch(e) {}\n\t\treturn r;\n\t\n\t\t},\n\t\"params\": {\n\t\t\"width\": 400\n\t},\n\t\"data\": {\n\t\t\"sort\": function (fobj,fname,doc) {\n\t\t\t return fname; \n\t\t\t},\n\t\t\"width\": 200,\n\t\t\"truncate\": 200,\n\t\t\"limit\": 10000000,\n\t\t\"ico\": function (fobj,fname) {\n\n\t\tvar css=\"fi-paperclip\",\n\t\t\t\ttypes={\n\t\t\t\t\t\"fi-photo\":/\\.(png|jp[e]?g|gif|tif[f]?|bmp)$/i,\n\t\t\t\t\t\"fi-social-adobe\":/\\.(pdf|ai|psd)$/i,\n\t\t\t\t\t\"fi-page-doc\":/\\.(doc[x]?|txt|rtf)$/i,\n\t\t\t\t\t\"fi-graph-pie\":/\\.(xls[x]?|csv)$/i,\n\t\t\t\t\t\"fi-archive\":/\\.(zip|rar|7z|7zip)$/i,\n\t\t\t\t\t\"fi-html5 pl2\":/\\.(htm[l]|php)$/i,\n\t\t\t\t\t\"fi-css3 pl2\":/\\.css$/i,\n\t\t\t\t\t\"fi-widget\":/\\.(js[on]?|php|asp|jar|c|erl)$/i,\n\t\t\t\t\t\"fi-sound\":/\\.(wav|aiff|mp3|ogg|mpeg3)$/i\n\t\t\t\t};\n\t\tif (!fobj.digest) css=\"orange fi-burst-new\";\n\t\telse Object.each(types, function(key, re){\n\t\t\tif (re.test(fname)) css=key;\n\t\t});\n\t\treturn '';\n\t\n\t\t\t},\n\t\t\"aux\": function (fobj,fname,doc) {\n\n\t\treturn \"\";\n\t\n\t\t\t},\n\t\t\"css\": \"cw-att-files\",\n\t\t\"itemCss\": \"cw-att-item hoverlink\",\n\t\t\"download\": function (fobj,fname,doc) {\n\t\t\t return \"Manage \"+fname; \n\t\t\t},\n\t\t\"upload\": \"Upload file...\",\n\t\t\"accept\": \"\",\n\t\t\"doc\": {\n\t\t},\n\t\t\"files\": []\n\t},\n\t\"Attachment\": {\n\t\t\"init\": function ($o,form) {\n\n\t\tvar d = form.data;\n\t\t$o.html(\n\t\t\td.ico\n\t\t\t+'
'\n\t\t\t+'
'\n\t\t\t+(d.dl?'':\"\")\n\t\t\t+''\n\t\t\t+''\n\t\t\t+(d.dl?'':\"\")\n\t\t\t+'
'\n\t\t\t+(d.aux?'
'+d.aux+'
':\"\")\n\t\t\t+'
'\n\t\t);\n\t\n\t\t\t},\n\t\t\"data\": {\n\t\t\t\"name\": \"\",\n\t\t\t\"title\": \"\",\n\t\t\t\"ext\": \"\",\n\t\t\t\"ico\": \"\",\n\t\t\t\"aux\": \"\",\n\t\t\t\"dl\": \"\"\n\t\t},\n\t\t\"ui\": {\n\t\t\t\".cw-att-fname\": \"title\",\n\t\t\t\".cw-att-ext\": \"ext\"\n\t\t}\n\t},\n\t\"ModalManageAtt\": {\n\t\t\"init\": function ($o,form) {\n\n\t\tvar html=\"\", d=form.data, size = +(d.size || d.length || 0);\n\t\tif (/^image/.test(d.mime)) {\n\t\t\thtml+='
'\n\t\t\t+''\n\t\t\t+'
';\n\t\t}\n\t\thtml+= '
'+d.name+'
';\n\t\thtml+= '
'\n\t\t+size.format(0,' ')+' byte'+(/(^1|[02-9]1)$/.test(size+\"\")?'':'s')\n\t\t+(!d.digest?\", not yet saved to DB\":\"\")\n\t\t+'
';\n\t\thtml+= '
'\n\t\t+' Download'\n\t\t+(/.+\\.(jp[e]?g|png|tif[f]?|pdf|txt|js|css|htm[l])$/i.test(d.name)?\n\t\t\t' Open':\"\")\n\n\t\t+ ' Delete'\n\t\t+ '
Cancel
'\n\n\t\t+'
';\n\n\t\t$o.html(html);\n\t\t$o.on(\"click\",\"a\", function (){\n\t\t\t(function(){$o.trigger(\"cancel\");}).delay(100);\n\t\t})\n\t\n\t\t\t},\n\t\t\"data\": {\n\t\t\t\"name\": \"\",\n\t\t\t\"size\": \"\",\n\t\t\t\"url\": \"\",\n\t\t\t\"mime\": \"\",\n\t\t\t\"cmd\": \"\"\n\t\t},\n\t\t\"ui\": {\n\t\t\t\"#btn-cancel\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\t\t\t\t\tif (v!=null) $o.trigger(\"cancel\")\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t},\n\t\t\t\"#btn-del\": {\n\t\t\t\t\"bind\": function (d,v,$o) {\n\n\t\t\t\tif (v!=null) {\n\t\t\t\t\td.cmd=\"delete\";\n\t\t\t\t\t$o.trigger(\"commit\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\"events\": \"click.my\"\n\t\t\t}\n\t\t}\n\t},\n\t\"ui\": {\n\t\t\"#att-fpanel\": function (d,v,$o) {\n\n\t\tvar i,j,k,\n\t\t\t\ta=d.doc._attachments,\n\t\t\t\tao=[],\n\t\t\t\t_unfold = this.Unfold;\n\t\tif (/*v!=null && */a && Object.size(a)) {\n\t\t\t//build flist\n\t\t\tfor (i in a) ao.push(Object.merge({\n\t\t\t\tname:i\n\t\t\t},a[i]));\n\t\t\tao=ao.filter(function(elt, idx){\n\t\t\t\tvar ok=true;\n\t\t\t\ttry{\n\t\t\t\t\tif (Object.isFunction(d.sort)) {\n\t\t\t\t\t\tok = !!d.sort(elt, elt.name, d.doc);\n\t\t\t\t\t}\n\t\t\t\t\telse if (Object.isRegExp(d.sort)) {\n\t\t\t\t\t\tok = d.sort.test(elt.name);\n\t\t\t\t\t}\n\t\t\t\t} catch (e){}\n\t\t\t\treturn ok;\n\t\t\t}).sortBy(function(elt,idx){\n\t\t\t\tvar ok=elt.fname;\n\t\t\t\tif (Object.isFunction(d.sort)) {\n\t\t\t\t\ttry{ok = d.sort(elt, elt.name, d.doc);} \n\t\t\t\t\tcatch (e){}\n\t\t\t\t}\n\t\t\t\treturn ok;\n\t\t\t});\n\t\t\td.files=ao.map(function(elt, idx) {\n\t\t\t\tvar o = {\n\t\t\t\t\tname:elt.name,\n\t\t\t\t\text:(elt.name.match(/\\.[^\\.]+$/)||[\"\"])[0],\n\t\t\t\t\taux:\t_unfold (d.aux, elt, d.doc),\n\t\t\t\t\tico:\t_unfold (d.ico, elt, d.doc),\n\t\t\t\t\tdl:\t\t_unfold (d.download, elt, d.doc)\n\t\t\t\t};\n\t\t\t\to.title = (elt.name.match(/(.+)(?:\\.[^\\.]+$)/)||[0,elt.name])[1]\n\t\t\t\t.truncate(d.truncate-o.ext.length,\"middle\");\n\t\t\t\treturn null===o.data?null:o;\n\t\t\t}).compact();\n\n\t\t} else d.files=[];\n\t\t$o.my(\"find\", \"#att-flist\").trigger(\"redraw\");\n\t\n\t\t\t},\n\t\t\".cw-att-upload\": \"upload\",\n\t\t\"#att-flist\": {\n\t\t\t\"bind\": \"files\",\n\t\t\t\"check\": true,\n\t\t\t\"manifest\": \"Attachment\",\n\t\t\t\"list\": \"
\"\n\t\t},\n\t\t\"#upload\": {\n\t\t\t\"bind\": function (d,v,$o) {\n\n\t\tvar f, a={}, data;\n\t\tif (v!=null && v) {\n\t\t\tf = $o[0].files[0];\n\t\t\tif (f.size>d.limit){\n\t\t\t\tcw.note(\"Max upload file size is \"+(d.limit*1).abbr(1)+\"b\",\"error\");\n\t\t\t\t$o.wrap('
').closest('form').get(0).reset();\n\t\t\t}\n\t\t\telse if (f) (function(){\n\t\t\t\ta.content_type = f.type||\"application/octet-stream\";\n\t\t\t\tvar fr = new FileReader(), ri, sb64 = [];\n\t\t\t\tfr.onload=function(e){\n\t\t\t\t\tri = new Uint8Array(e.target.result);\n\t\t\t\t\tfor (var i=0; i').closest('form').get(0).reset();\n\t\t\t\t\t$o.my(\"find\", \"#att-fpanel\").trigger(\"redraw\")\n\t\t\t\t};\n\t\t\t\tfr.readAsArrayBuffer(f);\t\n\t\t\t})();\n\t\t}\n\t\n\t\t\t\t},\n\t\t\t\"css\": {\n\t\t\t\t\"hide\": function (d) {\n\t\t\t\t\treturn !d.upload\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": {\n\t\t\" .cw-att-item\": \"white-space:nowrap; overflow:hidden; padding:0.2em 0 0.2em 0; line-height:1.4em;\",\n\t\t\" input[type=file]\": \"width:100%;cursor:pointer;opacity:0; position:absolute;top:0;left:0;height:1.5em\"\n\t}\n}", "parser": "// Parser receives (item, _attachments)\n// and must return string representation of item\n(function (item, atts){\n\n\treturn item.data+\"\";\n})", "parserActive": false, "Uglify": false, "external": "pouch://cw-Sys-Attachments-4vx1 manifest", "noIncludes": true, "state": { "savedSdbm": "-1axy0vjn", "sdbm": "-1axy0vjn", "impacts": { "cw.sys.js": true, "js/sys.js": true, "sys/apps.js": true }, "depends": {} }, "cache": [ "86400" ] }, { "id": "18k14mz7", "type": "js", "snippet": false, "folder": "sys", "name": "crypto", "ext": "js", "mime": "text/javascript", "desc": "CloudWall Cryptoprovider 0.9", "data": "/**\n * CloudWall 1.8.1 crypto lib and settings sandbox\n * Created by ermouth 2015-08-02\n */\nif (!(\"cw\" in window)) window.cw={};\n\n\n// #### START LOG ####\n\nif (!cw.log) (function _logstart(){\n\tvar f = {/*{{-cw/log.js}}*/};\n\ttry { f(); } catch(e) {};\n\tif (!Object.isFunction(cw.log)) cw.log = console.log.bind(console);\n})();\n\n\n// #### START CRYPTO ####\n\nif (!cw.crypto) cw.crypto = (function() {\n\n\tvar Pouch = window.PouchDB,\n\t\t\tisA = Object.isArray, isB = Object.isBoolean, isS = Object.isString, isO = Object.isObject,\n\t\t\tisN = Object.isNumber, isR = Object.isRegExp, isF = Object.isFunction;\n\n\tvar C, S, S0, PIN, PIN2, D0={}, D={}, me={}, \n\t\t\tfields = \"type crypto stamp creator name pic tags _id _rev _attachments\".split(' '),\n\t\t\tfields1 = fields.slice(0).add('_attachments'),\n\t\t\tCR = 'CRYPTO',\n\t\t\tkeys = {},\n\t\t\tkeysTtl = 0;\n\n\tfunction _pi(){return $.Deferred();}\n\t\n\t\n\t//=======================================\n\n\tvar encode = function(doc) {\n\t\tif(!doc || !Object.isObject(doc)) return doc;\n\t\tvar key, toEnc, resDoc;\n\n\n\t\tif (doc.crypto) key = getKeys(doc.crypto), key=key?key.key:null;\n\t\tif (!key && doc._id===\"cw\" && doc.type===\"settings\") {\n\t\t\tkey=doc.pin;\n\t\t\tif(key && !PIN) PIN=key;\n\t\t}\n\n\t\tif(key) {\n\t\t\tresDoc = Object.select(doc, fields);\n\t\t\tresDoc.CRYPTO = cw.lib.encDoc(Object.reject(doc, fields), key);\n\t\t\t//TODO: enc attachments\n\t\t\treturn resDoc;\n\t\t}\n\t\treturn doc;\n\t};\n\t\n\t\n\t//=======================================\n\n\tvar decode = function(doc, pin) {\n\t\tif(!Object.isObject(doc)) return doc;\n\t\tvar key, decoded, resDoc;\n\n\t\tif(doc.hasOwnProperty(CR)) {\n\t\t\tif (doc.crypto) key = getKeys(doc.crypto), key=key?key.key:null;\n\t\t\tif (!key && doc._id===\"cw\") key=pin;\n\t\t}\n\n\t\tif(key) {\n\t\t\ttry {\n\t\t\t\tdecoded = cw.lib.decDoc(doc.CRYPTO, key);\n\t\t\t\tresDoc = Object.reject(Object.merge(Object.clone(doc,true), decoded), CR);\n\t\t\t} catch (e) {\n\t\t\t\treturn doc;\n\t\t\t}\n\t\t\t//doc.CRYPTO=\"\";\n\t\t\treturn resDoc;\n\t\t}\n\t\treturn doc;\n\t};\n\t\n\t//=======================================\n\n\tvar decodeAtt = function(dataBlob, keyId) {\n\t\tif(!dataBlob || !keyId) return dataBlob;\n\t\tvar key;\n\t\tif((key = getKeys(keyId)) && (key = key.key)) {\n\t\t\tvar dataBase64 = cw.lib.blob2base64(dataBlob),\n\t\t\t\t\tresBase64 = cw.lib.base64(btoa(cw.lib.dec(dataBase64, key).from(1)), true);\n\t\t\treturn cw.lib.base642blob(resBase64);\n\t\t}\n\t\treturn dataBlob;\n\t};\n\t\n\t\n\t//=======================================\n\n\tvar getKeys = function(keyId) {\n\t\tif (keys[keyId]) return keys[keyId];\n\t\tkeys={};\n\t\tvar xkeys=S?S.keys:[];\n\t\tfor (var i=0;i'\n\t\t\t\t\t\t+' DB removal requested. Please '\n\t\t\t\t\t\t+'close all other tabs and browsers with CloudWall opened. Removing DB '\n\t\t\t\t\t\t+'on this machine does not remove it on linked machines’ accounts.'\n\t\t\t\t\t\t+' When DB purge finishes, tab reloads.'\n\t\t\t\t\t\t+'',\n\t\t\t\t\t\tok:\"Remove DB\"\n\t\t\t\t\t}\n\t\t\t\t}).then(function(res){\n\t\t\t\t\tvar dbsnew=[];\n\t\t\t\t\tif (isO(res) && res.cmd == \"commit\") {\n\t\t\t\t\t\tfor (var i=0;i'\n\t\t\t\t\t\t+' DB forced sync requested. '\n\t\t\t\t\t\t+'It can take some time, but you can continue working during process. '\n\t\t\t\t\t\t+' When replication finish you’ll see notification.'\n\t\t\t\t\t\t+'',\n\t\t\t\t\t\tok:\"Force replication\"\n\t\t\t\t\t}\n\t\t\t\t}).then(function(res){\n\t\t\t\t\t\n\t\t\t\t\tvar cd = D0[d.name], dbsnew=[], ptr=0;\n\t\t\t\t\tif (isO(res) && res.cmd == \"commit\") {\n\t\t\t\t\t\tfor (var i=0;i'\n\t\t\t\t\t\t+' DB resync requested. All '\n\t\t\t\t\t\t+'content of current DB will be discarded on on this machine. '\n\t\t\t\t\t\t+' Operation does not remove it on linked machines’ accounts.'\n\t\t\t\t\t\t+' When process is finished, tab reloads.'\n\t\t\t\t\t\t+'',\n\t\t\t\t\t\tok:\"Clean and resync DB\"\n\t\t\t\t\t}\n\t\t\t\t}).then(function(res){\n\t\t\t\t\tvar dbsnew=[];\n\t\t\t\t\tif (isO(res) && res.cmd == \"commit\") {\n\t\t\t\t\t\t\n\t\t\t\t\t\tcw.log(\"Starting ‘\"+d.name+\"’ destroy+resync.\");\n\n\t\t\t\t\t\tvar cd = D0[d.name];\n\t\t\t\t\t\tfor (i=0;i',\n\t\t\t\t\t\t\t['',''],\n\t\t\t\t\t\t\t['', 'btn#btn-ok.fs110.pl30.pr30.mb10',{val:\"Log in\", style:\"border-radius:100px\"}]\n\t\t\t\t\t\t]);\n\t\t\t\t\t\t$o.find(\"#pin\").keydown(function(e){\n\t\t\t\t\t\t\tif(e.keyCode==13) cw.debug=false, $o.trigger(\"commit.my\");\n\t\t\t\t\t\t\tif(e.keyCode==9) e.preventDefault(), cw.debug=true, $o.trigger(\"commit.my\");\n\t\t\t\t\t\t})/*.trigger(\"focus\")*/;\n\t\t\t\t\t},\n\t\t\t\t\tui:{\n\t\t\t\t\t\t\"#pin\":\"pin\",\n\t\t\t\t\t\t\"#btn-ok\": {\n\t\t\t\t\t\t\tbind: function(d,v,$o){\n\t\t\t\t\t\t\t\tif (v!=null) $o.trigger(\"commit.my\");\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tevents:\"click.my\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\twidth:350,\n\t\t\t\tesc:true\n\t\t\t})\n\t\t\t.always(function(res){\t\n\t\t\t\tif (isO(res)) {\n\t\t\t\t\tPIN=_pin(res.pin);\n\t\t\t\t\tPIN2=_pin2(res.pin, doc.name);\n\t\t\t\t\t_decSettings (doc);\t\n\t\t\t\t} else pi.reject(\"No PIN provided to decrypt settings\")\n\t\t\t});\n\t\t}\n\t\telse cw.debug=true, _decSettings (doc);\n\n\t\treturn pi.promise();\n\t\t\n\t\t//- - - - - - - - - - - - - - - - - - -\n\n\t\tfunction _decSettings (doc) {\n\t\t\tvar img, obj = decode(doc, PIN);\n\t\t\tif (!obj.dbs || !obj.uid) {\n\t\t\t\tobj = decode(doc, PIN2);\n\t\t\t\tif (!obj.dbs || !obj.uid) {\n\t\t\t\t\tcw.log (\"Invalid PIN entered on start.\");\n\t\t\t\t\tpi.reject(\"Invalid PIN, can’t decrypt settings\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (obj.dbs && obj.uid) {\n\n\t\t\t\t//gen me\n\t\t\t\tme.name=obj.name;\n\t\t\t\tme.pic=obj.pic;\n\t\t\t\ttry {\n\t\t\t\t\tif (obj.pic.length>2e3) {\n\t\t\t\t\t\tvar upic=new Image(); upic.src=obj.pic;\n\t\t\t\t\t\timg = cw.lib.image(upic);\n\t\t\t\t\t\tme.pic = img.sharpen(0.5).resample(64,64).sharpen(0.1).jpeg(0.99);\n\t\t\t\t\t};\n\t\t\t\t}catch(e) {\n\t\t\t\t\tme.pic = obj.pic;\n\t\t\t\t}\n\t\t\t\tme.uid=obj.uid||cw.lib.hash8(obj.name+cw.lib.hash8(obj.pin));\n\t\t\t\tme.contact=obj.contact||\"\";\n\t\t\t\tme._id=[\"user\",obj.name,obj.uid].join(\"-\");\n\t\t\t\tme.crc = cw.lib.hash8(obj.pic+me._id+me.contact);\n\n\t\t\t\tS = Object.merge({}, obj);\n\n\t\t\t\t// gen shadow dbsettings\n\t\t\t\tD = {};\n\t\t\t\tD0 = {};\n\t\t\t\tfor (var i=0, k;i