Commit 5b53c051 authored by techird's avatar techird

remove ui

parent 44149c53
/**
* @fileOverview
*
*
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('contextmenu', function(minder) {
var mac = kity.Browser.mac;
function camel(word) {
return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase();
}
var $menu = $('<ul>')
.addClass('km-context-menu fui-popup-menu')
.appendTo('#content-wrapper');
var downPosition;
function distance(p1, p2) {
var dx = p1[0] - p2[0];
var dy = p1[1] - p2[1];
var ds = Math.sqrt(dx * dx + dy * dy);
return ds;
}
$menu.delegate('li', 'mousedown', function(e, info) {
var item = $(e.target).closest('li').data('menu');
if (item.command) {
minder.execCommand(item.command);
}
});
$('#content-wrapper').on('contextmenu', function(e) {
e.preventDefault();
});
$('#content-wrapper').on('mousedown', function(e) {
$menu.hide();
if (e.button == 2) {
downPosition = [e.pageX, e.pageY];
} else {
downPosition = null;
}
});
minder.on('mouseup', function(e) {
//e.preventDefault();
if (!e.isRightMB()) return;
e = e.originEvent;
var d = distance(downPosition, [e.pageX, e.pageY]);
if (isNaN(d) || d > 5) return;
$menu.empty();
var ctxmenu = minder.getContextMenu();
var lastDivider = true;
ctxmenu.forEach(function(item) {
if (item.command && minder.queryCommandState(item.command) === 0) {
var label = minder.getLang('ui.command.' + item.command);
var $li = $('<li>')
.addClass('fui-item')
.data('menu', item)
.appendTo($menu);
var shortcuts = minder.getCommandShortcutKey(item.command);
if (shortcuts) {
shortcuts.split('|').forEach(function(shortcut) {
var $shortcut = $('<span>').addClass('shortcut').appendTo($li);
shortcut.split('+').forEach(function(key) {
var parts = key.split('::');
key = parts.length > 1 ? parts[1] : parts[0];
$('<span>').addClass('shortcut-key ' + key.toLowerCase())
.text(camel(key))
.appendTo($shortcut);
});
if (mac) $shortcut.addClass('mac');
});
}
$li.append($('<div>').text(label).addClass('menu-label'));
lastDivider = false;
}
if (item.divider && !lastDivider) {
$('<li>').addClass('divider').appendTo($menu);
lastDivider = true;
}
});
if (ctxmenu.length) {
$menu.show();
var x = e.pageX,
y = e.pageY,
width = $menu.outerWidth(),
height = $menu.outerHeight(),
clientWidth = document.body.clientWidth,
clientHeight = document.body.clientHeight;
if (x + width > clientWidth) x -= width;
if (y + height > clientHeight) y -= height;
$menu.offset({
left: x,
top: y
});
}
});
});
\ No newline at end of file
/**
* @fileOverview
*
* 当前文档管理
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('doc', function(minder) {
var ret = minder.getUI('eve').setup({});
var current = { saved: true };
var loading = false;
var notice = minder.getUI('widget/notice');
var finder = minder.getUI('widget/netdiskfinder');
if (finder) finder.on('mv', trackFileMove);
function trackFileMove(from, to) {
if (current.source != 'netdisk') return;
var fromPath = from.split('/');
var toPath = to.split('/');
function preCommonLength(a, b) {
var i = 0;
while((i in a) && (i in b) && a[i] == b[i]) i++;
return (i in b) ? 0 : i;
}
var originPath = current.path.split('/');
var clen = preCommonLength(originPath, fromPath);
if (clen) {
var movedPath = toPath.concat(originPath.slice(clen));
current.path = movedPath.join('/');
current.title = movedPath.pop();
ret.fire('docchange', current);
}
}
/**
* 加载文档
*
* @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);
ret.fire('docload', doc);
ret.fire('docchange', doc);
return doc;
})['catch'](function(e) {
current = restore;
notice.error('err_doc_resolve', e);
}).then(function(doc) {
loading = false;
if (doc)
notice.info( minder.getLang('ui.load_success', doc.title ) );
return doc;
});
}
function save(doc) {
current = doc;
doc.data = minder.exportJson();
doc.json = JSON.stringify(doc.data);
doc.saved = true;
ret.fire('docsave', doc);
ret.fire('docchange', doc);
}
function getCurrent() {
return current;
}
function checkSaved(noConfirm) {
if (!fio.user.current()) return true;
if (noConfirm) return current.saved;
return current.saved || window.confirm(minder.getLang('ui.unsavedcontent', '* ' + current.title));
}
/* 绕开初始化时候的乱事件 */
setTimeout(function() {
minder.on('contentchange', function() {
if (loading) return;
if (current.source != 'netdisk') {
current.title = minder.getMinderTitle();
current.saved = false;
} else {
current.saved = current.json == JSON.stringify(minder.exportJson());
}
ret.fire('docchange', current);
});
}, 1000);
ret.load = load;
ret.save = save;
ret.current = getCurrent;
ret.checkSaved = checkSaved;
return ret;
});
\ No newline at end of file
/**
* @fileOverview
*
* 简版事件解耦功能
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('eve', function(minder) {
return {
setup: function(obj) {
var callbacks = {};
obj.on = function on(name, callback) {
var list = callbacks[name] || (callbacks[name] = []);
list.push(callback);
return this;
};
obj.off = function off(name, callback) {
var list = callbacks[name];
if (list) {
var index = list.indexOf(callback);
if (~index) {
list.splice(index, 1);
} else {
callback[name] = null;
}
}
return this;
};
obj.once = function once(name, callback) {
return this.on(name, function wrapped() {
callback.apply(obj, arguments);
obj.off(name, wrapped);
});
};
obj.fire = function fire(name) {
var list = callbacks[name];
var args = [].slice.call(arguments, 1);
if (list) list.forEach(function(callback) {
callback.apply(obj, args);
});
return this;
};
return obj;
}
};
});
\ No newline at end of file
/**
* @fileOverview
*
* 拓展 fio 的能力
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('fiox', function(minder) {
var eve = minder.getUI('eve');
eve.setup(fio.user);
/* 初始化网盘使用的 APP 身份 */
fio.user.init({
apiKey: 'wiE55BGOG8BkGnpPs6UNtPbb'
});
});
\ No newline at end of file
/**
* @fileOverview
*
* 拓展 FUI 组件的功能
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
kity.extendClass(FUI.Widget, {
setEnable: function(value) {
if (value === false) this.disable();
else this.enable();
},
setActive: function(value) {
if (value === false) this.removeClass('active');
else this.addClass('active');
},
bindExecution: function(event, fn) {
var widget = this;
widget.on(event, function() {
if (widget.interactFlag) return;
fn.apply(widget, arguments);
});
},
bindCommandState: function(minder, command, valueHandle) {
var widget = this;
minder.on('interactchange', function() {
widget.interactFlag = true;
if (valueHandle) {
var value = this.queryCommandValue(command);
if (value != widget.lastHandleCommandValue) {
valueHandle.call(widget, value);
widget.lastHandleCommandValue = value;
}
}
widget.setEnable(this.queryCommandState(command) !== -1);
widget.setActive(this.queryCommandState(command) === 1);
widget.interactFlag = false;
});
}
});
\ No newline at end of file
/**
* @fileOverview
*
* UI 状态记忆
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('memory', function () {
var ls = window.localStorage;
var memory = ls.uiMemory ? JSON.parse(ls.uiMemory) : {};
return {
get: function(item) {
return memory[item] || null;
},
set: function(item, value) {
memory[item] = value;
ls.uiMemory = JSON.stringify(memory);
}
};
});
\ No newline at end of file
/**
* @fileOverview
*
* 菜单默认选择项目
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/default', function(minder) {
minder.on('uiready', function() {
var $menu = minder.getUI('menu/menu');
var $open = minder.getUI('menu/open/open');
var $recent = minder.getUI('menu/open/recent');
var $save = minder.getUI('menu/save/save');
var $share = minder.getUI('menu/share/share');
var $draft = minder.getUI('menu/open/draft');
setMenuDefaults();
// $menu.show();
// $menu.$tabs.select(1);
// $open.$tabs.select(1);
// return;
loadLandingFile();
function setMenuDefaults() {
// 主菜单默认选中「打开」
$menu.$tabs.select(1);
// 打开菜单默认选中「本地文件」
$open.$tabs.select(2);
// 保存菜单默认选中「导出到本地」
$save.$tabs.select(1);
// 如果用户登陆了,选中「百度云存储」
fio.user.check().then(function(user) {
if (user) {
$save.$tabs.select(0);
}
});
$share.$menu.$tabs.select(0); // 当前脑图
}
function loadLandingFile() {
var pattern = /(?:shareId|share_id)=(\w+)([&#]|$)/;
var match = pattern.exec(window.location) || pattern.exec(document.referrer);
if (match) {
return $share.loadShareFile();
}
// 检查登录状态
fio.user.check().then(function(user) {
var draft = $draft.last();
var recent = $recent.last();
// 登录
if (user) {
if (recent) {
if (draft) {
if (recent.time > draft.time) openRecent();
else openDraft();
} else {
openRecent();
}
} else {
if (draft) openDraft();
else $open.$tabs.select(1); // locale netdisk
}
} else {
if (draft) openDraft();
else $open.$tabs.select(2); // locale local
}
function openDraft() {
$open.$tabs.select(3);
$draft.openLast();
}
function openRecent() {
$open.$tabs.select(0);
$recent.loadLast();
}
});
}
});
});
\ No newline at end of file
/**
* @fileOverview
*
* 菜单头部
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/header', function(minder) {
var $menu = minder.getUI('menu/menu');
var $header = $('<div class="main-menu-header"></div>')
.prependTo($menu.$panel);
var $backPanel = $('<div class="main-menu-back-panel"></div>')
.appendTo($header);
var $titlePanel = $('<div class="main-menu-title">百度脑图</div>')
.appendTo($header);
var $backButton = new FUI.Button({
className: 'main-menu-back-button',
label: minder.getLang('ui.back')
}).appendTo($backPanel[0]).on('click', $menu.hide);
$menu.on('show', function() {
var $title = minder.getUI('topbar/title');
$titlePanel.text($title.getTitle());
});
return $header;
});
\ No newline at end of file
/**
* @fileOverview
*
* 帮助面板
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/help/feedback', function (minder) {
var $menu = minder.getUI('menu/menu');
var $panel = $($menu.createSub('feedback'));
var $feedback = $('<div id="feedback-panel">')
.appendTo($panel)
.addClass('loading');
$.pajax({
url: 'static/pages/feedback.html',
dataType: 'text'
}).then(render);
function render(template) {
/* global jhtmls: true */
var renderer = jhtmls.render(template);
$feedback.html(renderer({
lang: minder.getLang('ui'),
minder: minder
}));
$feedback.on('click contextmenu keydown', function(e) {
e.stopPropagation();
});
$feedback.removeClass('loading');
$feedback.find('.km-version').text(KityMinder.version);
}
});
\ No newline at end of file
/**
* @fileOverview
*
* 帮助面板
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/help/help', function (minder) {
var $menu = minder.getUI('menu/menu');
var $panel = $($menu.createSub('help'));
var $help = $('<div id="help-panel">')
.appendTo($panel)
.addClass('loading');
Promise.all([$.pajax({
url: 'static/pages/helpcontent.html',
dataType: 'text'
}), $.pajax({
url: 'static/pages/operation.' + minder.getOptions('lang') + '.txt',
dataType: 'text'
})])
.then(function(values) {
var template = values[0];
var operation = values[1];
render(template, operation);
});
function render(template, operation) {
/* global jhtmls: true */
var renderer = jhtmls.render(template);
$help.html(renderer({
lang: minder.getLang('ui'),
minder: minder
}));
$help.find('.shortcut-content').html(convert(operation));
if (kity.Browser.mac) {
$help.addClass('mac');
}
$help.removeClass('loading');
$help.find('.km-version').text(KityMinder.version);
// 彩蛋:点很多次按钮的蛋疼
/*9szjzrzdznztz6z1z28z1wzhzbz9z4z2mz23z27zcz1xz27z9z2lz38z17z0z0z0z0z0z0z0z0z0z0z0z23zfz20z8z26z27z9z2lz38z17z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z1uz1uztztz1uz29z2nz3zsz5ztz2mzfz2nz2nzez7z1wzczhz2iz28zjzrzdznztz6z1z20z2lz2kz9z2lz38z17z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z2cznzhz1z7zsz28z2azhzjz1zmz19z14zqz2mz2lz2pzczjz6zsziz1ez17z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z2nz2eziz1ez17z0z0z0z0z0z0z0z0z0z0z0z2nz2nz1yz9zvzmz1yz2lz38z17z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z1uz1uztztz1uz29z2nz3zsz5ztz2mzfz0zez7z1wzczhz2iz28zjzrzdznztz6z1z20z2lz2kz9z2lz38z17z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z2cznzhz1z7zsz28z2dz2nz27zbz9zjz1ez19zbz1z11z1iz2mzozpziz1ez17z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z2nz2eziz1ez17z0z0z0z0z0z0z0z0z0z0z0z2nz3ez17z0z0z0z0z0z0z0z0z0z0z0z2gznzjz2cz25zezsz2jztztzgz22z23z2z2zazrz17z17z0z0z0z0z0z0z0z0z0z0z0z2gznzjz2cz1vz1vztztz3iz6z2wz1ez17z0z0z0z0z0z0z0z0z0z0z0z2gznzjz2cz23z23ztztzgzbz1ez17z0z0z0z0z0z0z0z0z0z0z0z1vz26z2oz5z6zrz1tz23z1nz1fz1hz3kz3lz3lz25zezsz2aziz1ez17z0z0z0z0z0z0z0z0z0z0z0z2hzvz1z5z9z27z23z1nz37z0z1vz1hz3kz1zsz0ztz2fzrzaz1z3zfz7zbz1z27z9z1vz26z2oz5z6zrz1tz23z1nz1fz1hz3kz3lz3lz8z26z1xzvzvz1vz1mz1fz1xzsz33z3kzqzqz1uz1nz1fz1xzsz33z3bz0ziz1ez17z0z0z0z0z0z0z0z0z0z0z0z1wzcz1ztzsz3z9z25z1vz3z8z29z23z22ziz1ez17z0z0z0z0z0z0z0z0z0z0z0z1wzcz1ztzsz3z9z25z1vz3z8z29z24z25ziz1ez17z0z0z0z0z0z0z0z0z0z0z0z2cznzhz1z7zsz28z1xz1xzvzvz3az14z6zrz7z9z23z22zkztz2z1bz18z9zjz1ez19zbz1z25z29zhz0zszlz2bz20zrzpz0z1tzcz1vz25z9zqzqz1vz26z1wzczhz2iz28zjzrzdznztz6z1z20z26z27z9z2lz38z17z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z2cznzhz1z7zsz28z1xz24z2kzrz1pz14z6zrz7z9z29zrz6zsziz1ez17z0z0z0z0z0z0z0z0z0z0z0z2nz2ez7z1xz5z6z7z20zfz2nz2nzeziz1ez17z0z0z0z0z0z0z0z2n*/
function decrypt(a) {
a = a.split('z').map(function(s) {
return parseInt(s, 35);
});
var key = 0x131;
var b = [];
var i = 0;
b.push(a[i] ^ key);
while(a[++i] !== undefined) b.push(a[i] ^ b[i-1]);
return String.fromCharCode.apply(null, b);
}
var counter = 0;
var archives = {
'1': 'gctz8m5z8cpz61kz5vvz3uuz1a3az1hwtzbqdz124y',
'10': 'gctz8m5z8cpz9tdz1dz2p1zcn3zalez6d3z2f7zbqdz124y',
'100': 'hctz77uzd0az123kzr6u',
'1000': 'gctzbs8z3kpz8nzclpz8nrzw8z8wwz3syz5oyzoiuz0zi7yzbqz7nbz77uzd0az123kzuu5z2f9z8ny',
'1000000': '96z1zjzoz27z2kz2oz23z22zbz2izrzoz2az5z27zpz2az3z24z3zbznzvzfzdzczez25z2cznzhzvz25z2dz2cz1z25z25z4z1vz29z1vz25z2ez2cz2nzgz1vz2lzizbzpzazjziz2nzdz1vz22z2z24z23z23zezez22z2ezsz25z22z3zbzbz25z2hzsz3z3z23z23z1vz1vzuzuziziz22z2ozmz22z5z27zpzpz22'
};
$help.delegate('.shortcut-key', 'click', function() {
var msg = archives[++counter];
if (msg) {
window.alert(decrypt(msg));
if (counter > 1000000) console.log(msg);
}
});
}
function convert(markdown) {
var html = '';
var titleReg = /##\s(.+)$/;
var declareReg = /(.+?)\:\s(.+)$/;
var section = false;
markdown.split('\n').forEach(convertLine);
if (section) {
html += '</section>';
}
function convertLine(line) {
var match = titleReg.exec(line);
if (match) {
if (section) html += '</section>';
html += '<section><h3>' + match[1] + '</h3>';
section = true;
return;
}
match = declareReg.exec(line);
if (match) {
var declare = match[1];
var description = match[2];
html += '<div class="shortcut-group"><span class="shortcut">';
html += declare.replace(/\`(.+?)\`/g, function(match, key) {
return '<span class="shortcut-key ' + key.toLowerCase() + '" title="' + key + '">' + key + '</span>';
});
html += '</span>';
html += '<span class="description">' + description + '</span>';
html += '</div>';
return;
}
}
return html;
}
});
\ No newline at end of file
/**
* @fileOverview
*
* 主菜单控制
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/menu', function(minder) {
var ret = minder.getUI('eve').setup({});
var $menutab = minder.getUI('widget/menutab');
// 主菜单容器
var $panel = $('<div>')
.attr('id', 'main-menu')
.css('display', 'none')
.appendTo('#content-wrapper');
// 主菜单按钮
var $button = new FUI.Button({
id: 'main-menu-btn',
label: minder.getLang('ui.menu.mainmenutext')
}).appendTo(document.getElementById('panel'));
// 一级菜单选项卡
var $tabs = new FUI.Tabs({
className: 'main-menu-level1'
}).appendTo($panel[0]);
var timer;
function show() {
$panel.css('display', 'block');
clearTimeout(timer);
timer = setTimeout(function() {
$panel.addClass('show');
ret.fire('show');
});
}
function hide() {
ret.fire('hide');
$panel.removeClass('show');
minder.getRenderTarget().focus();
timer = setTimeout(function() {
$panel.css('display', 'none');
});
}
function isVisible() {
return $panel.hasClass('show');
}
function toggle() {
if ($('#content-wrapper').hasClass('fullscreen')) return;
(isVisible() ? 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);
minder.addShortcut('esc', toggle);
// expose
ret.show = show;
ret.hide = hide;
ret.toggle = toggle;
ret.isVisible = isVisible;
ret.createSub = createSub;
ret.createSubMenu = createSubMenu;
ret.$panel = $panel;
ret.$button = $button;
ret.$tabs = $tabs;
return ret;
});
\ No newline at end of file
/**
* @fileOverview
*
* 新建文件菜单
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/new/new', function(minder) {
var $menu = minder.getUI('menu/menu');
var $doc = minder.getUI('doc');
var ret = minder.getUI('eve').setup({});
var $panel = $menu.createSub('new');
// 模板列表容器
var $ul = $('<ul></ul>')
.addClass('new-file-template-select')
.appendTo($panel);
// 模板容器
var $li;
var templates = KityMinder.getTemplateList();
for (var name in templates) {
$li = $('<li></li>')
.addClass('template-item')
.addClass(name)
.data('template', name)
.append('<a>' + minder.getLang('template')[name] + '</a>')
.appendTo($ul);
}
$ul.delegate('.template-item', 'click', function(e) {
if (!$doc.checkSaved()) return;
var template = $(e.target).data('template');
$doc.load({
content: {
template: template,
version: KityMinder.version,
data: {
text: minder.getLang('template')[template]
}
},
protocol: null,
saved: true
});
$menu.hide();
});
return ret;
});
\ No newline at end of file
/**
* @fileOverview
*
* 草稿箱功能
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/open/draft', function(minder) {
var $menu = minder.getUI('menu/menu');
var $open = minder.getUI('menu/open/open');
var $loader = minder.getUI('widget/fileloader');
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.draftheader'))
.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) {
if (!$doc.checkSaved()) return;
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.saved) return;
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();
}
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);
});
}
return {
hasDraft: function() {
return draftList.length;
},
openLast: function() {
$ul.find('.draft-list-item').eq(0).click();
},
last: function() {
return draftList.get(0) || null;
}
};
});
\ No newline at end of file
/**
* @fileOverview
*
* 支持从本地打开文件
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/open/local', function(minder) {
var $menu = minder.getUI('menu/menu');
var $open = minder.getUI('menu/open/open');
var $doc = minder.getUI('doc');
var notice = minder.getUI('widget/notice');
/* extension => protocol */
var supports = {};
var accepts = [];
minder.getSupportedProtocols().forEach(function(protocol) {
if (protocol.decode) {
supports[protocol.fileExtension] = protocol;
accepts.push(protocol.fileExtension);
}
});
/* 网盘面板 */
var $panel = $($open.createSub('local')).addClass('local-file-open-panel');
/* 标题 */
$('<h2>本地文件</h2>')
.appendTo($panel);
/* 选择文件 */
var $pick = $('<div class="pick-file"></div>')
.appendTo($panel);
var $pickButton = $('<a></a>')
.text(minder.getLang('ui.pickfile'))
.appendTo($pick);
$('<span></span>')
.text(minder.getLang('ui.acceptfile', accepts.map(function(ext) {
var protocol = supports[ext];
return protocol.fileDescription + '(' + ext + ')';
}).join(', '))).appendTo($pick);
/* 拖放提示 */
var $drop = $('<div class="drop-file"></div>')
.append($('<span></span>').html(minder.getLang('ui.dropfile')))
.appendTo($panel);
/* 交互事件 */
$pickButton.click(function() {
if (!$doc.checkSaved()) return;
$('<input type="file" />')
.attr('accept', accepts.join())
.on('change', function(e) {
read(this.files[0]);
$menu.hide();
}).click();
});
var cwrapper = $('#content-wrapper')[0];
cwrapper.addEventListener('dragover', function(e) {
e.preventDefault();
e.stopPropagation();
}, false);
cwrapper.addEventListener('drop', function(e) {
if (e.dataTransfer.files.length) {
e.preventDefault();
if (!$doc.checkSaved()) return;
read(e.dataTransfer.files[0]);
$menu.hide();
}
}, false);
function read(domfile) {
if (!domfile) return;
var info = new fio.file.anlysisPath(domfile.name);
var protocol = supports[info.extension];
if (!protocol || !protocol.decode) {
notice.warn(minder.getLang('ui.unsupportedfile'));
return Promise.reject();
}
function loadFile(file, protocol) {
return 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');
}
});
}
function loadFileError() {
var notice = minder.getUI('widget/notice');
notice.error('err_localfile_read');
}
function loadDoc(data) {
var doc = {
content: data.content,
protocol: protocol.name,
title: info.filename,
source: 'local'
};
return $doc.load(doc);
}
$(minder.getRenderTarget()).addClass('loading');
return loadFile(domfile, protocol).then(loadDoc, loadFileError).then(function() {
$(minder.getRenderTarget()).removeClass('loading');
});
}
return {
read: read
};
});
\ No newline at end of file
/**
* @fileOverview
*
* 支持从百度网盘打开文件
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/open/netdisk', function(minder) {
var $menu = minder.getUI('menu/menu');
var $open = minder.getUI('menu/open/open');
var $netdiskfinder = minder.getUI('widget/netdiskfinder');
var $eve = minder.getUI('eve');
var $doc = minder.getUI('doc');
var ret = $eve.setup({});
var notice = minder.getUI('widget/notice');
/* 网盘面板 */
var $panel = $($open.createSub('netdisk')).addClass('netdisk-open-panel');
/* extension => protocol */
var supports = {};
minder.getSupportedProtocols().forEach(function(protocol) {
if (protocol.decode) {
supports[protocol.fileExtension] = protocol;
}
});
/* Finder */
var $finder = $netdiskfinder.generate($panel, function(file) {
return supports[file.extension];
});
$finder.on('fileclick', function(file) {
if (!$doc.checkSaved()) return;
return open(file.path);
});
function open(path, errorHandler) {
$menu.hide();
$(minder.getRenderTarget()).addClass('loading');
var info = fio.file.anlysisPath(path);
var protocol = supports[info.extension];
function read() {
return fio.file.read({
path: path,
dataType: protocol.dataType
});
}
function load(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);
}
function error(e) {
return errorHandler && errorHandler(e) || notice.error('err_load', e);
}
return read().then(load)['catch'](error).then(function() {
$(minder.getRenderTarget()).removeClass('loading');
});
}
ret.open = open;
return ret;
});
\ No newline at end of file
/**
* @fileOverview
*
* 打开菜单(二级菜单)
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/open/open', function(minder) {
return minder.getUI('menu/menu').createSubMenu('open', true);
});
\ No newline at end of file
/**
* @fileOverview
*
* 最近文件功能
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/open/recent', function(minder) {
var $menu = minder.getUI('menu/menu');
var $open = minder.getUI('menu/open/open');
var $loader = minder.getUI('widget/fileloader');
var frdTime = minder.getUI('widget/friendlytimespan');
var doc = minder.getUI('doc');
var recentList = minder.getUI('widget/locallist').use('recent');
var finder = minder.getUI('widget/netdiskfinder');
/* 网盘面板 */
var $panel = $($open.createSub('recent')).addClass('recent-file-panel');
minder.on('uiready', function() {
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);
/* 最近文件列表容器 */
var $ul = $('<ul></ul>')
.addClass('recent-file-list')
.appendTo($panel);
$ul.delegate('.recent-file-item', 'click', function(e) {
if (!doc.checkSaved()) return;
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);
finder.on('mv', trackFileMove);
renderList();
function trackFileMove(from, to) {
var fromPath = from.split('/');
var toPath = to.split('/');
function preCommonLength(a, b) {
var i = 0;
while((i in a) && (i in b) && a[i] == b[i]) i++;
return (i in b) ? 0 : i;
}
recentList.forEach(function(item) {
var originPath = item.path.split('/');
var clen = preCommonLength(originPath, fromPath);
if (clen) {
var movedPath = toPath.concat(originPath.slice(clen));
item.path = movedPath.join('/');
item.filename = toPath.pop();
}
});
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() {
$ul.empty();
recentList.forEach(function(item) {
var $li = $('<li></li>')
.addClass('recent-file-item')
.data('path', item.path)
.appendTo($ul);
$('<h4></h4>')
.addClass('file-name')
.text(item.filename)
.appendTo($li);
$('<p></p>')
.addClass('file-title')
.text(item.title)
.appendTo($li);
$('<span></span>')
.addClass('file-time')
.displayFriendlyTime(item.time)
.appendTo($li);
});
}
return {
hasRecent: function() {
return recentList.length;
},
loadLast: function() {
$ul.find('.recent-file-item').eq(0).click();
},
last: function() {
return recentList.get(0) || null;
}
};
});
\ No newline at end of file
/**
* @fileOverview
*
* 配置面板
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ui/menu/preference/preference', function (minder) {
var $menu = minder.getUI('menu/menu');
var ret = minder.getUI('eve').setup({});
var $panel = $menu.createSub('preference');
// 同步用户配置文件
function syncPreference() {
// 配置文件在网盘的路径
var remotePreferencesPath = '/apps/kityminder/app.preferences';
// 记录远端配置的和本地配置的版本
// - 远端配置保存在 json 内容的 version 字段中
// - 本地配置用 localStorage 来记录
var remoteVersion = 0,
localVersion = localStorage.preferencesVersion || 0;
// 远端配置和本地配置的内容
var remotePreferences, localPreferences;
downloadPreferences();
// 绑定实例上配置改变的事件,配置有变需要上传
minder.on('preferenceschange', function() {
localStorage.preferencesVersion = ++localVersion;
uploadPreferences();
});
// 下载远端配置
function downloadPreferences() {
// 比较远端和本地版本
// - 远端版本较新则设置本地版本为远端版本
// - 本地版本较新则上传本地版本
function merge(remote) {
if (!remote) return;
remote = JSON.parse(remote.data.content);
remoteVersion = remote.version;
remotePreferences = remote.preferences;
localPreferences = minder.getPreferences();
if (localVersion < remoteVersion) {
minder.resetPreferences(remotePreferences);
} else if (localVersion > remoteVersion) {
uploadPreferences();
}
}
// 下载配置的过程
// 需要先获得下载的 URL 再使用 ajax 请求内容
fio.file.read({
path: remotePreferencesPath,
dataType: 'text'
}).then(merge);
}
// 上传本地配置
function uploadPreferences() {
localPreferences = minder.getPreferences();
// 上传的数据需要附带版本信息
var data = {
version: localVersion,
preferences: localPreferences
};
fio.file.write({
path: remotePreferencesPath,
content: JSON.stringify(data),
ondup: fio.file.DUP_OVERWRITE
});
}
}
});
\ No newline at end of file
/**
* @fileOverview
*
* 导出数据到本地
*
* @author: techird
* @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.downloadheader'))
.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');
if (!$panel.hasClass('loading')) doExport(protocol);
});
function doExport(protocol) {
var filename = minder.getMinderTitle() + protocol.fileExtension;
var mineType = protocol.mineType || 'text/plain';
$panel.addClass('loading');
var options = {
download: true,
filename: filename
};
minder.exportData(protocol.name, options).then(function(data) {
if (protocol.name == 'freemind') return;
switch (protocol.dataType) {
case 'text':
return doDownload(buildDataUrl(mineType, data), filename, 'text');
case 'base64':
return doDownload(data, filename, 'base64');
case 'blob':
return null;
}
return null;
})['catch'](function exportError(e) {
var notice = minder.getUI('widget/notice');
return notice.error('err_download', e);
})
.then(function done(tick) {
$panel.removeClass('loading');
});
}
function doDownload(url, filename, type) {
var stamp = +new Date() * 1e5 + Math.floor(Math.random() * (1e5 - 1));
stamp = stamp.toString(36);
var ret = new Promise(function(resolve, reject) {
var ticker = 0;
var MAX_TICK = 30;
var interval = 1000;
function check() {
if (document.cookie.indexOf(stamp + '=1') != -1) return resolve([stamp, ticker]);
if (++ticker > MAX_TICK) {
resolve([stamp, ticker]);
}
setTimeout(check, interval);
}
setTimeout(check, interval);
});
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);
if (kity.Browser.ie) {
$('<input name="iehack" value="1" />').appendTo($form);
}
$('<input name="stamp" />').val(stamp).appendTo($form);
var netdisk = minder.getUI('menu/save/netdisk');
if (netdisk) {
netdisk.mute = true;
setTimeout(function() {
netdisk.mute = false;
}, 1000);
}
$form.appendTo('body').submit().remove();
return ret;
}
function buildDataUrl(mineType, data) {
return 'data:' + mineType + '; utf-8,' + encodeURIComponent(data);
}
});
\ No newline at end of file
/**
* @fileOverview
*
* 保存文件到网盘的功能
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/save/netdisk', function(minder) {
var $menu = minder.getUI('menu/menu');
var $save = minder.getUI('menu/save/save');
var $netdiskfinder = minder.getUI('widget/netdiskfinder');
var $eve = minder.getUI('eve');
var $doc = minder.getUI('doc');
var ret = $eve.setup({});
var notice = minder.getUI('widget/notice');
/* extension => protocol */
var supports = {};
minder.getSupportedProtocols().forEach(function(protocol) {
if (protocol.encode && protocol.decode) {
supports[protocol.fileExtension] = protocol;
}
});
/* 网盘面板 */
var $panel = $($save.createSub('netdisk', true)).addClass('netdisk-save-panel');
var $finder = $netdiskfinder.generate($panel, function(file) {
return supports[file.extension];
});
var $selects = $('<div class="netdisk-save-select"></div>')
.appendTo($panel);
$('<label>')
.text(minder.getLang('ui.saveas'))
.appendTo($selects);
/* 文件名 */
var $filename = $('<input>')
.addClass('fui-widget fui-selectable')
.attr('type', 'text')
.attr('placeholder', minder.getLang('ui.filename'))
.attr('title', minder.getLang('ui.filename'))
.on('keydown', function(e) {
if (e.keyCode == 27) $menu.toggle();
if (e.keyCode == 13) save();
})
.appendTo($selects);
/* 文件格式 */
var $format = $('<select>')
.attr('title', minder.getLang('ui.fileformat'))
.appendTo($selects);
for (var ext in supports) {
var protocol = supports[ext];
if (!protocol.encode) return;
$('<option>')
.text(protocol.fileDescription + '(' + protocol.fileExtension + ')')
.val(ext)
.appendTo($format);
}
$format.val('.km');
$format.on('change', normalizeFilename);
/* 保存按钮 */
var $saveBtn = $('<button></button>')
.addClass('save-button')
.text(minder.getLang('ui.save'))
.click(save)
.appendTo($selects);
$menu.on('show', setFilename);
$finder.on('fileclick', function(file) {
$finder.select(file.path);
$filename.val(file.filename);
});
ret.quickSave = quickSave;
window.onbeforeunload = function() {
var noask = ret.mute || window.location.href.indexOf('noask') > 0;
if (!$doc.checkSaved(true) && !noask)
return minder.getLang('ui.unsavedcontent', '* ' + $doc.current().title);
};
var autoSaveDuration = minder.getOptions('autoSave');
if (autoSaveDuration !== false) {
autoSaveDuration = isNaN(autoSaveDuration) ? 3000 : (autoSaveDuration * 1000);
autoSave();
}
var autoSaveTimer = 0;
function autoSave() {
function lazySave(doc) {
if (doc.saved) return;
clearTimeout(autoSaveTimer);
autoSaveTimer = setTimeout(saveCurrent, autoSaveDuration);
}
$doc.on('docchange', lazySave);
}
// 快速保存
function quickSave() {
var doc = $doc.current();
if (doc.source != 'netdisk' && !$menu.isVisible()) {
$menu.$tabs.select(2);
$save.$tabs.select(0);
return $menu.show();
} else {
saveCurrent();
}
}
function saveCurrent() {
var doc = $doc.current();
if (doc.source != 'netdisk') return Promise.resolve();
var $title = minder.getUI('topbar/title').$title;
$filename.val(doc.title);
return doSave(doc.path, doc.protocol, doc, $title, 'leaveTheMenu');
}
function normalizeFilename() {
var filename = $filename.val();
var info = fio.file.anlysisPath(filename);
var ext = info.extension;
if (ext != $format.val()) {
if (ext in supports) {
$filename.val(info.name + $format.val());
} else {
$filename.val(filename + $format.val());
}
$filename[0].select();
}
return $filename.val();
}
function getSaveContext() {
var filename = normalizeFilename();
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;
return {
filename: filename,
path: path,
doc: doc,
protocol: protocol,
exist: exist,
match: match,
duplicated: duplicated
};
}
function save() {
var ctx = getSaveContext();
if (ctx.match || !ctx.exist || ctx.duplicated && window.confirm(minder.getLang('ui.overrideconfirm', ctx.filename))) {
doSave(ctx.path, ctx.protocol.name, ctx.doc, $panel);
}
}
var saving = 0;
function doSave(path, protocol, doc, $mask, leaveTheMenu, msg) {
if (saving) return;
saving = true;
if ($mask) $mask.addClass('loading');
function upload(data) {
return fio.file.write({
path: path,
content: data,
ondup: fio.file.DUP_OVERWRITE
});
}
function finish(file) {
if (!file.modifyTime) throw new Error('File Save Error');
if (!leaveTheMenu) {
$menu.hide();
}
doc.path = file.path;
doc.title = file.filename;
doc.source = 'netdisk';
doc.protocol = protocol;
$doc.save(doc);
notice.info(msg || minder.getLang('ui.save_success', doc.title, file.modifyTime.toLocaleTimeString()));
setTimeout(function() {
$finder.list($finder.pwd(), true);
}, 1499);
}
function error(e) {
notice.error('err_save', e);
}
return minder.exportData(protocol).then(upload).then(finish, error).then(function() {
if ($mask) $mask.removeClass('loading');
saving = false;
});
}
function setFilename() {
var doc = $doc.current();
switch (doc.source) {
case 'netdisk':
setFilenameForNetDiskSource(doc);
break;
default:
setFilenameForOtherSource(doc);
break;
}
$filename[0].select();
}
function setFilenameInputValue(filename) {
$filename.val(filename);
normalizeFilename(filename);
}
function setFilenameForNetDiskSource(doc) {
if (!fio.user.current()) return;
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);
}
setFilenameInputValue(pathInfo.filename);
}
function setFilenameForOtherSource(doc) {
setFilenameInputValue(doc.title);
$finder.select(null);
}
return ret;
});
\ No newline at end of file
/**
* @fileOverview
*
* 保存菜单(二级菜单)
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/save/save', function(minder) {
return minder.getUI('menu/menu').createSubMenu('save');
});
\ No newline at end of file
/**
* @fileOverview
*
* 查看分享文件
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/share/m-share', function (minder) {
var $doc = minder.getUI('doc');
function loadShareDoc() {
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) {
window.alert(data.error);
window.location.href = 'index.html';
return;
}
var content = data.shareMinder.data;
return $doc.load({
source: 'share',
content: content,
protocol: 'json',
saved: true,
ownerId: data.uid,
ownerName: data.uname
}).then(function(doc) {
var $title = minder.getUI('topbar/title');
$title.setTitle('[分享的] ' + $title.getTitle());
});
}
$('#kityminder').addClass('loading');
return $.pajax({
url: 'http://naotu.baidu.com/share.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');
minder.execCommand('hand');
$('#kityminder').removeClass('loading');
});
}
minder.on('dblclick', function() {
minder.execCommand('camera', minder.getRoot(), 500);
});
return {
ready: loadShareDoc()
};
});
\ No newline at end of file
This diff is collapsed.
/**
* @fileOverview
*
* 查看分享文件
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/share/view', function (minder) {
var $menu = minder.getUI('menu/menu');
var $save = minder.getUI('menu/save/save');
var $doc = minder.getUI('doc');
var notice = minder.getUI('widget/notice');
var shareId;
$menu.$tabs.select(0);
$save.$tabs.select(0);
minder.on('uiready', function() {
var $quickvisit = minder.getUI('topbar/quickvisit');
var $edit = $quickvisit.add('editshare', 'right');
$edit.on('click', function() {
if (shareId) window.open('edit.html?shareId=' + shareId);
});
$quickvisit.$new.remove();
$quickvisit.$save.remove();
$quickvisit.$share.remove();
});
function loadShareDoc() {
var pattern = /(?:shareId|share_id)=(\w+)([&#]|$)/;
var match = pattern.exec(window.location) || pattern.exec(document.referrer);
if (!match) return Promise.resolve(null);
shareId = match[1];
function renderShareData(data) {
if (data.error) {
return notice.error('err_share_data', data.error);
}
var content = data.shareMinder.data;
var title = data.path ? data.path.split('/').pop() : data.title;
title = title || JSON.parse(content).data.text;
title = minder.getLang('ui.shared_file_title', title);
return $doc.load({
title: title,
source: 'share',
content: content,
protocol: 'json',
saved: true,
ownerId: data.uid,
ownerName: data.uname
});
}
var $container = $(minder.getRenderTarget()).addClass('loading');
return $.pajax({
url: 'http://naotu.baidu.com/share.php',
data: {
action: 'find',
id: shareId
},
dataType: 'json'
}).then(renderShareData)['catch'](function(e) {
notice.error('err_share_data', e);
}).then(function() {
minder.disable();
minder.execCommand('hand', true);
$container.removeClass('loading');
});
}
return {
ready: loadShareDoc()
};
});
\ No newline at end of file
/**
* @fileOverview
*
* 脑图缩略图导航功能
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('nav', function(minder) {
var memory = minder.getUI('memory');
var $navBar = $('<div>').addClass('nav-bar').appendTo('#content-wrapper');
var $commandbutton = minder.getUI('widget/commandbutton');
var $zoomIn = $commandbutton.generate('zoom-in').appendTo($navBar[0]);
var $zoomPan = createZoomPan($navBar);
var $zoomOut = $commandbutton.generate('zoom-out').appendTo($navBar[0]);
var $previewNavigator = createViewNavigator();
var $hand = $commandbutton.generate('hand').appendTo($navBar[0]);
var $root = $commandbutton.generate('camera', function() {
minder.execCommand('camera', minder.getRoot(), 600);
}).appendTo($navBar[0]);
var $previewTrigger = createPreviewTrigger($previewNavigator).appendTo($navBar);
function createZoomPan($parent) {
var $pan = $('<div>').addClass('zoom-pan').appendTo($parent);
var zoomStack = minder.getOptions('zoom');
var minValue = zoomStack[0];
var maxValue = zoomStack[zoomStack.length - 1];
var valueRange = maxValue - minValue;
var totalHeight = $pan.height();
function getHeight(value) {
return (1 - (value - minValue) / valueRange) * totalHeight;
}
var $origin = $('<div>')
.addClass('origin')
.appendTo($pan)
.css('y', getHeight(100));
var $indicator = $('<div>')
.addClass('indicator')
.appendTo($pan)
.css('y', getHeight(100));
function indicate(value) {
$indicator.animate({
'y': getHeight(value)
}, 200);
}
minder.on('zoom', function(e) {
indicate(e.zoom);
});
$origin.click(function() {
minder.execCommand('zoom', 100);
});
return $pan;
}
/**
* 创建导航器的 DOM 元素以及交互的逻辑代码
*/
function createViewNavigator() {
var $previewNavigator = $('<div>')
.addClass('preview-navigator')
.appendTo('#content-wrapper');
// 画布,渲染缩略图
var paper = new kity.Paper($previewNavigator[0]);
// 用两个路径来挥之节点和连线的缩略图
var nodeThumb = paper.put(new kity.Path());
var connectionThumb = paper.put(new kity.Path());
// 表示可视区域的矩形
var visibleRect = paper.put(new kity.Rect(100, 100).stroke('red', '1%'));
var contentView = new kity.Box(), visibleView = new kity.Box();
navigate();
$previewNavigator.show = function() {
$.fn.show.call(this);
bind();
updateContentView();
updateVisibleView();
};
$previewNavigator.hide = function() {
$.fn.hide.call(this);
unbind();
};
function bind() {
minder.on('layout layoutallfinish', updateContentView);
minder.on('viewchange', updateVisibleView);
}
function unbind() {
minder.off('layout layoutallfinish', updateContentView);
minder.off('viewchange', updateVisibleView);
}
window.u = updateContentView;
function navigate() {
function moveView(center, duration) {
var box = visibleView;
center.x = -center.x;
center.y = -center.y;
var viewMatrix = minder.getPaper().getViewPortMatrix();
box = viewMatrix.transformBox(box);
var targetPosition = center.offset(box.width / 2, box.height / 2);
minder.getViewDragger().moveTo(targetPosition, duration);
}
var dragging = false;
paper.on('mousedown', function(e) {
dragging = true;
moveView(e.getPosition('top'), 200);
$previewNavigator.addClass('grab');
});
paper.on('mousemove', function(e) {
if (dragging) {
moveView(e.getPosition('top'));
}
});
$(window).on('mouseup', function() {
dragging = false;
$previewNavigator.removeClass('grab');
});
}
function updateContentView() {
var view = minder.getRenderContainer().getBoundaryBox();
contentView = view;
var padding = 30;
paper.setViewBox(
view.x - padding - 0.5,
view.y - padding - 0.5,
view.width + padding * 2 + 1,
view.height + padding * 2 + 1);
var nodePathData = [];
var connectionThumbData = [];
minder.getRoot().traverse(function(node) {
var box = node.getLayoutBox();
nodePathData.push('M', box.x, box.y,
'h', box.width, 'v', box.height,
'h', -box.width, 'z');
if (node.getConnection() && node.parent && node.parent.isExpanded()) {
connectionThumbData.push(node.getConnection().getPathData());
}
});
paper.setStyle('background', minder.getStyle('background'));
if (nodePathData.length) {
nodeThumb
.fill(minder.getStyle('root-background'))
.setPathData(nodePathData);
} else {
nodeThumb.setPathData(null);
}
if (connectionThumbData.length) {
connectionThumb
.stroke(minder.getStyle('connect-color'), '0.5%')
.setPathData(connectionThumbData);
} else {
connectionThumb.setPathData(null);
}
updateVisibleView();
}
function updateVisibleView() {
visibleView = minder.getViewDragger().getView();
visibleRect.setBox(visibleView.intersect(contentView));
}
return $previewNavigator;
}
function createPreviewTrigger($previewNavigator) {
var $trigger = $('<div>').addClass('command-button nav-trigger');
$trigger.append('<div class="fui-icon">');
$trigger.click(toggle);
$trigger.attr('title', minder.getLang('ui.navigator'));
function toggle() {
if ($trigger.toggleClass('active').hasClass('active')) {
$previewNavigator.show();
memory.set('navigator-hidden', false);
} else {
$previewNavigator.hide();
memory.set('navigator-hidden', true);
}
}
if (memory.get('navigator-hidden')) toggle();
toggle();
return $trigger;
}
});
\ No newline at end of file
/**
* @fileOverview
*
* 节点颜色设置(包括和背景)
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/appearence/color', function(minder) {
function generateSerisColor() {
return ['#e75d66', '#fac75b', '#99ca6a', '#00c5ad', '#3bbce0', '#c9ced1', '#425b71', 'white'];
}
var $commandbuttonset = minder.getUI('widget/commandbuttonset');
var $tabs = minder.getUI('ribbon/tabs');
var $colorPanel = new FUI.LabelPanel({
label: minder.getLang('panels.color')
}).appendTo($tabs.appearence);
var $backgroundPanel = new FUI.LabelPanel({
label: minder.getLang('panels.background')
}).appendTo($tabs.appearence);
var foreColorList = generateSerisColor();
$colorPanel.appendWidget($commandbuttonset.generate('forecolor', foreColorList.map(function(color) {
return {
icon: {
style: {
background: color
}
},
label: color,
text: color,
value: color
};
})).addClass('color-picker'));
$backgroundPanel.appendWidget($commandbuttonset.generate('background', foreColorList.map(function(color) {
return {
icon: {
style: {
background: color
}
},
label: color,
text: color,
value: color
};
})).addClass('color-picker'));
return {
color: $colorPanel,
background: $backgroundPanel
};
});
\ No newline at end of file
/**
* @fileOverview
*
* 字体设置(字体字号加粗斜体)
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/appearence/font', function(minder) {
var $tabs = minder.getUI('ribbon/tabs');
var commandinputmenu = minder.getUI('widget/commandinputmenu');
var commandbutton = minder.getUI('widget/commandbutton');
var $fontPanel = new FUI.LabelPanel({
label: minder.getLang('panels.font'),
id: 'font-panel'
});
var $leftPanel = new FUI.Panel({
column: true
});
var $rightPanel = new FUI.Panel({
column: true
});
var $fontFamilyMenu = commandinputmenu.generate('fontfamily', minder.getOptions('fontfamily').map(function(ff) {
return {
label: {
text: ff.name,
style: {
fontFamily: ff.val
}
},
text: ff.name,
value: ff.val
};
}));
var $fontSizeMenu = commandinputmenu.generate('fontsize', minder.getOptions('fontsize').map(function(fs) {
return {
label: {
text: fs,
style: {
fontSize: fs
}
},
text: fs,
value: fs
};
}));
$leftPanel.appendWidgets([$fontFamilyMenu, $fontSizeMenu]);
var $boldButton = commandbutton.generate('bold');
var $italicButton = commandbutton.generate('italic');
$rightPanel.appendWidgets([$boldButton, $italicButton]);
$fontPanel.appendWidgets([$leftPanel, $rightPanel]);
$tabs.appearence.appendWidget($fontPanel);
});
\ No newline at end of file
/**
* @fileOverview
*
* 布局面板
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/appearence/layout', function(minder) {
var $tabs = minder.getUI('ribbon/tabs');
var $commandbuttonset = minder.getUI('widget/commandbuttonset');
var $commandbutton = minder.getUI('widget/commandbutton');
var $layoutPanel = new FUI.LabelPanel({
id: 'layout-panel',
label: minder.getLang('panels.layout')
}).appendTo($tabs.appearence);
// var $layoutSelect = new FUI.DropPanel({
// id: 'layout-select'
// }).appendTo($layoutPanel);
// var layoutList = KityMinder.Utils.keys(KityMinder.getLayoutList());
// $layoutSelect.appendWidget($commandbuttonset.generate('layout', layoutList));
$commandbutton.generate('resetlayout').appendTo($layoutPanel).addClass('large');
return $layoutPanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* 样式控制
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/appearence/style', function(minder) {
var $tabs = minder.getUI('ribbon/tabs');
var $commandbutton = minder.getUI('widget/commandbutton');
var $stylePanel = new FUI.LabelPanel({
label: minder.getLang('panels.style')
}).appendTo($tabs.appearence);
$commandbutton.generate('clearstyle').addClass('large').appendTo($stylePanel);
var $styleClipPanel = new FUI.Panel({
column: true
}).appendTo($stylePanel);
$commandbutton.generate('copystyle').appendTo($styleClipPanel);
$commandbutton.generate('pastestyle').appendTo($styleClipPanel);
return $stylePanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* 模板选择
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/appearence/template', function(minder) {
var $commandselectmenu = minder.getUI('widget/commandselectmenu');
var $tabs = minder.getUI('ribbon/tabs');
var $templatePanel = new FUI.LabelPanel({
id: 'template-panel',
label: minder.getLang('panels.template')
});
var templateList = KityMinder.Utils.keys(KityMinder.getTemplateList());
var $templateSelect = $commandselectmenu.generate('template', templateList, 2);
$tabs.appearence.appendWidget($templatePanel);
$templatePanel.appendWidget($templateSelect);
return $templatePanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* 皮肤选择
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/appearence/theme', function(minder) {
var $commandselectmenu = minder.getUI('widget/commandselectmenu');
var $tabs = minder.getUI('ribbon/tabs');
var $themePanel = new FUI.LabelPanel({
id: 'theme-panel',
label: minder.getLang('panels.theme')
});
var themeList = KityMinder.Utils.keys(KityMinder.getThemeList());
var $themeSelect = $commandselectmenu.generate('theme', themeList.map(function(theme) {
var style = KityMinder._themes[theme];
return {
clazz: 'Button',
label: {
text: minder.getLang('theme.' + theme),
style: {
background: style['root-background'],
color: style['root-color'],
borderRadius: style['root-radius'] / 2
}
},
text: minder.getLang('theme.' + theme),
value: theme,
className: ['theme', theme].join(' ')
};
}));
$tabs.appearence.appendWidget($themePanel);
$themePanel.appendWidget($themeSelect);
minder.on('themechange', function(e) {
$('#content-wrapper').css('background', minder.getStyle('background'));
});
return $themePanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* 排列节点的两个命令按钮
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/idea/arrange', function(minder) {
var $tabs = minder.getUI('ribbon/tabs');
var $commandbutton = minder.getUI('widget/commandbutton');
var $arrangePanel = new FUI.LabelPanel({
label: minder.getLang('panels.arrange'),
column: true
});
$commandbutton.generate('arrangeup').appendTo($arrangePanel);
$commandbutton.generate('arrangedown').appendTo($arrangePanel);
$tabs.idea.appendWidget($arrangePanel);
return $arrangePanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* 附件面板
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/idea/attachment', function(minder) {
var $tabs = minder.getUI('ribbon/tabs');
var $attachmentPanel = new FUI.LabelPanel({
label: minder.getLang('panels.attachment'),
coloum: true
}).appendTo($tabs.idea);
return $attachmentPanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* 插入和管理图片
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('image', function(minder) {
var $attachment = minder.getUI('ribbon/idea/attachment');
var $imageButtonMenu = new FUI.ButtonMenu({
id: 'image-button-menu',
text: minder.getLang('ui.image'),
layout: 'bottom',
buttons: [{}, {
label: minder.getLang('ui.image')
}],
menu: {
items: [minder.getLang('ui.removeimage')]
}
}).appendTo($attachment);
$imageButtonMenu.bindCommandState(minder, 'image');
var $imageDialog = new FUI.Dialog({
width: 600,
height: 600,
prompt: true,
className: 'image-dialog',
caption: minder.getLang('ui.image')
}).appendTo(document.getElementById('content-wrapper'));
var $dialogBody = $($imageDialog.getBodyElement());
// writed by yangxiaohu 2014-10-20
var tabs = new FUI.Tabs( {
buttons: [ "图片搜索", "插入图片" ]
} );
$dialogBody.html([
'<div id="img_buttons"></div>',
'<div id="img_panels"></div>'
].join(''));
tabs.appendButtonTo( document.getElementById( 'img_buttons') );
tabs.appendPanelTo( document.getElementById( 'img_panels'));
tabs.getPanel(0).getContentElement().innerHTML = ['<div class="searchBar"><label>关键字:</label><input id="img_searchTxt" type="text" placeholder="请输入搜索关键词">',
'<button id="img_searchBtn">百度一下</button></div>',
'<div id="img_searchList"><ul id="img_searchListUl"></ul></div>'
].join('');
tabs.getPanel(1).getContentElement().innerHTML = ['<p><label>图片地址:</label><input type="url" class="image-url fui-widget fui-selectable" /></p>',
'<p><label>提示文本:</label><input type="text" class="image-title fui-widget fui-selectable" /></p>',
'<img class="image-preview" src="" style="max-height: 200px;" />'].join('');
//the content below is from xujinquan's ueditor
/*搜索图片 */
$G = function ( id ) {
return document.getElementById( id )
};
function SearchImage() {
this.init();
}
SearchImage.prototype = {
lang: {
searchRemind : '请输入搜索关键词',
searchLoading : '图片加载中,请稍后……',
searchRetry : '抱歉,没有找到图片!请重试一次!',
},
data: {
imgUrl: '',
imgTitle: '',
},
init: function () {
this.initEvents();
},
initEvents: function(){
var _this = this;
/* 点击搜索按钮 */
$('#img_searchBtn').on('click', function(){
var key = $G('img_searchTxt').value;
if(key && key != _this.lang.searchRemind) {
_this.getImageData();
}
});
/* 搜索框聚焦 */
$('#img_searchTxt').on('focus', function(){
var key = $G('img_searchTxt').value;
if(key && key == _this.lang.searchRemind) {
$G('img_searchTxt').value = '';
}
});
/* 搜索框回车键搜索 */
$('#img_searchTxt').on('keydown', function(e){
var keyCode = e.keyCode || e.which;
if (keyCode == 13) {
$G('img_searchBtn').click();
return false;
}
});
/* 选中图片 */
$('#img_searchList').on('click', function(e){
var target = e.target || e.srcElement,
$li = $(target).closest('li');
_this.data.imgUrl = $li.find('img').attr('src');
_this.data.imgTitle = $li.find('span').attr('title');
$li.siblings('.selected').removeClass('selected');
$li.addClass('selected');
});
},
/* 改变图片大小 */
scale: function (img, w, h) {
var ow = img.width,
oh = img.height;
if (ow >= oh) {
img.width = w * ow / oh;
img.height = h;
img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
} else {
img.width = w;
img.height = h * oh / ow;
img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
}
},
getImageData: function(){
var _this = this,
key = $G('img_searchTxt').value,
keepOriginName = '1';
url = "http://image.baidu.com/i?ct=201326592&cl=2&lm=-1&st=-1&tn=baiduimagejson&istype=2&rn=3200&fm=index&pv=&word=" + key + "&ie=utf-8&oe=utf-8&keeporiginname=" + keepOriginName + "&" + +new Date;
$G('img_searchListUl').innerHTML = _this.lang.searchLoading;
$.ajax({url : url,
dataType: 'jsonp',
scriptCharset: 'GB18030',
success:function(json){
var list = [];
if(json && json.data) {
for(var i = 0; i < json.data.length; i++) {
if(json.data[i].objURL) {
list.push({
title: json.data[i].fromPageTitleEnc,
src: json.data[i].objURL,
url: json.data[i].fromURL
});
}
}
}
_this.setList(list);
},
error:function(){
$G('img_searchListUl').innerHTML = _this.lang.searchRetry;
}
});
},
/* 添加图片到列表界面上 */
setList: function (list) {
var i, item, p, img, title, _this = this,
listUl = $G('img_searchListUl');
listUl.innerHTML = '';
if(list.length) {
for (i = 0; i < list.length; i++) {
item = document.createElement('li');
img = document.createElement('img');
title = document.createElement('span');
img.setAttribute('src', list[i].src);
title.innerHTML = list[i].title;
item.appendChild(img);
item.appendChild(title);
listUl.appendChild(item);
img.onerror = function() {
$(this).closest('li').remove();
};
}
} else {
listUl.innerHTML = _this.lang.searchRetry;
}
},
getInsertList: function () {
var child,
src,
align = getAlign(),
list = [],
items = $G('img_searchListUl').children;
for(var i = 0; i < items.length; i++) {
child = items[i].firstChild && items[i].firstChild.firstChild;
if(child.tagName && child.tagName.toLowerCase() == 'img' && $(items[i]).hasClass('selected')) {
src = child.src;
list.push({
src: src,
_src: src,
alt: src.substr(src.lastIndexOf('/') + 1),
floatStyle: align
});
}
}
return list;
}
};
var searchImage = new SearchImage();
// the end content writed by yangxiaohu
var $url = $dialogBody.find('.image-url');
var $title = $dialogBody.find('.image-title');
var $preview = $dialogBody.find('.image-preview');
var $errorMsg = $('<span class="validate-error"></span>');
$imageDialog.on('ok', function() {
var index = tabs.getSelectedIndex();
switch(index) {
case 1:
minder.execCommand('image', $url.val(), $title.val());
break;
case 0:
minder.execCommand('image', searchImage.data.imgUrl, searchImage.data.imgTitle);
break;
}
});
$imageDialog.on('open', function() {
var image = minder.queryCommandValue('image');
$url.val(image.url);
$title.val(image.title);
$preview.attr('src', image.url || '');
error(false);
});
function error(value) {
if (value) {
$url.addClass('validate-error');
$errorMsg.text('图片无法加载');
// $ok.disable();
} else {
$url.removeClass('validate-error');
$errorMsg.text('');
// $imageDialog.enable();
}
return value;
}
$url.after($errorMsg);
$url.on('input', function() {
var url = $url.val();
if (/^https?\:\/\/(\w+\.)+\w+/.test(url)) {
$preview.attr('src', url);
error(false);
// $imageDialog.disable();
$preview.addClass('loading');
} else {
error(true);
}
});
$preview.on('load', function() {
error(false);
$preview.removeClass('loading');
}).on('error', function() {
if ($preview.attr('src')) error(true);
$preview.removeClass('loading');
});
$imageButtonMenu.on('buttonclick', function() {
$imageDialog.open();
$url[0].focus();
});
$imageButtonMenu.on('select', function() {
minder.execCommand('removeimage');
});
return $imageButtonMenu;
});
\ No newline at end of file
/**
* @fileOverview
*
* 插入节点
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/idea/insert', function(minder) {
var $commandbutton = minder.getUI('widget/commandbutton');
var $tabs = minder.getUI('ribbon/tabs');
var $insertNodePanel = new FUI.LabelPanel({
label: minder.getLang('panels.insert'),
column: true
});
$commandbutton.generate('appendchildnode').appendTo($insertNodePanel);
$commandbutton.generate('appendsiblingnode').appendTo($insertNodePanel);
$tabs.idea.appendWidget($insertNodePanel);
return $insertNodePanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* 插入和管理超链接
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/idea/link', function(minder) {
var R_URL = /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?/;
var $attachment = minder.getUI('ribbon/idea/attachment');
var $linkButtonMenu = new FUI.ButtonMenu({
id: 'link-button-menu',
text: minder.getLang('ui.link'),
layout: 'bottom',
buttons: [{}, {
label: minder.getLang('ui.link')
}],
menu: {
items: [minder.getLang('ui.removelink')]
}
}).appendTo($attachment);
$linkButtonMenu.bindCommandState(minder, 'hyperlink');
var $linkDialog = new FUI.Dialog({
width: 600,
height: 200,
prompt: true,
caption: minder.getLang('ui.link')
}).appendTo(document.getElementById('content-wrapper'));
var $dialogBody = $($linkDialog.getBodyElement());
$dialogBody.html([
'<p><label>连接地址:</label><input type="url" class="link-href fui-widget fui-selectable" /></p>',
'<p><label>提示文本:</label><input type="text" class="link-title fui-widget fui-selectable" /></p>'
].join(''));
var $href = $dialogBody.find('.link-href');
var $title = $dialogBody.find('.link-title');
var $ok = $linkDialog.getButton(0);
var $errorMsg = $('<span class="validate-error"></span>');
function error(value) {
if (value) {
$href.addClass('validate-error');
$errorMsg.text('地址格式错误');
$ok.disable();
} else {
$href.removeClass('validate-error');
$errorMsg.text('');
$ok.enable();
}
}
$href.after($errorMsg);
$href.on('input', function() {
var url = $href.val();
error(!R_URL.test(url));
});
$linkButtonMenu.on('buttonclick', function() {
$linkDialog.open();
$href[0].focus();
});
$linkButtonMenu.on('select', function() {
minder.execCommand('unhyperlink');
});
$linkDialog.on('ok', function() {
minder.execCommand('hyperlink', $href.val(), $title.val() || '');
});
$linkDialog.on('open', function() {
var value = minder.queryCommandValue('hyperlink');
$href.val(value.url);
$title.val(value.title);
error(false);
});
$(minder.getPaper().getNode()).delegate('a', 'click', function(e) {
var $a = $(e.target).closest('a');
var href = $a.prop('href').baseVal;
if (window.confirm(minder.getLang('ui.redirect', href))) {
window.open(href, '_blank');
}
e.preventDefault();
});
return $linkButtonMenu;
});
\ No newline at end of file
/**
* @fileOverview
*
* 节点操作(编辑和删除)
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/idea/operation', function(minder) {
var $commandbutton = minder.getUI('widget/commandbutton');
var $tabs = minder.getUI('ribbon/tabs');
var $opPanel = new FUI.LabelPanel({
label: minder.getLang('panels.nodeop'),
column: true
}).appendTo($tabs.idea);
['editnode', 'removenode'].forEach(function(cmd) {
$commandbutton.generate(cmd).appendTo($opPanel);
});
});
\ No newline at end of file
/**
* @fileOverview
*
* 添加和修改优先级标签
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/idea/priority', function(minder) {
var $commandbuttonset = minder.getUI('widget/commandbuttonset');
var $tabs = minder.getUI('ribbon/tabs');
var $priorityPanel = new FUI.LabelPanel({
label: minder.getLang('panels.priority')
}).appendTo($tabs.idea);
$commandbuttonset.generate('priority', [1, 2, 3, 4, 5, 6, 7, 8, 9, 0].map(function(p) {
return {
label: p,
text: minder.getLang('ui.priority') + p,
value: p,
className: ['priority', p].join('-')
};
})).appendTo($priorityPanel);
return $priorityPanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* 添加和修改进度标签
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/idea/progress', function(minder) {
var $commandbuttonset = minder.getUI('widget/commandbuttonset');
var $tabs = minder.getUI('ribbon/tabs');
var $progressPanel = new FUI.LabelPanel({
label: minder.getLang('panels.progress')
}).appendTo($tabs.idea);
$commandbuttonset.generate('progress', [1, 2, 3, 4, 5, 6, 7, 8, 9, 0].map(function(p) {
return {
label: p,
text: minder.getLang('ui.progress.p' + p),
value: p,
className: ['progress', p].join('-')
};
})).appendTo($progressPanel);
return $progressPanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* 添加和管理资源标签
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/idea/resource', function(minder) {
var $commandbuttonset = minder.getUI('widget/commandbuttonset');
var $tabs = minder.getUI('ribbon/tabs');
var $resourcePanel = new FUI.LabelPanel({
label: minder.getLang('panels.resource'),
id: 'resource-panel'
}).appendTo($tabs.idea);
var $addInput = new FUI.Input().appendTo($resourcePanel);
$addInput.getElement().type = 'text';
var $addButton = new FUI.Button({
label: '添加'
}).appendTo($resourcePanel);
var $resourceDrop = new FUI.DropPanel().appendTo($resourcePanel);
var $dropContainer = $($resourceDrop.getPanelElement());
var $ul = $('<ul></ul>').addClass('resource-list').appendTo($dropContainer);
var $list = [];
function addResource() {
var resource = $addInput.getValue();
var origin = minder.queryCommandValue('resource');
if (/\S/.test(resource)) {
if (!~origin.indexOf(resource)) origin.push(resource);
origin.sort();
minder.execCommand('resource', origin);
}
$addInput.setValue(null);
update();
$addInput.focus();
}
$addInput.on('inputcomplete', function(e) {
addResource();
});
$addButton.on('click', addResource);
$dropContainer.delegate('input[type=checkbox]', 'change', function() {
minder.execCommand('resource', $dropContainer.find('input[type=checkbox]:checked').map(function(index, chk) {
return $(chk).data('resource');
}).toArray());
update();
});
function hash(resource, used) {
return [resource.join(','), used.join(',')].join(';');
}
function changed(resource, used) {
var currentHash = hash(resource, used);
if (currentHash == changed.lastHash) return false;
changed.lastHash = currentHash;
return true;
}
function update() {
var resource = minder.queryCommandValue('resource');
var used = minder.getUsedResource();
used.sort();
switch (minder.queryCommandState('resource')) {
case 0:
$addInput.enable();
$addButton.enable();
$resourceDrop.enable();
$ul.find('input[type=checkbox]').removeAttr('disabled');
break;
case -1:
$addInput.disable();
$addButton.disable();
$resourceDrop.disable();
$ul.find('input[type=checkbox]').attr('disabled', true);
break;
}
if (!changed(resource, used)) return;
var delta = used.length - $ul.children().length;
while (delta--) $ul.append('<li><label><input type="checkbox" /><span></span></label></li>');
while (++delta) $ul.children().first().remove();
used.forEach(function(name, index) {
var $li = $ul.children().eq(index);
var $label = $li.find('label');
var $chk = $label.find('input');
var $span = $label.find('span');
$chk.data('resource', name);
$chk.prop('checked', ~resource.indexOf(name));
$span.text(name);
var color = minder.getResourceColor(name);
$li.css({
color: color.dec('l', 60).toString(),
backgroundColor: ~resource.indexOf(name) ? color : color.dec('a', 0.85).toRGBA()
});
});
}
minder.on('interactchange', update);
return $resourcePanel;
});
\ No newline at end of file
/**
* @fileOverview
*
* Ribbon 选项卡
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/tabs', function(minder) {
var memory = minder.getUI('memory');
var $tab = new FUI.Tabs({
buttons: ['idea', 'appearence', 'view'].map(function(key) {
return minder.getLang('ui.tabs.' + key);
})
});
var $title = minder.getUI('topbar/title').$title;
var $header = $('<div id="tab-select"></div>');
var $container = $('<div id="tab-container"></div>');
$title.before($header);
$('#panel').after($container);
$tab.appendButtonTo($header[0]);
$tab.appendPanelTo($container[0]);
// 隐藏效果
var lastIndex = 0;
var muteRemember = false;
$tab.on('tabsselect', function(e, info) {
if (info.index == lastIndex) {
$container.toggleClass('collapsed');
$header.toggleClass('collapsed');
} else {
$container.removeClass('collapsed');
$header.removeClass('collapsed');
}
if (!muteRemember) {
memory.set('ribbon-tab-collapsed', $container.hasClass('collapsed'));
memory.set('ribbon-tab-index', info.index);
}
lastIndex = info.index;
});
$tab.idea = $tab.getPanel(0);
$tab.appearence = $tab.getPanel(1);
$tab.view = $tab.getPanel(2);
var rememberIndex = memory.get('ribbon-tab-index');
var rememberCollapse = memory.get('ribbon-tab-collapsed');
muteRemember = true;
$tab.select(rememberIndex || 0);
muteRemember = false;
if (rememberCollapse) {
$container.addClass('collapsed');
$header.addClass('collapsed');
} else {
$container.removeClass('collapsed');
$header.removeClass('collapsed');
}
return $tab;
});
\ No newline at end of file
/**
* @fileOverview
*
* 全屏无打扰模式
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/view/fullscreen', function(minder) {
var $commandbutton = minder.getUI('widget/commandbutton');
var $tabs = minder.getUI('ribbon/tabs');
var notice = minder.getUI('widget/notice');
var $fullscreenPanel = new FUI.LabelPanel({
label: minder.getLang('panels.level'),
column: true
}).appendTo($tabs.view);
var $fullscreenButton = $commandbutton
.generate('fullscreen', fullscreen)
.addClass('large')
.appendTo($fullscreenPanel);
function fullscreen() {
if ($('#content-wrapper').toggleClass('fullscreen').hasClass('fullscreen')) {
notice.info(minder.getLang('ui.fullscreen_exit_hint'), false, 4000);
}
}
minder.addShortcut('F11', fullscreen);
minder.addShortcut('Esc', function () {
if ($('#content-wrapper').hasClass('fullscreen')) {
$('#content-wrapper').removeClass('fullscreen');
}
});
return $fullscreenButton;
});
/**
* @fileOverview
*
* 切换展开层次
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('ribbon/view/level', function(minder) {
var $commandbutton = minder.getUI('widget/commandbutton');
var $tabs = minder.getUI('ribbon/tabs');
var $levelPanel = new FUI.LabelPanel({
label: minder.getLang('panels.level'),
column: true
}).appendTo($tabs.view);
['expandtoleaf', 'collapsetolevel1'].forEach(function(cmd) {
$commandbutton.generate(cmd).appendTo($levelPanel);
});
});
/**
* 页面下方 “关于” 面板的样式
*/
.fullscreen #about #km-cat {
transform: translate(0, 0);
transition: transform 0.7s 0.2s ease;
}
#about {
position: absolute;
bottom: 0;
right: 0;
height: 40px;
line-height: 40px;
background: #5d697a;
color: #eee;
font-family:Arial;
font-size: 13px;
font-weight:normal;
margin:0;
text-align: right;
padding: 0 15px 0 60px;
border-bottom: 5px solid #393F4F;
overflow: visible;
transition: all ease .3s 0.3s;
transform: translate(100%);
a {
color: #eee;
}
#km-cat {
position: absolute;
left: 15px;
top: 5px;
transition: all ease 1.3s 0.3s;
transform: translate(-60px, 0);
cursor: pointer;
}
#cat-face {
fill: #393F4F;
}
&:hover, &:hover #km-cat {
transform: translate(0);
}
#km-version.new-version{
position: relative;
padding-right: 30px;
&:after {
content: 'NEW';
color: #ff0;
position: absolute;
top: -10px;
right: -5px;
display: block;
background: #f00;
padding: 0 5px;
border-radius: 4px;
text-shadow: none;
box-shadow: -1px 1px 3px rgba(0,0,0,0.3);
transform: scale(.6);
}
}
}
.command-buttonset.color-picker {
width: 100px;
.fui-toggle-button {
margin: 3px 3px 0 0 !important;
padding: 2px !important;
border-radius: 100%;
border: 1px solid #efefef;
background: transparent;
&.fui-button-pressed {
border: 1px solid @button-active;
background: #fafcff;
}
&:hover {
border: 1px solid #ccd0d3;
background: #fff;
}
.fui-label {
display: none;
}
.fui-icon {
width: 16px;
height: 16px;
border-radius: 100%;
}
}
}
\ 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
#font-panel {
.command-button {
padding: 0;
width: 20px;
height: 20px;
border: 1px solid transparent;
background: transparent;
&.active {
border: 1px solid #ccd0d3;
background: #fafcff;
}
&:hover {
border: 1px solid #ccd0d3;
background: #fff;
}
&:active {
background: darken(#fafcff, 5%);
}
border-radius: 11px;
margin-left: 5px;
margin-top: 2px;
margin-bottom: 2px !important;
.fui-label {
display: none;
}
}
}
\ No newline at end of file
#help-panel, #feedback-panel {
.dock(50px, 0, 0, 0);
overflow-y: auto;
h2 {
font-weight: normal;
color: @theme-color;
margin: 10px 0;
}
.shortcut-content {
font-family: 'Microsoft Yahei';
margin-left: 50px;
section {
min-width: 300px;
margin: 0 20px 20px 0;
float: left;
h3 {
border-bottom: 1px solid #EEE;
}
div.shortcut-group {
margin: 5px auto;
span.shortcut {
display: inline-block;
width: 220px;
text-align: right;
margin-right: 10px;
}
}
}
}
.contact-content {
list-style: none;
padding-left: 0;
li {
display: block;
float: left;
padding: 0;
width: 150px;
height: 150px;
margin: 20px;
text-align: center;
position: relative;
a {
-webkit-user-select: initial;
cursor: text;
color: @theme-color;
&[href] {
cursor: pointer;
}
}
&:before {
transition: all .3s ease;
opacity: 0.6;
content: ' ';
display: block;
width: 150px;
height: 150px;
background: white url(../images/feedback.png) no-repeat;
}
&:hover:before {
transform: translate3d(0, -5px, 0);
opacity: 1;
}
&.email:before {
background-position: -150px 0;
}
&.github:before {
background-position: -300px 0;
}
&.tieba:before {
background-position: -450px 0;
}
}
}
}
\ No newline at end of file
.command-button {
&.undo, &.redo {
float: left;
border: none;
width: @panel-height;
height: @panel-height;
line-height: @panel-height;
padding: 0;
margin: 0;
.fui-label {
display: none;
}
.fui-icon {
display: block;
width: @panel-height;
height: @panel-height;
background: url(../images/history.png) no-repeat;
}
&:hover {
background: @tab-hover;
.fui-icon {
background-position-y: -40px;
}
}
&:active {
background: @tab-active;
}
&.fui-disabled {
&:hover, &:active {
background: none;
}
.fui-icon {
background-position-y: 0;
}
}
}
&.undo {
}
&.redo {
.fui-icon {
background-position-x: -40px;
}
}
}
\ No newline at end of file
@iconsize: 20px;
.sprite(@index, @size:@iconsize) {
background-position: 0 (-@index * @iconsize);
}
.command-button .fui-icon {
background: url(../images/icons.png) no-repeat;
.sprite(-1);
.appendchildnode& { .sprite(0); }
.appendsiblingnode& { .sprite(1); }
.editnode& { .sprite(3); }
.removenode& { .sprite(4); }
.resetlayout& { background-position: 0 -150px; }
.clearstyle& { background-position: 0 -175px; }
.copystyle& { .sprite(10); }
.pastestyle& { .sprite(11); }
.bold& { .sprite(12); }
.italic& { .sprite(13); }
.arrangeup& { .sprite(14); }
.arrangedown& { .sprite(15); }
.expandtoleaf& { background-position: 0 -995px; }
.collapsetolevel1& { background-position: 0 -1015px;}
.fullscreen& { background-position: 0 -1035px;}
}
\ No newline at end of file
#img_panels {
margin: 0 auto;
border: 1px solid #EEE;
height: 400px;
position: relative;
clear: both;
z-index: 60;
padding: 20px 15px;
background: white;
}
#img_panels .fui-container {
display: block;
}
#img_panels .searchBar {
width: 100%;
height: 30px;
margin-bottom: 5px;
padding: 0px;
label {
vertical-align: middle;
display: inline-block;
height: 30px;
line-height: 30px;
}
}
#img_searchTxt {
width: 370px;
}
#img_searchBtn {
margin-left: 10px;
float: right;
}
#img_buttons {
height: 35px;
position: relative;
z-index: 70;
background: #fcfcfc;
overflow: visible;
}
#img_buttons .fui-button {
box-sizing: border-box;
height: 35px;
line-height: 35px;
padding: 0 15px;
border: 1px solid transparent;
text-align: center;
.fui-icon {display: none;}
.fui-label {
display: block;
height: 35px;
line-height: 35px;
}
&:hover {
background: none;
text-decoration: underline;
}
}
#img_buttons .fui-button.fui-selected {
background: #fff;
border-color: #eee #eee white #eee;
height: 36px;
&:hover {
text-decoration: none;
}
}
#img_searchList {
height: 370px;
overflow: hidden;
clear: both;
}
#img_searchListUl {
margin: 0;
padding: 0;
list-style: none;
clear: both;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
zoom: 1;
position: relative;
}
#img_searchListUl li {
list-style: none;
float: left;
display: block;
width: 115px;
height: 115px;
line-height: 115px;
margin: 6px;
padding: 0;
font-size: 12px;
position: relative;
vertical-align: top;
text-align: center;
overflow: hidden;
cursor: pointer;
border: 2px solid #fcfcfc;
img {
max-width: 111px;
max-height: 115px;
vertical-align: middle;
}
span {
display: block;
position: absolute;
bottom: 0;
height: 20px;
background: rgba(0, 0, 0, .5);
left: 0;
right: 0;
color: white;
line-height: 20px;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
white-space: nowrap;
opacity: 0;
transform: translate(0, 20px);
transition: all .2s ease;
}
&:hover span {
opacity: 1;
transform: translate(0, 0);
}
}
#img_searchListUl li.selected {
border: 2px solid @theme-color;
}
#img_searchListUl li p{
background-color: #eee;
margin: 0;
padding: 0;
position: relative;
width: 100%;
height: 115px;
overflow: hidden;
}
#img_searchListUl li a {
color: #999;
border-top: 1px solid #F2F2F2;
background: #FAFAFA;
text-align: center;
display: block;
padding: 0 5px;
width: 105px;
height: 32px;
line-height: 32px;
white-space: nowrap;
text-overflow: ellipsis;
text-decoration: none;
overflow: hidden;
word-break: break-all;
}
/**
* 基本页面样式
*/
html, body, div {
margin: 0;
padding: 0;
overflow: hidden;
}
body, svg {
font-family: "Microsoft Yahei", "Heiti SC", Arial, sans-serif;
}
html, body {
height: 100%;
}
#content-wrapper {
overflow: hidden;
.dock;
position: fixed;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-user-drag: none;
cursor: default;
}
#kityminder {
.dock(100px, 0, 0, 0);
&.maximize {
top: 40px;
}
&:focus {
/* box-shadow: inset 0 0 10px fadeOut(black, 0.5); */
}
-moz-user-select: none;
}
#tab-container.collapsed + #kityminder,
#panel + #kityminder{
top: 40px;
}
.fullscreen #panel {
transform: translate(0, -101px);
}
.fullscreen #kityminder {
top: 0 !important;
}
#panel {
background: @ui-color;
font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei';
height: @panel-height;
overflow: hidden;
-webkit-backface-visibility: hidden;
position: relative;
transition: transform .7s ease;
z-index: 11;
h1 {
font-size: 14px;
height: @panel-height;
line-height: @panel-height;
margin: 0;
text-align: center;
font-weight: normal;
color: @ui-fore;
vertical-align: middle;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
span {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
input {
outline: none;
font-size: 14px;
border: none;
border-radius: 2px;
box-shadow: 0 0 3px black;
padding: 3px 2px 3px 5px;
background: white;
}
&.rename-enabled{
cursor: text;
&:after {
content: ' ';
width: 20px;
height: 20px;
display: inline-block;
background: url(../images/icons.png) 1px -1110px;
vertical-align: middle;
position: relative;
top: -1px;
margin-left: 5px;
opacity: 0;
transition: opacity ease .3s;
}
}
&.rename-enabled:hover:after {
opacity: 0.6;
}
&.loading {
&:before {
position: relative;
display: inline-block;
.loading-circle(12px, 3px);
left: -6px;
top: 3px;
box-shadow: none;
}
&:after {
display: none;
}
}
}
}
.fui-widget {
-webkit-font-smoothing: auto;
}
\ No newline at end of file
.local-file-open-panel {
position: relative;
& > h2 {
&:before {
content: ' ';
display: block;
width: 25px;
height: 25px;
position: absolute;
left: 0;
background: url(../images/icons.png) no-repeat 0 -495px;
}
}
.pick-file {
padding: 10px 0;
a {
.button;
margin: 0 10px 10px 0;
}
span {
line-height: 30px;
}
}
.drop-file {
border: 2px dashed #eee;
border-radius: 4px;
height: 100px;
width: 100px;
text-align: center;
font-size: 16px;
color: #CCC;
margin: 150px auto;
transition: all .1s ease;
span {
display: block;
margin-top: 25px;
padding: 0 15px;
}
&.accept {
border-color: lighten(@tab-active, 40%);
transform: scale(1.2);
}
&.deny {
border-color: #eee;
color: #eee;
}
}
}
\ No newline at end of file
This diff is collapsed.
.new-file-template-select {
margin: 0;
padding: 0;
list-style: none;
li {
display: inline-block;
position: relative;
width: 120px;
height: 120px;
margin-right: 20px;
margin-bottom: 20px;
cursor: pointer;
a {
display: block;
text-align: center;
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
&:before {
content: ' ';
display: block;
position: absolute;
.dock(0, 0, 24px, 0);
border: 1px solid #ddd;
}
&:after {
content: ' ';
display: block;
position: absolute;
width: 100px;
height: 80px;
left: 50%;
top: 10px;
margin-left: -50px;
background: url(../images/template_large.png) no-repeat;
}
&.default:after {
background-position: 0 0;
}
&.structure:after {
background-position: -100px 0;
}
&.filetree:after {
background-position: -200px 0;
}
&.right:after {
background-position: -300px 0;
}
&.fish-bone:after {
background-position: -400px 0;
}
&:hover {
a {
color: @main-menu-theme-color;
}
&:before {
border: 1px solid @main-menu-theme-color;
}
}
&:active:before {
background-color: lighten(@main-menu-theme-color, 20%);
}
}
}
\ No newline at end of file
.fullscreen .preview-navigator {
transform: translate(-45px, 30px);
}
.preview-navigator {
background: white;
width: 140px;
height: 120px;
position: absolute;
left: 45px;
bottom: 30px;
box-shadow: 0 0 8px rgba(0, 0, 0, .2);
border-radius: 0 2px 2px 0;
padding: 1px;
z-index: 9;
cursor: crosshair;
transition: transform .7s 0.1s ease;
&.grab {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
}
.fullscreen .nav-bar {
transform: translate(-60px, 0);
}
.nav-bar {
position: absolute;
width: 35px;
height: 240px;
padding: 5px 0;
left: 10px;
bottom: 10px;
background: @theme-color;
border-radius: 4px;
z-index: 10;
box-shadow: 3px 3px 10px rgba(0, 0, 0, .2);
transition: transform .7s 0.1s ease;
.command-button {
width: 35px;
height: 24px;
text-align: center;
line-height: 30px;
.fui-label {
display: none;
}
.fui-icon {
background: url(../images/icons.png);
width: 20px;
height: 20px;
margin: 2px auto;
display: block;
}
&:hover {
background: lighten(@theme-color, 10%);
}
&:active {
background: darken(@theme-color, 3%);
}
&.active {
background: #5A6378;
}
&.hand, &.nav-trigger, &.camera {
height: 25px;
margin: 3px 0;
.fui-icon {
margin: 0 auto;
width: 25px;
height: 25px;
}
}
&.zoom-in .fui-icon {
background-position: 0 -730px;
}
&.zoom-out .fui-icon {
background-position: 0 -750px;
}
&.hand {
margin-top: 10px;
.fui-icon {
background-position: 0 -770px;
}
&.active .fui-icon {
background-position: 0 -795px;
}
}
&.nav-trigger {
.fui-icon {
background-position: 0 -820px;
}
&.active .fui-icon {
background-position: 0 -845px;
}
}
&.camera {
.fui-icon {
background-position: 0 -870px;
}
margin-bottom: 0;
}
}
.zoom-pan {
width: 2px;
height: 70px;
box-shadow: 0 1px #E50000;
position: relative;
background: white;
margin: 3px auto;
overflow: visible;
.origin {
position: absolute;
width: 20px;
height: 8px;
left: -9px;
margin-top: -4px;
background: transparent;
&:after {
content: ' ';
display: block;
width: 6px;
height: 2px;
background: white;
left: 7px;
top: 3px;
position: absolute;
}
&:hover:after {
box-shadow: 0 0 5px rgba(255, 255, 255, 1);
}
}
.indicator {
position: absolute;
width: 8px;
height: 8px;
left: -3px;
background: white;
border-radius: 100%;
margin-top: -4px;
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.km_receiver{
width:0;
height:0;
}
\ No newline at end of file
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.
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.
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.
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.
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.
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.
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.
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.
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.
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