Commit f0a86d7d authored by techird's avatar techird

stash

parent 9e89a241
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
<title>百度脑图 - 便捷的思维导图工具</title> <title>百度脑图 - 便捷的思维导图工具</title>
<script src="kityminder.all.min.js?_=1409099802809" charset="utf-8"></script> <script src="kityminder.all.min.js?_=1409280817067" charset="utf-8"></script>
<script src="kityminder.config.js?_=1409099802809" charset="utf-8"></script> <script src="kityminder.config.js?_=1409280817067" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1409099802809" charset="utf-8"></script> <script src="lang/zh-cn/zh-cn.js?_=1409280817067" charset="utf-8"></script>
<link href="ui/theme/default/css/default.all.css" type="text/css" rel="stylesheet" /> <link href="ui/theme/default/css/default.all.css" type="text/css" rel="stylesheet" />
......
This diff is collapsed.
This diff is collapsed.
...@@ -67,7 +67,10 @@ KityMinder.LANG['zh-cn'] = { ...@@ -67,7 +67,10 @@ KityMinder.LANG['zh-cn'] = {
'save': { 'save': {
'header': '保存到', 'header': '保存到',
'netdisk': '百度网盘', 'netdisk': '百度网盘',
'local': '导出到本地' 'download': '导出到本地'
},
'share': {
'header': '分享我的脑图'
} }
}, },
...@@ -78,6 +81,16 @@ KityMinder.LANG['zh-cn'] = { ...@@ -78,6 +81,16 @@ KityMinder.LANG['zh-cn'] = {
'dropfile': '或将文件拖至此处', 'dropfile': '或将文件拖至此处',
'unsupportedfile': '不支持的文件格式', 'unsupportedfile': '不支持的文件格式',
'untitleddoc': '未命名文档', 'untitleddoc': '未命名文档',
'errorloading': '加载失败:{0}',
'unknownreason': '可能是外星人篡改了代码...',
'overrideconfirm': '{0} 已存在,确认覆盖吗?',
'checklogin': '检查登录状态中...',
'loggingin': '正在登录...',
'recent': '最近打开',
'clearrecent': '清空',
'clearrecentconfirm': '确认清空最近文档列表?',
'cleardraft': '清空',
'cleardraftconfirm': '确认清空草稿箱?',
'login': '登录', 'login': '登录',
'logout': '注销', 'logout': '注销',
......
This diff is collapsed.
...@@ -14,8 +14,10 @@ ...@@ -14,8 +14,10 @@
'lib/ZeroClipboard.min.js', 'lib/ZeroClipboard.min.js',
'lib/fui/dev-lib/jhtmls.min.js', 'lib/fui/dev-lib/jhtmls.min.js',
'lib/fui/dist/fui.all.js', 'lib/fui/dist/fui.all.js',
'lib/fio/dist/fio.js', 'lib/fio/src/fio.js',
'lib/fio/provider/netdisk/oauth.js',
'lib/fio/provider/netdisk/netdisk.js', 'lib/fio/provider/netdisk/netdisk.js',
'lib/fio/provider/mongoshare/mongoshare.js',
/* Kity 依赖库 */ /* Kity 依赖库 */
'lib/kity/dist/kity.js', 'lib/kity/dist/kity.js',
...@@ -102,6 +104,7 @@ ...@@ -102,6 +104,7 @@
'ui/eve.js', 'ui/eve.js',
'ui/fuix.js', 'ui/fuix.js',
'ui/fiox.js', 'ui/fiox.js',
'ui/doc.js',
/* UI 组件 */ /* UI 组件 */
'ui/widget/commandbutton.js', 'ui/widget/commandbutton.js',
...@@ -109,22 +112,21 @@ ...@@ -109,22 +112,21 @@
'ui/widget/commandinputmenu.js', 'ui/widget/commandinputmenu.js',
'ui/widget/friendlytimespan.js', 'ui/widget/friendlytimespan.js',
'ui/widget/locallist.js', 'ui/widget/locallist.js',
'ui/widget/fileloader.js',
'ui/widget/netdiskfinder.js', 'ui/widget/netdiskfinder.js',
'ui/widget/menutab',
/* UI 菜单 */ /* UI 菜单 */
'ui/menu/menu.js', 'ui/menu/menu.js',
'ui/menu/header.js', 'ui/menu/header.js',
'ui/menu/level1.js',
/* UI 菜单 - 新建 */ /* UI 菜单 - 新建 */
'ui/menu/new/new.js', 'ui/menu/new/new.js',
/* UI 菜单 - 打开 */ /* UI 菜单 - 打开 */
'ui/menu/open/open.js', 'ui/menu/open/open.js',
'ui/menu/open/local.js',
'ui/menu/open/netdisk.js',
'ui/menu/open/recent.js', 'ui/menu/open/recent.js',
'ui/menu/open/netdisk.js',
'ui/menu/open/local.js',
'ui/menu/open/draft.js', 'ui/menu/open/draft.js',
/* UI 菜单 - 保存 */ /* UI 菜单 - 保存 */
......
/**
* 开发版本的文件导入
*/
(function() {
var paths = [
/* 依赖库 */
'lib/jquery-2.1.1.js',
'lib/jquery.transit.min.js',
'lib/promise-1.0.0.js',
'lib/fui/dev-lib/jhtmls.min.js',
'lib/fui/dist/fui.all.js',
/* Kity 依赖库 */
'lib/kity/dist/kity.js',
/* 核心代码 */
'src/core/kityminder.js',
'src/core/utils.js',
'src/core/command.js',
'src/core/node.js',
'src/core/module.js',
'src/core/event.js',
'src/core/minder.js',
'src/core/minder.data.compatibility.js',
'src/core/minder.data.js',
'src/core/minder.event.js',
'src/core/minder.module.js',
'src/core/minder.command.js',
'src/core/minder.node.js',
'src/core/minder.select.js',
'src/core/keymap.js',
'src/core/minder.lang.js',
'src/core/minder.defaultoptions.js',
'src/core/minder.preference.js',
'src/core/browser.js',
'src/core/layout.js',
'src/core/connect.js',
'src/core/render.js',
'src/core/theme.js',
'src/core/template.js',
/* 布局 */
'src/layout/default.js',
'src/layout/default.connect.js',
'src/layout/bottom.js',
'src/layout/filetree.js',
/* 皮肤 */
'src/theme/default.js',
'src/theme/snow.js',
'src/theme/fresh.js',
/* 模板 */
'src/template/structure.js',
/* 模块 */
'src/module/node.js',
'src/module/text.js',
'src/module/expand.js',
'src/module/outline.js',
'src/module/geometry.js',
'src/module/history.js',
'src/module/progress.js',
'src/module/priority.js',
'src/module/image.js',
'src/module/resource.js',
'src/module/view.js',
'src/module/dragtree.js',
'src/module/keyboard.js',
'src/module/select.js',
'src/module/history.js',
'src/module/basestyle.js',
'src/module/font.js',
'src/module/zoom.js',
'src/module/hyperlink.js',
'src/module/arrange.js',
'src/module/paste.js',
'src/module/style.js',
/* 格式支持 */
'src/protocol/plain.js',
'src/protocol/json.js',
'src/protocol/png.js',
'src/protocol/svg.js',
/* UI 基础 */
'ui/ui.js',
'ui/eve.js',
'ui/fuix.js',
// 'ui/fiox.js',
'ui/doc.js',
/* UI 组件 */
// 'ui/widget/commandbutton.js',
// 'ui/widget/commandbuttonset.js',
// 'ui/widget/commandinputmenu.js',
// 'ui/widget/friendlytimespan.js',
// 'ui/widget/locallist.js',
// 'ui/widget/netdiskfinder.js',
'ui/widget/menutab',
/* UI 菜单 */
'ui/menu/menu.js',
'ui/menu/header.js',
/* UI 菜单 - 新建 */
// 'ui/menu/new/new.js',
/* UI 菜单 - 打开 */
// 'ui/menu/open/open.js',
// 'ui/menu/open/recent.js',
// 'ui/menu/open/netdisk.js',
// 'ui/menu/open/local.js',
// 'ui/menu/open/draft.js',
/* UI 菜单 - 保存 */
'ui/menu/save/save.js',
// 'ui/menu/save/netdisk.js',
'ui/menu/save/download.js',
/* UI 菜单 - 分享 */
// 'ui/menu/share/share.js',
/* UI Top Bar */
// 'ui/topbar/history.js',
// 'ui/topbar/user.js',
'ui/topbar/search.js',
'ui/topbar/title.js',
/* UI Ribbon */
// 'ui/ribbon/tabs.js',
/* UI Ribbon「思路」面板 */
// 'ui/ribbon/idea/insert.js',
// 'ui/ribbon/idea/arrange.js',
// 'ui/ribbon/idea/operation.js',
// 'ui/ribbon/idea/attachment.js',
// 'ui/ribbon/idea/link.js',
// 'ui/ribbon/idea/image.js',
// 'ui/ribbon/idea/priority.js',
// 'ui/ribbon/idea/progress.js',
// 'ui/ribbon/idea/resource.js',
/* UI Ribbon「展示」面板 */
// 'ui/ribbon/appearence/template.js',
// 'ui/ribbon/appearence/theme.js',
// 'ui/ribbon/appearence/layout.js',
// 'ui/ribbon/appearence/style.js',
// 'ui/ribbon/appearence/font.js',
// 'ui/ribbon/appearence/color.js',
/* UI Ribbon「视图」面板 */
// 'ui/ribbon/view/level.js'
];
if (typeof(module) === 'object' && module.exports) {
module.exports = paths;
} else if (document) {
while (paths.length) {
/* jshint browser:true */
window.document.write('<script type="text/javascript" src="' + paths.shift() + '"></script>');
}
}
})();
\ No newline at end of file
...@@ -26,22 +26,6 @@ ...@@ -26,22 +26,6 @@
<div id="kityminder" onselectstart="return false"> <div id="kityminder" onselectstart="return false">
</div> </div>
<div id="share-dialog">
<h3>URL分享:</h3>
<p>
<input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
<button id="copy-share-url" data-clipboard-target="share-url" type="button">复制</button>
</p>
<h3>社交分享:</h3>
<p id="share-platform" class="bdsharebuttonbox">
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
</p>
</div>
<div id="about"> <div id="about">
<svg id="km-cat" viewBox="0 0 1200 1200" width="32px" height="32px"> <svg id="km-cat" viewBox="0 0 1200 1200" width="32px" height="32px">
...@@ -100,7 +84,6 @@ ...@@ -100,7 +84,6 @@
$(function() { $(function() {
/* 依赖库初始化 */ /* 依赖库初始化 */
ZeroClipboard.setDefaults({ moviePath: 'lib/ZeroClipboard.swf' });
zip.inflateJSPath = 'lib/inflate.js'; zip.inflateJSPath = 'lib/inflate.js';
}); });
......
...@@ -46,29 +46,27 @@ KityMinder.LANG['zh-cn'] = { ...@@ -46,29 +46,27 @@ KityMinder.LANG['zh-cn'] = {
}, },
'menu': { 'menu': {
'level1': {
'new': '新建', 'mainmenutext': '百度脑图', // 主菜单按钮文本
'open': '打开',
'save': '保存', 'newtab': '新建',
'share': '分享', 'opentab': '打开',
'help': '帮助', 'savetab': '保存',
'setting': '设置' 'sharetab': '分享',
}, 'helptab': '帮助',
'new': { 'settingtab': '设置',
'header': '新建脑图' 'recenttab': '最近使用',
}, 'netdisktab': '百度云存储',
'open': { 'localtab': '本地文件',
'header': '打开', 'drafttab': '草稿箱',
'recent': '最近使用', 'downloadtab': '导出到本地',
'netdisk': '百度云盘', 'createsharetab': '当前脑图',
'local': '本地文件', 'managesharetab': '已分享',
'draft': '草稿箱'
}, 'newheader': '新建脑图',
'save': { 'openheader': '打开',
'header': '保存到', 'saveheader': '保存到',
'netdisk': '百度网盘', 'shareheader': '分享我的脑图'
'local': '导出到本地'
}
}, },
'mydocument': '我的文档', 'mydocument': '我的文档',
...@@ -78,6 +76,34 @@ KityMinder.LANG['zh-cn'] = { ...@@ -78,6 +76,34 @@ KityMinder.LANG['zh-cn'] = {
'dropfile': '或将文件拖至此处', 'dropfile': '或将文件拖至此处',
'unsupportedfile': '不支持的文件格式', 'unsupportedfile': '不支持的文件格式',
'untitleddoc': '未命名文档', 'untitleddoc': '未命名文档',
'errorloading': '加载失败:{0}',
'unknownreason': '可能是外星人篡改了代码...',
'overrideconfirm': '{0} 已存在,确认覆盖吗?',
'checklogin': '检查登录状态中...',
'loggingin': '正在登录...',
'recent': '最近打开',
'clearrecent': '清空',
'clearrecentconfirm': '确认清空最近文档列表?',
'cleardraft': '清空',
'cleardraftconfirm': '确认清空草稿箱?',
'none_share': '不分享',
'public_share': '公开分享',
'password_share': '私密分享',
'email_share': '邮件邀请',
'url_share': '脑图 URL 地址:',
'sns_share': '社交网络分享:',
'sns_share_text': '“{0}” - 我用「百度脑图」制作的思维导图,快看看吧!(地址:{1})',
'none_share_description': '不分享当前脑图',
'public_share_description': '创建任何人可见的分享',
'share_button_text': '创建',
'password_share_description': '创建需要密码才可见的分享',
'email_share_description': '创建指定人可见的分享,您还可以允许他们编辑',
'ondev': '敬请期待!',
'create_share_failed': '分享失败:{0}',
'copy': '复制',
'copied': '已复制',
'shared_tip': '当前脑图被 {0} 分享,你可以修改之后保存到自己的网盘上或再次分享',
'login': '登录', 'login': '登录',
'logout': '注销', 'logout': '注销',
......
Subproject commit b5a61278a057db00d81d54718514df9492007d1e Subproject commit f56bdb0c9bd079b42ea07f683dc79c5796174ea9
Subproject commit bdca414351274d350a1cc87c2f3d17536b715903 Subproject commit 7198d3af584d6cf2b4b6335045a57d0b07d5c292
...@@ -269,7 +269,7 @@ define("promise/polyfill", ...@@ -269,7 +269,7 @@ define("promise/polyfill",
return isFunction(resolve); return isFunction(resolve);
}()); }());
if (!es6PromiseSupport) { if (!es6PromiseSupport || ~window.location.href.indexOf('rsvpromise')) {
local.Promise = RSVPPromise; local.Promise = RSVPPromise;
} }
} }
......
...@@ -35,8 +35,7 @@ kity.extendClass(Minder, { ...@@ -35,8 +35,7 @@ kity.extendClass(Minder, {
}); });
}, },
exportData: function(protocolName) { exportJson: function() {
/* 导出 node 上整棵树的数据为 JSON */ /* 导出 node 上整棵树的数据为 JSON */
function exportNode(node) { function exportNode(node) {
var exported = {}; var exported = {};
...@@ -51,14 +50,67 @@ kity.extendClass(Minder, { ...@@ -51,14 +50,67 @@ kity.extendClass(Minder, {
return exported; return exported;
} }
var json, protocol; var json = exportNode(this.getRoot());
json = exportNode(this.getRoot());
json.template = this.getTemplate(); json.template = this.getTemplate();
json.theme = this.getTheme(); json.theme = this.getTheme();
json.version = KityMinder.version; json.version = KityMinder.version;
return json;
},
importJson: function(json, params) {
function importNode(node, json, km) {
var data = json.data;
node.data = {};
for (var field in data) {
node.setData(field, data[field]);
}
node.setData('text', data.text || km.getLang(DEFAULT_TEXT[node.getType()]));
var childrenTreeData = json.children || [];
for (var i = 0; i < childrenTreeData.length; i++) {
var childNode = km.createNode(null, node);
importNode(childNode, childrenTreeData[i], km);
}
return node;
}
if (!json) return;
this._fire(new MinderEvent('preimport', params, false));
// 删除当前所有节点
while (this._root.getChildren().length) {
this.removeNode(this._root.getChildren()[0]);
}
json = KityMinder.compatibility(json);
importNode(this._root, json, this);
this.setTemplate(json.template || null);
this.setTheme(json.theme || null);
this.refresh();
this.fire('import', params);
this._firePharse({
type: 'contentchange'
});
this._firePharse({
type: 'interactchange'
});
},
exportData: function(protocolName) {
var json, protocol;
json = this.exportJson();
// 指定了协议进行导出,需要检测协议是否支持 // 指定了协议进行导出,需要检测协议是否支持
if (protocolName) { if (protocolName) {
protocol = this.getProtocol(protocolName); protocol = this.getProtocol(protocolName);
...@@ -112,57 +164,11 @@ kity.extendClass(Minder, { ...@@ -112,57 +164,11 @@ kity.extendClass(Minder, {
}).then(function(json) { }).then(function(json) {
minder._doImport(json, params); minder.importJson(json, params);
return json; return json;
}); });
},
_doImport: function(json, params) {
function importNode(node, json, km) {
var data = json.data;
node.data = {};
for (var field in data) {
node.setData(field, data[field]);
}
node.setData('text', data.text || km.getLang(DEFAULT_TEXT[node.getType()]));
var childrenTreeData = json.children || [];
for (var i = 0; i < childrenTreeData.length; i++) {
var childNode = km.createNode(null, node);
importNode(childNode, childrenTreeData[i], km);
}
return node;
}
if (!json) return;
this._fire(new MinderEvent('preimport', params, false));
// 删除当前所有节点
while (this._root.getChildren().length) {
this.removeNode(this._root.getChildren()[0]);
}
json = KityMinder.compatibility(json);
importNode(this._root, json, this);
this.setTemplate(json.template || null);
this.setTheme(json.theme || null);
this.refresh();
this.fire('import', params);
this._firePharse({
type: 'contentchange'
});
this._firePharse({
type: 'interactchange'
});
} }
}); });
\ No newline at end of file
...@@ -368,7 +368,6 @@ KityMinder.registerModule('DragTree', function() { ...@@ -368,7 +368,6 @@ KityMinder.registerModule('DragTree', function() {
dragger.dragEnd(); dragger.dragEnd();
//e.stopPropagation(); //e.stopPropagation();
e.preventDefault(); e.preventDefault();
this.fire('contentchange');
}, },
'statuschange': function(e) { 'statuschange': function(e) {
if (e.lastStatus == 'textedit' && e.currentStatus == 'normal') { if (e.lastStatus == 'textedit' && e.currentStatus == 'normal') {
......
...@@ -219,9 +219,9 @@ Minder.Receiver = kity.createClass('Receiver', { ...@@ -219,9 +219,9 @@ Minder.Receiver = kity.createClass('Receiver', {
this.km.setStatus('inputready'); this.km.setStatus('inputready');
clearTimeout(me.inputTextTimer); clearTimeout(me.inputTextTimer);
e.preventDefault(); e.preventDefault();
this.km.fire('contentchange');
}else{ }else{
this.km.setStatus('normal'); this.km.setStatus('normal');
this.km.fire('contentchange');
} }
restoreTextContent(); restoreTextContent();
return; return;
...@@ -303,7 +303,6 @@ Minder.Receiver = kity.createClass('Receiver', { ...@@ -303,7 +303,6 @@ Minder.Receiver = kity.createClass('Receiver', {
e.preventDefault(); e.preventDefault();
}else{ }else{
this.km.setStatus('normal'); this.km.setStatus('normal');
this.km.fire('contentchange');
} }
restoreTextContent(); restoreTextContent();
return; return;
......
...@@ -74,7 +74,7 @@ KityMinder.registerProtocol('freemind', function(minder) { ...@@ -74,7 +74,7 @@ KityMinder.registerProtocol('freemind', function(minder) {
} }
return { return {
fileDescription: 'freemind格式文件', fileDescription: 'Freemind 格式',
fileExtension: '.mm', fileExtension: '.mm',
dataType: 'text', dataType: 'text',
......
KityMinder.registerProtocol('json', function(minder) { KityMinder.registerProtocol('json', function(minder) {
return { return {
fileDescription: 'KityMinder', fileDescription: 'KityMinder 格式',
fileExtension: '.km', fileExtension: '.km',
dataType: 'text', dataType: 'text',
mineType: 'application/json', mineType: 'application/json',
......
...@@ -113,7 +113,7 @@ KityMinder.registerProtocol('mindmanager', function(minder) { ...@@ -113,7 +113,7 @@ KityMinder.registerProtocol('mindmanager', function(minder) {
} }
return { return {
fileDescription: 'mindmanager格式文件', fileDescription: 'MindManager 格式',
fileExtension: '.mmap', fileExtension: '.mmap',
dataType: 'blob', dataType: 'blob',
......
...@@ -138,6 +138,7 @@ if (!kity.Browser.ie) { ...@@ -138,6 +138,7 @@ if (!kity.Browser.ie) {
fileDescription: 'PNG 图片', fileDescription: 'PNG 图片',
fileExtension: '.png', fileExtension: '.png',
mineType: 'image/png', mineType: 'image/png',
dataType: 'base64',
encode: encode, encode: encode,
recognizePriority: -1 recognizePriority: -1
}; };
......
...@@ -6,6 +6,7 @@ if (!kity.Browser.ie) { ...@@ -6,6 +6,7 @@ if (!kity.Browser.ie) {
fileDescription: 'SVG 矢量图', fileDescription: 'SVG 矢量图',
fileExtension: '.svg', fileExtension: '.svg',
mineType: 'image/svg+xml', mineType: 'image/svg+xml',
dataType: 'text',
encode: function(json) { encode: function(json) {
......
...@@ -32,7 +32,7 @@ KityMinder.registerProtocol('xmind', function(minder) { ...@@ -32,7 +32,7 @@ KityMinder.registerProtocol('xmind', function(minder) {
}; };
return { return {
fileDescription: 'xmind格式文件', fileDescription: 'XMind 格式',
fileExtension: '.xmind', fileExtension: '.xmind',
dataType: 'blob', dataType: 'blob',
......
/**
* @fileOverview
*
* 当前文档管理
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('doc', function(minder) {
var ret = minder.getUI('eve').setup({});
var current = {};
var loading = false;
/**
* 加载文档
*
* @param {Object} doc 文档的属性,可包括:
* doc.content {string} [Required] 文档内容
* doc.protocol {string} [Required] 内容所使用的编码协议
* doc.title {string} 文档的标题
* doc.source {string} 文档的来源
* doc.path {string} 文档的路径
* doc.saved {bool} 文档的保存状态
*
* @event docload(doc)
* doc - 文档解析之后的文档对象
*
* @return {Promise<doc>} 返回解析完之后的文档对象,解析的结果为 doc.data
*/
function load(doc) {
var restore = doc;
current = doc;
loading = true;
return minder.importData(doc.content, doc.protocol).then(function(data) {
doc.title = doc.title || minder.getMinderTitle();
minder.execCommand('camera', minder.getRoot(), 300);
doc.data = data;
doc.json = JSON.stringify(data);
minder.getUI('topbar/title').setTitle(doc.title, doc.saved);
ret.fire('docload', doc);
return doc;
})['catch'](function(e) {
current = restore;
throw e;
}).then(function(doc) {
loading = false;
return doc;
});
}
function save(doc) {
current = doc;
minder.getUI('topbar/title').setTitle(doc.title, true);
ret.fire('docsave', doc);
}
function getCurrent() {
return current;
}
/* 绕开初始化时候的乱事件 */
setTimeout(function() {
minder.on('contentchange', function() {
if (loading) return;
var $title = minder.getUI('topbar/title');
if (current.source != 'netdisk') {
current.title = minder.getMinderTitle();
$title.setTitle(current.title, false);
ret.fire('docchange', current);
} else {
if (current.json != JSON.stringify(minder.exportJson())) {
$title.setSaved(false);
ret.fire('docchange', current);
} else {
$title.setSaved(true);
}
}
});
}, 1000);
ret.load = load;
ret.save = save;
ret.current = getCurrent;
return ret;
});
\ No newline at end of file
...@@ -10,4 +10,9 @@ ...@@ -10,4 +10,9 @@
KityMinder.registerUI('fiox', function(minder) { KityMinder.registerUI('fiox', function(minder) {
var eve = minder.getUI('eve'); var eve = minder.getUI('eve');
eve.setup(fio.user); eve.setup(fio.user);
/* 初始化网盘使用的 APP 身份 */
fio.user.init({
apiKey: 'wiE55BGOG8BkGnpPs6UNtPbb'
});
}); });
\ No newline at end of file
/**
* @fileOverview
*
* 菜单默认选择项目
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/default', function (minder) {
});
\ No newline at end of file
...@@ -7,21 +7,29 @@ ...@@ -7,21 +7,29 @@
* @copyright: Baidu FEX, 2014 * @copyright: Baidu FEX, 2014
*/ */
KityMinder.registerUI('menu/header', function (minder) { KityMinder.registerUI('menu/header', function(minder) {
var $menu = minder.getUI('menu/menu'); var $menu = minder.getUI('menu/menu');
var $header = $('<div class="main-menu-header"></div>').appendTo($menu); var $header = $('<div class="main-menu-header"></div>')
.prependTo($menu.$panel);
var $backPanel = $('<div class="main-menu-back-panel"></div>').appendTo($header); var $backPanel = $('<div class="main-menu-back-panel"></div>')
.appendTo($header);
var $titlePanel = $('<div class="main-menu-title">百度脑图</div>').appendTo($header); var $titlePanel = $('<div class="main-menu-title">百度脑图</div>')
.appendTo($header);
var $backButton = new FUI.Button({ var $backButton = new FUI.Button({
className: 'main-menu-back-button', className: 'main-menu-back-button',
label: minder.getLang('ui.back') label: minder.getLang('ui.back')
}).appendTo($backPanel[0]).on('click', function() {
$menu.removeClass('show'); }).appendTo($backPanel[0]).on('click', $menu.hide);
$menu.on('show', function() {
var $title = minder.getUI('topbar/title');
$titlePanel.text($title.getTitle());
}); });
return $header; return $header;
......
/**
* @fileOverview
*
* 一级菜单
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/level1', function(minder) {
var $menu = minder.getUI('menu/menu');
var tabs = ['new', 'open', 'save', 'share', 'help'];
var $l1_tabs = new FUI.Tabs({
buttons: tabs.map(function(key) {
return {
label: minder.getLang('ui.menu.level1.' + key),
className: key
};
}),
className: 'main-menu-level-1'
});
$l1_tabs.appendTo($menu[0]);
$l1_tabs.select(2);
var ret = {};
tabs.forEach(function(key, index) {
ret[key] = $l1_tabs.getPanel(index);
});
return ret;
});
\ No newline at end of file
...@@ -9,27 +9,79 @@ ...@@ -9,27 +9,79 @@
KityMinder.registerUI('menu/menu', function(minder) { KityMinder.registerUI('menu/menu', function(minder) {
var $mainMenuButton = new FUI.Button({ var ret = minder.getUI('eve').setup({});
id: 'main-menu-btn' var $menutab = minder.getUI('widget/menutab');
});
// 主菜单容器
var $panel = $('<div>')
.attr('id', 'main-menu')
.appendTo('#content-wrapper');
// 主菜单按钮
var $button = new FUI.Button({
var $panel; id: 'main-menu-btn',
label: minder.getLang('ui.menu.mainmenutext')
$mainMenuButton.setLabel('百度脑图'); }).appendTo(document.getElementById('panel'));
$mainMenuButton.appendTo(document.getElementById('panel'));
$mainMenuButton.on('click', function(e) { // 一级菜单选项卡
var $tabs = new FUI.Tabs({
className: 'main-menu-level1'
}).appendTo($panel[0]);
function show() {
$panel.addClass('show'); $panel.addClass('show');
}); ret.fire('show');
}
$panel = $('<div id="main-menu"></div>').appendTo('#content-wrapper'); function hide() {
$panel.removeClass('show');
ret.fire('hide');
}
function toggle() {
($panel.hasClass('show') ? hide : show)();
}
function createSub(name, asDefault) {
var $sub = $menutab.generate($tabs, name, asDefault);
var $h2 = $('<h2></h2>')
.text(minder.getLang('ui.menu.' + name + 'header'))
.appendTo($sub);
return $sub;
}
function createSubMenu(name, asDefault) {
var $sub = createSub(name, asDefault);
var $subtabs = new FUI.Tabs().appendTo($sub);
return {
$tabs: $subtabs,
createSub: function(subname, asDefault) {
return $menutab.generate($subtabs, subname, asDefault);
}
};
}
$button.on('click', toggle);
$(window).keydown(function(e) { $(window).keydown(function(e) {
// ESC Pressed // ESC Pressed
if (e.keyCode == 27) { if (e.keyCode == 27) toggle();
$panel.toggleClass('show');
}
}); });
return $panel.addClass('show'); // expose
ret.show = show;
ret.hide = hide;
ret.toggle = toggle;
ret.createSub = createSub;
ret.createSubMenu = createSubMenu;
ret.$panel = $panel;
ret.$button = $button;
ret.$tabs = $tabs;
show();
return ret;
}); });
\ No newline at end of file
...@@ -10,14 +10,10 @@ ...@@ -10,14 +10,10 @@
KityMinder.registerUI('menu/new/new', function(minder) { KityMinder.registerUI('menu/new/new', function(minder) {
var $menu = minder.getUI('menu/menu'); var $menu = minder.getUI('menu/menu');
var $level1 = minder.getUI('menu/level1'); var $doc = minder.getUI('doc');
var eve = minder.getUI('eve'); var ret = minder.getUI('eve').setup({});
var $panel = $level1['new'].getContentElement(); var $panel = $menu.createSub('new');
var $h2 = $('<h2></h2>')
.text(minder.getLang('ui.menu.new.header'))
.appendTo($panel);
// 模板列表容器 // 模板列表容器
var $ul = $('<ul></ul>') var $ul = $('<ul></ul>')
...@@ -40,20 +36,18 @@ KityMinder.registerUI('menu/new/new', function(minder) { ...@@ -40,20 +36,18 @@ KityMinder.registerUI('menu/new/new', function(minder) {
$ul.delegate('.template-item', 'click', function(e) { $ul.delegate('.template-item', 'click', function(e) {
var template = $(e.target).data('template'); var template = $(e.target).data('template');
minder.importData({ $doc.load({
template: template, content: {
version: KityMinder.version, template: template,
data: { version: KityMinder.version,
text: minder.getLang('template')[template] data: {
} text: minder.getLang('template')[template]
}
},
protocol: null
}); });
minder.execCommand('camera', minder.getRoot()); $menu.hide();
$menu.removeClass('show');
}); });
var ret = {};
eve.setup(ret);
return ret; return ret;
}); });
\ No newline at end of file
...@@ -8,9 +8,137 @@ ...@@ -8,9 +8,137 @@
*/ */
KityMinder.registerUI('menu/open/draft', function(minder) { KityMinder.registerUI('menu/open/draft', function(minder) {
var $menu = minder.getUI('menu/menu');
var $open = minder.getUI('menu/open/open'); var $open = minder.getUI('menu/open/open');
var $panel = $($open.draft.getContentElement()).addClass('draft-file-list'); var $loader = minder.getUI('widget/fileloader');
var drafts = minder.getUI('widget/locallist').use('draft');
$panel.append('<h2>草稿箱</h2>'); var frdTime = minder.getUI('widget/friendlytimespan');
var $doc = minder.getUI('doc');
// 旧数据迁移
if (localStorage.drafts) {
var oldDrafts = JSON.parse(localStorage.drafts);
var list = oldDrafts.map(function(draft) {
var ret = {};
ret.json = draft.data;
ret.time = +new Date(draft.update);
ret.title = JSON.parse(draft.data).data.text;
return ret;
});
delete localStorage.drafts;
localStorage.draft = JSON.stringify(list);
}
var draftList = minder.getUI('widget/locallist').use('draft');
/* 网盘面板 */
var $panel = $($open.createSub('draft')).addClass('draft-panel');
/* 标题 */
var $title = $('<h2></h2>')
.text(minder.getLang('ui.menu.open.draft'))
.appendTo($panel);
var $clear = $('<button></button>')
.addClass('clear-draft')
.text(minder.getLang('ui.cleardraft'))
.appendTo($panel);
/* 最近文件列表容器 */
var $ul = $('<ul></ul>')
.addClass('draft-list')
.appendTo($panel);
var current = null,
lastDoc = null;
$ul.delegate('.draft-list-item', 'click', function(e) {
var item = $(e.target).closest('.draft-list-item').data('item');
var index = draftList.findIndex(function(finding) {
return finding == item;
});
if (index > -1) {
current = item;
draftList.remove(index);
draftList.unshift(current);
lastDoc = {
title: current.title,
protocol: 'json',
content: current.json,
path: current.path,
source: current.source,
saved: false
};
$doc.load(lastDoc);
}
$menu.hide();
});
$clear.on('click', function() {
if (!window.confirm(minder.getLang('ui.cleardraftconfirm'))) return;
draftList.clear();
current = null;
renderList();
});
$doc.on('docsave', popDraft);
$doc.on('docchange', pushDraft);
renderList();
function pushDraft(doc) {
if (doc == lastDoc) {
if (current) {
draftList.remove(0);
}
} else {
current = null;
}
lastDoc = doc;
current = current || {};
current.json = JSON.stringify(minder.exportJson());
current.title = doc.title;
current.time = +new Date();
current.path = doc.path;
current.source = doc.source;
draftList.unshift(current);
renderList();
}
function popDraft() {
if (current) {
draftList.remove(0);
current = null;
}
renderList();
console.log('pop draft');
}
function renderList() {
$ul.empty();
draftList.forEach(function(item) {
var $li = $('<li></li>')
.addClass('draft-list-item')
.data('item', item)
.appendTo($ul);
$('<h4></h4>')
.addClass('draft-title')
.text(item.title)
.appendTo($li);
$('<span></span>')
.addClass('file-time')
.displayFriendlyTime(item.time)
.appendTo($li);
});
}
}); });
\ No newline at end of file
...@@ -11,51 +11,27 @@ KityMinder.registerUI('menu/open/local', function(minder) { ...@@ -11,51 +11,27 @@ KityMinder.registerUI('menu/open/local', function(minder) {
var $menu = minder.getUI('menu/menu'); var $menu = minder.getUI('menu/menu');
var $open = minder.getUI('menu/open/open'); var $open = minder.getUI('menu/open/open');
var $loader = minder.getUI('widget/fileloader'); var $doc = minder.getUI('doc');
// 支持的文件类型 /* extension => protocol */
var supportedExtensions = []; var supports = {};
var accepts = [];
Utils.each(minder.getSupportedProtocols(), function(name, protocol) { minder.getSupportedProtocols().forEach(function(protocol) {
if (protocol && protocol.decode) { if (protocol.decode) {
supportedExtensions.push(protocol.fileExtension); supports[protocol.fileExtension] = protocol;
accepts.push(protocol.fileExtension);
} }
}); });
supportedExtensions = supportedExtensions.join(', ');
function readFile(domfile) {
return new Promise(function(resolve, reject) {
var file = new fio.file.File(domfile.name);
var protocol = minder.getProtocol($loader.support(file));
var reader;
if (protocol.dataType == 'blob') {
file.data = new fio.file.Data(domfile);
resolve(file);
} else {
reader = new FileReader();
reader.onload = function() {
file.data = new fio.file.Data(this.result);
resolve(file);
};
reader.readAsText(domfile, 'utf-8');
}
});
}
/* 网盘面板 */ /* 网盘面板 */
var $panel = $($open.local.getContentElement()).addClass('local-file-open-panel'); var $panel = $($open.createSub('local')).addClass('local-file-open-panel');
/* 路径导航 */ /* 标题 */
var $nav = $('<h2>本地文件</h2>') $('<h2>本地文件</h2>')
.appendTo($panel); .appendTo($panel);
/* 选择文件 */
var $pick = $('<div class="pick-file"></div>') var $pick = $('<div class="pick-file"></div>')
.appendTo($panel); .appendTo($panel);
...@@ -64,19 +40,26 @@ KityMinder.registerUI('menu/open/local', function(minder) { ...@@ -64,19 +40,26 @@ KityMinder.registerUI('menu/open/local', function(minder) {
.appendTo($pick); .appendTo($pick);
$('<span></span>') $('<span></span>')
.text(minder.getLang('ui.acceptfile', supportedExtensions)) .text(minder.getLang('ui.acceptfile', accepts.map(function(ext) {
.appendTo($pick);
var protocol = supports[ext];
return protocol.fileDescription + '(' + ext + ')';
}).join(', '))).appendTo($pick);
/* 拖放提示 */
var $drop = $('<div class="drop-file"></div>') var $drop = $('<div class="drop-file"></div>')
.append($('<span></span>').html(minder.getLang('ui.dropfile'))) .append($('<span></span>').html(minder.getLang('ui.dropfile')))
.appendTo($panel); .appendTo($panel);
/* 交互事件 */
$pickButton.click(function() { $pickButton.click(function() {
var $file = $('<input type="file" />') $('<input type="file" />')
.attr('accept', supportedExtensions) .attr('accept', accepts.join())
.on('change', function(e) { .on('change', function(e) {
readFile(this.files[0]).then($loader.load); read(this.files[0]);
$menu.removeClass('show'); $menu.hide();
}).click(); }).click();
}); });
...@@ -85,9 +68,62 @@ KityMinder.registerUI('menu/open/local', function(minder) { ...@@ -85,9 +68,62 @@ KityMinder.registerUI('menu/open/local', function(minder) {
e.stopPropagation(); e.stopPropagation();
}).on('drop', function(e) { }).on('drop', function(e) {
e = e.originalEvent; e = e.originalEvent;
var file = e.dataTransfer.files[0]; read(e.dataTransfer.files[0]);
readFile(file).then($loader.load); $menu.hide();
$menu.removeClass('show');
e.preventDefault(); e.preventDefault();
}); });
function read(domfile) {
if (!domfile) return;
var info = new fio.file.anlysisPath(domfile.name);
var protocol = supports[info.extension];
var dataPromise = new Promise(function(resolve, reject) {
var reader;
if (protocol.dataType == 'blob') {
resolve(new fio.file.Data(domfile));
} else {
reader = new FileReader();
reader.onload = function() {
resolve(new fio.file.Data(this.result));
};
reader.onerror = reject;
reader.readAsText(domfile, 'utf-8');
}
});
$(minder.getRenderTarget()).addClass('loading');
return dataPromise.then(function(data) {
var doc = {
content: data.content,
protocol: protocol.name,
title: info.filename,
source: 'local'
};
return $doc.load(doc);
})['catch'](function(error) {
window.alert(minder.getLang('ui.errorloading', error.message || minder.getLang('ui.unknownreason')));
}).then(function() {
$(minder.getRenderTarget()).removeClass('loading');
});
}
return {
read: read
};
}); });
\ No newline at end of file
...@@ -11,38 +11,73 @@ KityMinder.registerUI('menu/open/netdisk', function(minder) { ...@@ -11,38 +11,73 @@ KityMinder.registerUI('menu/open/netdisk', function(minder) {
var $menu = minder.getUI('menu/menu'); var $menu = minder.getUI('menu/menu');
var $open = minder.getUI('menu/open/open'); var $open = minder.getUI('menu/open/open');
var $loader = minder.getUI('widget/fileloader');
var $netdiskfinder = minder.getUI('widget/netdiskfinder'); var $netdiskfinder = minder.getUI('widget/netdiskfinder');
var $eve = minder.getUI('eve'); var $eve = minder.getUI('eve');
var $doc = minder.getUI('doc');
var ret = $eve.setup({}); var ret = $eve.setup({});
/* 网盘面板 */ /* 网盘面板 */
var $panel = $($open.netdisk.getContentElement()); var $panel = $($open.createSub('netdisk'));
/* extension => protocol */
var supports = {};
minder.getSupportedProtocols().forEach(function(protocol) {
if (protocol.decode) {
supports[protocol.fileExtension] = protocol;
}
});
/* Finder */
var $finder = $netdiskfinder.generate($panel, function(file) { var $finder = $netdiskfinder.generate($panel, function(file) {
return $loader.support(file);
return supports[file.extension];
});
$finder.on('fileclick', function(file) {
return open(file.path);
}); });
$finder.on('fileclick', openFile); function open(path) {
$menu.hide();
$(minder.getRenderTarget()).addClass('loading');
function openFile(file) { var info = fio.file.anlysisPath(path);
var protocol = $loader.support(file); var protocol = supports[info.extension];
$menu.removeClass('show'); return fio.file.read({
return $loader.load(fio.file.read({ path: path,
path: file.path,
dataType: protocol.dataType dataType: protocol.dataType
})).then(function(readed) {
if (readed) ret.fire('fileload', readed); }).then(function(file) {
var doc = {
protocol: supports[file.extension].name,
content: file.data.content,
title: file.filename,
source: 'netdisk',
path: file.path,
saved: true
};
return $doc.load(doc);
})['catch'](function(error) {
window.alert(minder.getLang('ui.errorloading', error.message || minder.getLang('unknownreason')));
}).then(function() {
$(minder.getRenderTarget()).removeClass('loading');
}); });
} }
ret.loadFileByPath = function(path) { ret.open = open;
var file = new fio.file.File(path);
return openFile(file);
};
return ret; return ret;
}); });
\ No newline at end of file
...@@ -6,46 +6,6 @@ ...@@ -6,46 +6,6 @@
* @author: techird * @author: techird
* @copyright: Baidu FEX, 2014 * @copyright: Baidu FEX, 2014
*/ */
KityMinder.registerUI('menu/open/open', function(minder) { KityMinder.registerUI('menu/open/open', function(minder) {
return minder.getUI('menu/menu').createSubMenu('open', true);
var $level1 = minder.getUI('menu/level1');
var eve = minder.getUI('eve');
var $h2 = $('<h2></h2>')
.text(minder.getLang('ui.menu.open.header'))
.appendTo($level1.open.getContentElement());
var source = ['recent', 'netdisk', 'local', 'draft'];
var $tabs = new FUI.Tabs({
buttons: source.map(function(key) {
return {
label: minder.getLang('ui.menu.open.' + key),
className: key
};
})
}).appendTo($level1.open);
// 暴露
var ret = {};
// 暴露每个面板
source.forEach(function(key, index) {
ret[key] = $tabs.getPanel(index);
});
// 支持事件
eve.setup(ret);
// 暴露打开菜单(选项卡)选择事件
$tabs.on('tabsselect', function(e, info) {
ret.fire('select', info);
});
// 暴露选择事件
ret.select = $tabs.select.bind($tabs);
return ret;
}); });
\ No newline at end of file
...@@ -13,14 +13,24 @@ KityMinder.registerUI('menu/open/recent', function(minder) { ...@@ -13,14 +13,24 @@ KityMinder.registerUI('menu/open/recent', function(minder) {
var $open = minder.getUI('menu/open/open'); var $open = minder.getUI('menu/open/open');
var $loader = minder.getUI('widget/fileloader'); var $loader = minder.getUI('widget/fileloader');
var frdTime = minder.getUI('widget/friendlytimespan'); var frdTime = minder.getUI('widget/friendlytimespan');
var netdisk = minder.getUI('menu/open/netdisk'); var doc = minder.getUI('doc');
var recentList = minder.getUI('widget/locallist').use('recent'); var recentList = minder.getUI('widget/locallist').use('recent');
/* 网盘面板 */ /* 网盘面板 */
var $panel = $($open.recent.getContentElement()).addClass('recent-file-panel'); var $panel = $($open.createSub('recent', true)).addClass('recent-file-panel');
/* 路径导航 */ minder.on('uiready', function() {
var $nav = $('<h2>最近使用</h2>') minder.getUI('topbar/user').requireLogin($panel);
});
/* 标题 */
var $title = $('<h2></h2>')
.text(minder.getLang('ui.recent'))
.appendTo($panel);
var $clear = $('<button></button>')
.addClass('clear-recent-list')
.text(minder.getLang('ui.clearrecent'))
.appendTo($panel); .appendTo($panel);
/* 最近文件列表容器 */ /* 最近文件列表容器 */
...@@ -28,10 +38,50 @@ KityMinder.registerUI('menu/open/recent', function(minder) { ...@@ -28,10 +38,50 @@ KityMinder.registerUI('menu/open/recent', function(minder) {
.addClass('recent-file-list') .addClass('recent-file-list')
.appendTo($panel); .appendTo($panel);
$ul.delegate('.recent-file-item', 'click', function(e) {
var netdisk = minder.getUI('menu/open/netdisk');
var path = $(e.target)
.closest('.recent-file-item')
.data('path');
netdisk.open(path);
});
$clear.on('click', function() {
if (!window.confirm(minder.getLang('ui.clearrecentconfirm'))) return;
recentList.clear();
renderList();
});
doc.on('docload', addToList);
doc.on('docsave', addToList);
renderList(); renderList();
function addToList(doc) {
if (doc.source != 'netdisk') return;
var exist = recentList.findIndex('path', doc.path);
if (~exist) {
recentList.remove(exist);
}
recentList.unshift({
path: doc.path,
filename: fio.file.anlysisPath(doc.path).filename,
title: minder.getMinderTitle(),
time: +new Date()
});
renderList();
}
function renderList() { function renderList() {
$ul.empty(); $ul.empty();
recentList.forEach(function(item) { recentList.forEach(function(item) {
var $li = $('<li></li>') var $li = $('<li></li>')
...@@ -51,39 +101,9 @@ KityMinder.registerUI('menu/open/recent', function(minder) { ...@@ -51,39 +101,9 @@ KityMinder.registerUI('menu/open/recent', function(minder) {
$('<span></span>') $('<span></span>')
.addClass('file-time') .addClass('file-time')
.data('time', item.time) .displayFriendlyTime(item.time)
.text(frdTime.display(item.time))
.appendTo($li); .appendTo($li);
}); });
} }
$ul.delegate('.recent-file-item', 'click', function(e) {
var path = $(e.target)
.closest('.recent-file-item')
.data('path');
netdisk.loadFileByPath(path);
});
netdisk.on('fileload', function(loaded) {
var exist = recentList.findIndex('path', loaded.file.path);
if (~exist) {
recentList.remove(exist);
}
recentList.unshift({
path: loaded.file.path,
filename: loaded.file.filename,
title: loaded.json.data.text || minder.getLang('untitleddoc'),
time: +new Date()
});
renderList();
});
function updateTime() {
$ul.find('.file-time').each(function(index, element) {
$(element).text(frdTime.display($(element).data('time')));
});
}
setInterval(updateTime, 60000);
}); });
\ No newline at end of file
/** /**
* @fileOverview * @fileOverview
* *
* * 导出数据到本地
* *
* @author: techird * @author: techird
* @copyright: Baidu FEX, 2014 * @copyright: Baidu FEX, 2014
*/ */
KityMinder.registerUI('menu/save/download', function(minder) {
var $menu = minder.getUI('menu/menu');
var $save = minder.getUI('menu/save/save');
/* 导出面板 */
var $panel = $($save.createSub('download')).addClass('download-panel');
/* 标题 */
var $title = $('<h2></h2>')
.text(minder.getLang('ui.menu.save.download'))
.appendTo($panel);
var $list = $('<ul>')
.addClass('download-list')
.appendTo($panel);
var supports = [];
minder.getSupportedProtocols().forEach(function(protocol) {
if (protocol.encode) {
supports.push(protocol);
}
});
supports.forEach(function(protocol) {
$('<li>')
.addClass(protocol.name)
.text(protocol.fileDescription + ' (' + protocol.fileExtension + ')')
.data('protocol', protocol)
.appendTo($list);
});
$list.delegate('li', 'click', function(e) {
var protocol = $(e.target).data('protocol');
doExport(protocol);
});
function doExport(protocol) {
var filename = minder.getMinderTitle() + protocol.fileExtension;
var mineType = protocol.mineType || 'text/plain';
$panel.addClass('loading');
minder.exportData(protocol.name).then(function(data) {
if (typeof(data) != 'string') return;
switch (protocol.dataType) {
case 'text':
return doDownload(buildDataUrl(mineType), filename, 'text');
case 'base64':
return doDownload(data, filename, 'base64');
}
return null;
}).then(function() {
$panel.removeClass('loading');
$menu.hide();
});
}
function doDownload(url, filename, type) {
var content = url.split(',')[1];
var $form = $('<form></form>').attr({
'action': 'download.php',
'method': 'POST',
'accept-charset': 'utf-8'
});
var $content = $('<input />').attr({
name: 'content',
type: 'hidden',
value: decodeURIComponent(content)
}).appendTo($form);
var $type = $('<input />').attr({
name: 'type',
type: 'hidden',
value: type
}).appendTo($form);
var $filename = $('<input />').attr({
name: 'filename',
type: 'hidden',
value: filename
}).appendTo($form);
$('<input name="iehack" value="&#9760;" />').appendTo($form);
$form.appendTo('body').submit().remove();
}
function buildDataUrl(mineType, data) {
return 'data:' + mineType + '; utf-8,' + encodeURIComponent(data);
}
});
\ No newline at end of file
...@@ -11,19 +11,23 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) { ...@@ -11,19 +11,23 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
var $save = minder.getUI('menu/save/save'); var $save = minder.getUI('menu/save/save');
var $netdiskfinder = minder.getUI('widget/netdiskfinder'); var $netdiskfinder = minder.getUI('widget/netdiskfinder');
var $eve = minder.getUI('eve'); var $eve = minder.getUI('eve');
var $doc = minder.getUI('doc');
var ret = $eve.setup({}); var ret = $eve.setup({});
var protocols = minder.getSupportedProtocols().filter(function(protocol) { /* extension => protocol */
return protocol.encode; var supports = {};
minder.getSupportedProtocols().forEach(function(protocol) {
if (protocol.encode && protocol.decode) {
supports[protocol.fileExtension] = protocol;
}
}); });
/* 网盘面板 */ /* 网盘面板 */
var $panel = $($save.netdisk.getContentElement()).addClass('netdisk-save-panel'); var $panel = $($save.createSub('netdisk', true)).addClass('netdisk-save-panel');
var $finder = $netdiskfinder.generate($panel, function(file) { var $finder = $netdiskfinder.generate($panel, function(file) {
return protocols.some(function(protocol) { return supports[file.extension];
return protocol.fileExtension == file.extension;
}, false);
}); });
var $selects = $('<div class="netdisk-save-select"></div>') var $selects = $('<div class="netdisk-save-select"></div>')
...@@ -33,28 +37,133 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) { ...@@ -33,28 +37,133 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
.text(minder.getLang('ui.saveas')) .text(minder.getLang('ui.saveas'))
.appendTo($selects); .appendTo($selects);
/* 文件名 */
var $filename = $('<input>') var $filename = $('<input>')
.attr('type', 'text')
.attr('placeholder', minder.getLang('ui.filename')) .attr('placeholder', minder.getLang('ui.filename'))
.attr('title', minder.getLang('ui.filename')) .attr('title', minder.getLang('ui.filename'))
.on('keydown', function(e) {
if (e.keyCode == 27) $menu.toggleClass('show');
})
.appendTo($selects); .appendTo($selects);
/* 文件格式 */
var $format = $('<select>') var $format = $('<select>')
.attr('title', minder.getLang('ui.fileformat')) .attr('title', minder.getLang('ui.fileformat'))
.appendTo($selects); .appendTo($selects);
protocols.forEach(function(protocol) { for (var ext in supports) {
var protocol = supports[ext];
if (!protocol.encode) return;
$('<option>') $('<option>')
.text(protocol.fileDescription + '(' + protocol.fileExtension + ')') .text(protocol.fileDescription + '(' + protocol.fileExtension + ')')
.val(protocol.name) .val(ext)
.appendTo($format); .appendTo($format);
}); }
$format.val('json'); $format.val('.km');
/* 保存按钮 */
var $saveBtn = $('<button></button>') var $saveBtn = $('<button></button>')
.addClass('save-button') .addClass('save-button')
.text(minder.getLang('ui.save')) .text(minder.getLang('ui.save'))
.click(save)
.appendTo($selects); .appendTo($selects);
$menu.on('show', setFileName);
$finder.on('fileclick', function(file) {
$finder.select(file.path);
$filename.val(file.filename);
});
function save() {
var filename = $filename.val();
if (fio.file.anlysisPath(filename).extension != $format.val()) {
$filename.val(filename += $format.val())[0].select();
}
var path = $finder.pwd() + filename;
var doc = $doc.current();
var protocol = supports[$format.val()];
var exist = $finder.select(path); // 目标路径存在
var match = doc.path == path; // 目标路径正是当前文档
var duplicated = exist && !match;
if (!exist || match || duplicated && window.confirm(minder.getLang('ui.overrideconfirm', filename))) {
doSave(path, protocol, doc);
}
}
function doSave(path, protocol, doc) {
$panel.addClass('loading');
return minder.exportData(protocol.name).then(function(data) {
return fio.file.write({
path: path,
content: data,
ondup: fio.file.DUP_OVERWRITE
});
}).then(function() {
$panel.removeClass('loading');
$menu.hide();
doc.path = path;
doc.title = $filename.val();
doc.source = 'netdisk';
$doc.save(doc);
setTimeout($finder.list, 500);
})['catch'](function(e) {
window.alert('保存文件失败:' + (e.message || minder.getLang('ui.unknownreason')));
});
}
function setFileName() {
var doc = $doc.current();
switch (doc.source) {
case 'netdisk':
setFileNameForNetDiskSource(doc);
break;
default:
setFileNameForOtherSource(doc);
break;
}
$filename[0].select();
}
function setFileNameForNetDiskSource(doc) {
var path = doc.path;
var pathInfo = fio.file.anlysisPath(path);
// 选中当前文件
if ($finder.pwd() != pathInfo.parentPath) {
$finder.list(pathInfo.parentPath).then(function() {
$finder.select(path);
});
} else {
$finder.select(path);
}
$filename.val(pathInfo.filename);
}
function setFileNameForOtherSource(doc) {
$filename.val(doc.title);
$finder.select(null);
}
return ret; return ret;
}); });
\ No newline at end of file
...@@ -8,41 +8,5 @@ ...@@ -8,41 +8,5 @@
*/ */
KityMinder.registerUI('menu/save/save', function(minder) { KityMinder.registerUI('menu/save/save', function(minder) {
return minder.getUI('menu/menu').createSubMenu('save');
var $level1 = minder.getUI('menu/level1');
var eve = minder.getUI('eve');
var $h2 = $('<h2></h2>')
.text(minder.getLang('ui.menu.save.header'))
.appendTo($level1.save.getContentElement());
var source = ['netdisk', 'local'];
var $tabs = new FUI.Tabs({
buttons: source.map(function(key) {
return {
label: minder.getLang('ui.menu.save.' + key),
className: key
};
})
}).appendTo($level1.save);
// 暴露
var ret = eve.setup({});
// 暴露每个面板
source.forEach(function(key, index) {
ret[key] = $tabs.getPanel(index);
});
// 暴露保存菜单(选项卡)选择事件
$tabs.on('tabsselect', function(e, info) {
ret.fire('select', info);
});
// 暴露选择事件
ret.select = $tabs.select.bind($tabs);
return ret;
}); });
\ No newline at end of file
<form id="share-select">
<div id="shared-tip"></div>
<fieldset id="no-share">
<legend>
<label>
<input name="sharetype" type="radio" value="none" checked />
$lang.none_share
</label>
</legend>
<div class="share-description">
$lang.none_share_description
</div>
</fieldset>
<fieldset id="public-share">
<legend>
<label>
<input name="sharetype" type="radio" value="public"/>
$lang.public_share
</label>
</legend>
<div class="share-description">$lang.public_share_description</div>
<div class="share-body">
<h3>$lang.url_share</h3>
<p>
<input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
<button id="copy-share-url" data-clipboard-target="share-url" type="button">$lang.copy</button>
</p>
<h3>$lang.sns_share</h3>
<p id="share-platform" class="bdsharebuttonbox">
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
</p>
</div>
</fieldset>
<fieldset id="password-share" disabled>
<legend>
<label>
<input name="sharetype" type="radio" value="password" disabled />
$lang.password_share
</label>
</legend>
<div class="share-description">$lang.password_share_description</div>
<div class="share-body">$lang.ondev</div>
</fieldset>
<fieldset id="email-share" disabled>
<legend>
<label>
<input name="sharetype" type="radio" value="email" disabled />
$lang.email_share
</label>
</legend>
<div class="share-description">$lang.email_share_description</div>
<div class="share-body">$lang.ondev</div>
</fieldset>
</form>
\ No newline at end of file
/** /**
* @fileOverview * @fileOverview
* *
* * 分享功能交互
* *
* @author: techird * @author: techird
* @copyright: Baidu FEX, 2014 * @copyright: Baidu FEX, 2014
*/ */
\ No newline at end of file
KityMinder.registerUI('menu/share/share', function(minder) {
var $share_menu = minder.getUI('menu/menu').createSubMenu('share', true);
var $create_menu = $($share_menu.createSub('createshare', true));
var $manage_menu = $($share_menu.createSub('manageshare'));
var $doc = minder.getUI('doc');
var BACKEND_URL = 'http://127.0.0.1/naotu/mongo.php';
var currentShare = null;
var shareList = [];
var panelReady = renderCreatePanel();
panelReady.then(bindCreatePanelEvent);
fio.user.on('login', loadShareList);
fio.user.on('logout', clearShareList);
function renderCreatePanel() {
// render template
return $.pajax('ui/menu/share/create.html').then(function(html) {
/* global jhtmls: true */
var render = jhtmls.render(html);
$create_menu.html(render({
lang: minder.getLang('ui'),
minder: minder
}));
zeroCopy();
return $create_menu;
});
}
function bindCreatePanelEvent($panel) {
$panel.delegate('input[name=sharetype]', 'click', function(e) {
var actions = {
'none': removeShare,
'public': createPublicShare
};
actions[e.target.value]();
});
}
function removeShare() {
if (!currentShare) return;
if (currentShare) {
return $.pajax({
});
}
}
function uuid() {
var timeLead = 1e9;
return ((+new Date() * timeLead) + (Math.random() * --timeLead)).toString(36);
}
function createPublicShare(user) {
if (currentShare) return;
$create_menu.addClass('loading');
return fio.user.check().then(function(user) {
var record = {
shareMinder: {
id: uuid(),
data: JSON.stringify(minder.exportJson())
}
};
var currentDoc = $doc.current();
if (currentDoc.source == 'netdisk') {
record.path = currentDoc.path;
}
return $.pajax(BACKEND_URL, {
type: 'POST',
data: {
action: 'insert',
record: JSON.stringify(record),
ak: user && user.access_token
},
dataType: 'json'
}).then(function(result) {
if (result.error) {
throw new Error(result.error);
}
return result;
})['catch'](function(e) {
window.alert(minder.getLang('create_share_failed', e.message));
});
})
.then(function(shared) {
if (shared) {
currentShare = shared;
renderPublicShare(shared);
}
$create_menu.removeClass('loading');
});
}
function renderPublicShare(shared) {
var $sbody = $('#public-share .share-body', $create_menu);
var baseUrl = /^(.*?)(\?|\#|$)/.exec(window.location.href)[1];
var shareUrl = baseUrl + '?shareId=' + shared.shareMinder.id;
$('#share-url', $sbody).val(shareUrl)[0].select();
var shareConfig = window._bd_share_config.common,
resetShare = window._bd_share_main.init;
if (shareConfig && resetShare) {
shareConfig.bdTitle = shareConfig.bdText = minder.getMinderTitle();
shareConfig.bdDesc = shareConfig.bdText = minder.getLang('ui.sns_share_text', minder.getMinderTitle(), shareUrl);
shareConfig.bdUrl = shareUrl;
resetShare();
}
$sbody.show();
}
function loadShareList() {
var user = fio.user.current();
return $.pajax(BACKEND_URL, {
});
}
function clearShareList() {
shareList = [];
}
function shareRedirect() {
var pattern = /(?:shareId|share_id)=(\w+)([&#]|$)/;
var match = pattern.exec(window.location) || pattern.exec(document.referrer);
if (match) {
window.location.href = 'viewshare.html?shareId=' + match[1];
}
}
function zeroCopy() {
/* global ZeroClipboard:true */
ZeroClipboard.setDefaults({ moviePath: 'lib/ZeroClipboard.swf' });
var $copy_url_btn = $('#copy-share-url', $create_menu);
if (window.ZeroClipboard) {
var clip = new window.ZeroClipboard($copy_url_btn, {
hoverClass: 'hover',
activeClass: 'active'
});
clip.on('dataRequested', function(client, args) {
$copy_url_btn.text(minder.getLang('ui.copied')).attr('disabled', 'disabled');
setTimeout(function() {
$copy_url_btn
.text(minder.getLang('ui.copy'))
.removeAttr('disabled');
}, 3000);
});
}
}
return $share_menu;
});
\ No newline at end of file
/**
* @fileOverview
*
* 查看分享文件
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/share/view', function (minder) {
var $doc = minder.getUI('doc');
var $save = minder.getUI('menu/save');
var $download = minder.getUI('download');
function loadShareDoc(results) {
var user = results[0],
$panel = results[1];
var pattern = /(?:shareId|share_id)=(\w+)([&#]|$)/;
var match = pattern.exec(window.location) || pattern.exec(document.referrer);
if (!match) return Promise.resolve(null);
var shareId = match[1];
function renderShareData(data) {
if (data.error) {
return window.alert(data.error);
}
var content = data.shareMinder.data;
return $doc.load({
source: 'share',
content: content,
protocol: 'json',
saved: false,
ownerId: data.uid,
ownerName: data.uname
}).then(function(doc) {
if (user) {
if (doc.ownerId == user.id) {
}
}
// 分享着不是当前用户
if (doc.ownerId && doc.ownerId != (user && user.id)) {
$('#shared-tip', $panel).text(minder.getLang('ui.shared_tip', doc.ownerName));
}
});
}
return $.pajax({
url: 'http://127.0.0.1/naotu/mongo.php', //'http://naotu.baidu.com/mongo.php',
data: {
action: 'find',
id: shareId
},
dataType: 'json'
}).then(renderShareData)['catch'](function(e) {
window.alert('请求分享文件失败,请重试!');
}).then(function() {
$(minder.getRenderTarget()).removeClass('loading');
});
}
});
\ No newline at end of file
.download-panel {
h2 {
&:before {
content: ' ';
display: block;
width: 25px;
height: 25px;
position: absolute;
left: 0;
background: url(../images/icons.png) no-repeat 0 -595px;
}
}
& > .download-list {
margin: 0;
padding: 0;
list-style: none;
li {
font-size: 14px;
line-height: 20px;
padding: 10px 20px 10px 40px;
cursor: default;
position: relative;
margin: 0;
font-weight: normal;
height: 20px;
line-height: 20px;
&:hover {
background-color: lighten(@tab-hover, 55%);
}
&:active {
background-color: lighten(@tab-hover, 50%);
}
}
}
}
\ No newline at end of file
.draft-panel {
h2 {
&:before {
content: ' ';
display: block;
width: 25px;
height: 25px;
position: absolute;
left: 0;
background: url(../images/icons.png) no-repeat 0 -570px;
}
}
& > .clear-draft {
position: absolute;
right: 0;
top: 0;
}
& > .draft-list {
margin: 0;
padding: 0;
list-style: none;
&:empty:after {
content: '这是个空虚寂寞的草稿箱!';
display: block;
text-align: center;
font-size: 18px;
height: 50px;
line-height: 50px;
color: #CCC;
}
.draft-list-item {
font-size: 14px;
line-height: 20px;
padding: 10px 20px 10px 40px;
cursor: default;
position: relative;
&:hover {
background-color: lighten(@tab-hover, 55%);
}
&:active {
background-color: lighten(@tab-hover, 50%);
}
.draft-title {
margin: 0;
font-weight: normal;
height: 20px;
line-height: 20px;
&:after {
content: ' ';
display: block;
position: absolute;
width: 25px;
height: 25px;
background: url(../images/icons.png) no-repeat 0 -445px;
left: 5px;
top: 10px;
}
}
.file-time {
position: absolute;
right: 5px;
top: 10px;
font-size: 12px;
color: #999;
}
}
}
}
\ No newline at end of file
...@@ -25,53 +25,6 @@ html, body { ...@@ -25,53 +25,6 @@ html, body {
#kityminder { #kityminder {
.dock(@panel-height, 0, 0, 0); .dock(@panel-height, 0, 0, 0);
-moz-user-select: none; -moz-user-select: none;
&.loading {
svg {
.blur;
}
&:after {
content: ' ';
display: block;
.dock;
background: rgba(128, 130, 140, .75);
}
&:before {
content: ' ';
width: 40px;
height: 40px;
border: 4px solid;
border-color: #fff transparent transparent;
box-shadow: 0 0 35px white;
position: absolute;
left: 50%;
top: 50%;
margin-left: -24px;
margin-top: -24px;
z-index: 10;
border-radius: 100%;
-webkit-animation: rotate 1.33s ease infinite;
}
}
}
@-webkit-keyframes rotate {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
}
@-moz-keyframes rotate {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
}
@-ms-keyframes rotate {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
}
@keyframes rotate {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
} }
#panel { #panel {
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
.button; .button;
margin: 0 10px 10px 0; margin: 0 10px 10px 0;
} }
span {
line-height: 30px;
}
} }
.drop-file { .drop-file {
border: 2px dashed #eee; border: 2px dashed #eee;
......
...@@ -38,27 +38,28 @@ ...@@ -38,27 +38,28 @@
#main-menu { #main-menu {
@left-width: 200px; @left-width: 200px;
background: white;
.dock; .dock;
overflow: hidden; overflow: hidden;
transform: scale(0); transform: translate3d(0, -100%, 0);
transform-origin: 0 0; transform-origin: 0 0;
opacity: 0; opacity: 0;
transition: opacity .25s ease, transform .25s ease; transition: opacity .2s ease, transform .2s ease;
z-index: 100; z-index: 100;
&.show { &.show {
opacity: 1; opacity: 1;
transform: scale(1); transform: translate3d(0, 0, 0);
} }
.slide-in() { .slide-in() {
transform: translateX(-(@left-width)) translateZ(0); transform: translateX(-(@left-width)) translateZ(0);
transition: transform .5s ease; transition: transform .7s ease, opacity .5s ease;
.show& { .show& {
transform: translateX(0) translateZ(0); transform: translateX(0) translateZ(0);
transition: transform .5s ease; transition: transform .7s ease, opacity .5s ease;
} }
} }
...@@ -89,26 +90,36 @@ ...@@ -89,26 +90,36 @@
.main-menu-back-button { .main-menu-back-button {
.fui-label { .fui-label {
display: inline-block;
color: white;
margin-left: 10px;
font-size: 14px;
display: none; display: none;
} }
.fui-icon { .fui-icon {
display: block; display: inline-block;
width: 25px; width: 25px;
height: 25px; height: 25px;
line-height: 25px;
border-radius: 100%;
border: 2px solid white;
background: url(../images/icons.png) -1px -370px; background: url(../images/icons.png) -1px -370px;
vertical-align: middle;
} }
width: 25px; width: @left-width - 10px;
height: 25px; height: @panel-height - 10px;
border-radius: 100%; padding: 5px;
border: 2px solid white;
left: 5px;
top: 5px;
cursor: pointer;
&:hover { &:hover {
background-color: rgba(255,255,255,.3); background: -moz-linear-gradient(left, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,0.3)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgba(255,255,255,0.3) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(255,255,255,0.3) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(255,255,255,0.3) 0%,rgba(255,255,255,0) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(255,255,255,0.3) 0%,rgba(255,255,255,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4dffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 */
} }
&:active { &:active {
background-color: rgba(0,0,0,.05); background: darken(@main-menu-theme-color, 10%);
} }
} }
} }
...@@ -125,7 +136,7 @@ ...@@ -125,7 +136,7 @@
color: #999; color: #999;
.slide-in; .slide-in;
} }
&level-1 { &level1 {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
......
...@@ -80,6 +80,13 @@ ...@@ -80,6 +80,13 @@
&:active { &:active {
background-color: lighten(@tab-hover, 50%); background-color: lighten(@tab-hover, 50%);
} }
&.selected {
background-color: lighten(@tab-active, 20%);
color: white;
&.file:before {
background-position: 0 -545px;
}
}
&.file { &.file {
position: relative; position: relative;
&:before { &:before {
...@@ -127,41 +134,15 @@ ...@@ -127,41 +134,15 @@
top: 0; top: 0;
} }
.login-tip {
display: none;
text-align: center;
font-size: 16px;
color: #999;
margin-top: 30px;
a {
text-decoration: underline;
color: @main-menu-theme-color;
cursor: pointer;
&:hover {
color: lighten(@main-menu-theme-color, 10%);
}
}
}
&.require-login {
.login-tip {
display: block;
}
.netdisk-nav, .netdisk-file-list {
display: none;
}
}
} }
// for save // for save
.netdisk-save-panel .netdisk-file-list { .netdisk-save-panel .netdisk-file-list {
bottom: 60px; bottom: 50px;
} }
.netdisk-save-select { .netdisk-save-select {
.dock(auto, 0, 0, 0); .dock(auto, 0, 0, 0);
height: 30px; height: auto;
padding: 10px; padding: 10px;
border-top: 1px solid #EEE; border-top: 1px solid #EEE;
background: #fcfcfc; background: #fcfcfc;
...@@ -174,29 +155,22 @@ ...@@ -174,29 +155,22 @@
} }
& > input { & > input {
width: 50%; width: 50%;
padding: 2px 5px;
height: 16px;
outline: none;
border: 1px solid lighten(@tab-hover, 30%);
margin: 0; margin: 0;
margin-top: 5px; margin-top: 5px;
margin-right: 10px;
&:focus {
border-color: lighten(@tab-active, 40%);
}
vertical-align: middle; vertical-align: middle;
} }
& > select { & > select {
margin: 5px 0 0 10px; margin: 5px 0 0 0;
outline: none; outline: none;
vertical-align: middle; vertical-align: middle;
} }
& > .save-button { & > .save-button {
position: absolute; float: right;
right: 10px;
top: 10px;
width: 80px; width: 80px;
vertical-align: middle;
} }
} }
\ No newline at end of file
...@@ -29,4 +29,103 @@ ...@@ -29,4 +29,103 @@
right: @right; right: @right;
bottom: @bottom; bottom: @bottom;
left: @left; left: @left;
}
.validate-error {
color: red;
border-color: red !important;
}
.button, button {
display: inline-block;
height: 30px;
padding: 0 15px;
line-height: 30px;
text-align: center;
outline: none;
background: lighten(@tab-active, 20%);
&:hover, &.hover {
background: lighten(@tab-hover, 20%);
}
&:active, &.active {
background: lighten(@tab-active, 15%);
}
&:disabled {
background: #CCC;
&:hover, &.hover,
&:active, &.active {
background: #CCC;
}
}
cursor: default;
color: @ui-fore;
border: none;
}
input[type=text],
input[type=url] {
padding: 2px 5px;
height: 16px;
outline: none;
border: 1px solid lighten(@tab-hover, 50%);
box-shadow: inset 0 1px 3px rgba(0,0,0,.05);
border-radius: 2px;
&:focus {
border-color: hsl(223, 38%, 55%);
}
}
.loading(@color: rgb(128, 130, 140), @border-color: #fff) {
.loading-target {
.blur;
}
&:after {
content: ' ';
display: block;
.dock;
background: fadeOut(@color, 25%);
}
&:before {
content: ' ';
width: 40px;
height: 40px;
border: 4px solid;
border-color: @border-color transparent transparent;
box-shadow: 0 0 35px white;
position: absolute;
left: 50%;
top: 50%;
margin-left: -24px;
margin-top: -24px;
z-index: 10;
border-radius: 100%;
-webkit-animation: rotate 1.33s ease infinite;
filter: none;
-webkit-filter: none;
}
}
.loading {
.loading();
}
@-webkit-keyframes rotate {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
}
@-moz-keyframes rotate {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
}
@-ms-keyframes rotate {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
}
@keyframes rotate {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
} }
\ No newline at end of file
...@@ -12,11 +12,27 @@ ...@@ -12,11 +12,27 @@
} }
} }
& > .clear-recent-list {
position: absolute;
right: 0;
top: 0;
}
& > .recent-file-list { & > .recent-file-list {
margin: 0; margin: 0;
padding: 0; padding: 0;
list-style: none; list-style: none;
&:empty:after {
content: '没有最近打开文件!';
display: block;
text-align: center;
font-size: 18px;
height: 50px;
line-height: 50px;
color: #CCC;
}
.recent-file-item { .recent-file-item {
font-size: 14px; font-size: 14px;
line-height: 20px; line-height: 20px;
......
#share-dialog { #share-select {
display: none; fieldset {
border: 1px solid #f0f0f0;
margin: 0;
margin-bottom: 10px;
padding: 10px;
legend {
font-size: 14px;
}
&:disabled {
opacity: 0.5;
}
.share-description {
}
.share-body {
margin-top: 10px;
}
}
}
#public-share {
p {
position: relative;
max-width: 500px;
input {
width: 100%;
box-sizing: border-box;
height: 24px;
margin: 0;
}
#copy-share-url {
position: absolute;
right: 0;
top: 0;
margin: 0;
height: 24px;
line-height: 24px;
border-radius: 2px;
}
}
.share-body {
display: none;
}
} }
\ No newline at end of file
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
float: right; float: right;
height: @panel-height; height: @panel-height;
line-height: @panel-height; line-height: @panel-height;
font-size: 14px;
color: @ui-fore;
vertical-align: baseline;
.fui-button { .fui-button {
...@@ -41,4 +44,29 @@ ...@@ -41,4 +44,29 @@
background: url(../images/icons.png) 0 -320px; background: url(../images/icons.png) 0 -320px;
} }
} }
}
.login-tip {
display: none;
}
.login-required {
& > * {
display: none;
}
& > .login-tip {
display: block;
text-align: center;
font-size: 16px;
color: #999;
margin-top: 30px;
a {
text-decoration: underline;
color: @main-menu-theme-color;
cursor: pointer;
&:hover {
color: lighten(@main-menu-theme-color, 10%);
}
}
}
} }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
@import "_recent"; @import "_recent";
@import "_netdisk"; @import "_netdisk";
@import "_localfile"; @import "_localfile";
@import "_draft";
@import "_download";
@import "_priority_panel"; @import "_priority_panel";
@import "_progress_panel"; @import "_progress_panel";
......
ui/theme/default/images/icons.png

8.9 KB | W: | H:

ui/theme/default/images/icons.png

9.82 KB | W: | H:

ui/theme/default/images/icons.png
ui/theme/default/images/icons.png
ui/theme/default/images/icons.png
ui/theme/default/images/icons.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -44,9 +44,7 @@ KityMinder.registerUI('topbar/title', function(minder) { ...@@ -44,9 +44,7 @@ KityMinder.registerUI('topbar/title', function(minder) {
setSaved: function(saved) { setSaved: function(saved) {
if (saved !== false) { _saved = saved !== false;
_saved = true;
}
update(); update();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment