Commit 58eea84c authored by techird's avatar techird

草稿箱功能

parent 359e26b6
......@@ -11,6 +11,7 @@
<script src="../lang/zh-cn/zh-cn.js" charset="utf-8"></script>
<script src="../lib/baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script>
<script src="../social/draftmanager.js" charset="utf-8"></script>
<script src="../social/social.js" charset="utf-8"></script>
<link href="../social/social.css" rel="stylesheet">
......
......@@ -11,6 +11,7 @@
<script src="../lang/zh-cn/zh-cn.js" charset="utf-8"></script>
<script src="../lib/baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script>
<script src="../social/draftmanager.js" charset="utf-8"></script>
<script src="../social/social.js" charset="utf-8"></script>
<link href="../social/social.css" rel="stylesheet">
......
!function(){var a,b,c,d;!function(){var e={},f={};a=function(a,b,c){e[a]={deps:b,callback:c}},d=c=b=function(a){function c(b){if("."!==b.charAt(0))return b;for(var c=b.split("/"),d=a.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)"exports"===i[l]?k.push(g={}):k.push(b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j<a.length;j++)g=a[j],g&&e(g.then)?g.then(d(j),c):f(j,g)})}var d=a.isArray,e=a.isFunction;b.all=c}),a("promise/asap",["exports"],function(a){"use strict";function b(){return function(){process.nextTick(e)}}function c(){var a=0,b=new i(e),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function d(){return function(){j.setTimeout(e,1)}}function e(){for(var a=0;a<k.length;a++){var b=k[a],c=b[0],d=b[1];c(d)}k=[]}function f(a,b){var c=k.push([a,b]);1===c&&g()}var g,h="undefined"!=typeof window?window:{},i=h.MutationObserver||h.WebKitMutationObserver,j="undefined"!=typeof global?global:this,k=[];g="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?b():i?c():d(),a.asap=f}),a("promise/cast",["exports"],function(a){"use strict";function b(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=this;return new b(function(b){b(a)})}a.cast=b}),a("promise/config",["exports"],function(a){"use strict";function b(a,b){return 2!==arguments.length?c[a]:(c[a]=b,void 0)}var c={instrument:!1};a.config=c,a.configure=b}),a("promise/polyfill",["./promise","./utils","exports"],function(a,b,c){"use strict";function d(){var a="Promise"in window&&"cast"in window.Promise&&"resolve"in window.Promise&&"reject"in window.Promise&&"all"in window.Promise&&"race"in window.Promise&&function(){var a;return new window.Promise(function(b){a=b}),f(a)}();a||(window.Promise=e)}var e=a.Promise,f=b.isFunction;c.polyfill=d}),a("promise/promise",["./config","./utils","./cast","./all","./race","./resolve","./reject","./asap","exports"],function(a,b,c,d,e,f,g,h,i){"use strict";function j(a){if(!w(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof j))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],k(a,this)}function k(a,b){function c(a){p(b,a)}function d(a){r(b,a)}try{a(c,d)}catch(e){d(e)}}function l(a,b,c,d){var e,f,g,h,i=w(c);if(i)try{e=c(d),g=!0}catch(j){h=!0,f=j}else e=d,g=!0;o(b,e)||(i&&g?p(b,e):h?r(b,f):a===F?p(b,e):a===G&&r(b,e))}function m(a,b,c,d){var e=a._subscribers,f=e.length;e[f]=b,e[f+F]=c,e[f+G]=d}function n(a,b){for(var c,d,e=a._subscribers,f=a._detail,g=0;g<e.length;g+=3)c=e[g],d=e[g+b],l(b,c,d,f);a._subscribers=null}function o(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(v(b)&&(d=b.then,w(d)))return d.call(b,function(d){return c?!0:(c=!0,b!==d?p(a,d):q(a,d),void 0)},function(b){return c?!0:(c=!0,r(a,b),void 0)}),!0}catch(e){return c?!0:(r(a,e),!0)}return!1}function p(a,b){a===b?q(a,b):o(a,b)||q(a,b)}function q(a,b){a._state===D&&(a._state=E,a._detail=b,u.async(s,a))}function r(a,b){a._state===D&&(a._state=E,a._detail=b,u.async(t,a))}function s(a){n(a,a._state=F)}function t(a){n(a,a._state=G)}var u=a.config,v=(a.configure,b.objectOrFunction),w=b.isFunction,x=(b.now,c.cast),y=d.all,z=e.race,A=f.resolve,B=g.reject,C=h.asap;u.async=C;var D=void 0,E=0,F=1,G=2;j.prototype={constructor:j,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;u.async(function(){l(c._state,d,e[c._state-1],c._detail)})}else m(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}},j.all=y,j.cast=x,j.race=z,j.resolve=A,j.reject=B,i.Promise=j}),a("promise/race",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to race.");return new b(function(b,c){for(var d,e=0;e<a.length;e++)d=a[e],d&&"function"==typeof d.then?d.then(b,c):b(d)})}var d=a.isArray;b.race=c}),a("promise/reject",["exports"],function(a){"use strict";function b(a){var b=this;return new b(function(b,c){c(a)})}a.reject=b}),a("promise/resolve",["exports"],function(a){"use strict";function b(a){var b=this;return new b(function(b){b(a)})}a.resolve=b}),a("promise/utils",["exports"],function(a){"use strict";function b(a){return c(a)||"object"==typeof a&&null!==a}function c(a){return"function"==typeof a}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}var e=Date.now||function(){return(new Date).getTime()};a.objectOrFunction=b,a.isFunction=c,a.isArray=d,a.now=e}),b("promise/polyfill").polyfill()}();
\ No newline at end of file
function DraftManager( minder ) {
var current = null,
localStorage = window.localStorage,
drafts;
init();
function init() {
drafts = localStorage.getItem( 'drafts' );
drafts = drafts ? JSON.parse( drafts ) : [];
}
function store() {
localStorage.setItem( 'drafts', JSON.stringify( drafts ) );
}
function create( path ) {
current = {
path: path || 'local/' + ( +new Date() )
};
drafts.unshift( current );
save();
}
function open( index ) {
current = drafts[ index ];
if ( !current ) return false;
// bring it first
drafts.splice( index, 1 );
drafts.unshift( current );
store();
return current;
}
function load() {
if ( current ) {
minder.importData( current.data, "json" );
}
return current;
}
function openByPath( path ) {
for ( var i = 0; i < drafts.length; i++ ) {
if ( drafts[ i ].path == path ) return open( i );
}
return false;
}
function save( path ) {
if ( current === null ) {
create();
} else {
current.path = path || current.path;
current.name = minder.getMinderTitle();
current.data = minder.exportData( "json" );
current.update = new Date();
store();
}
}
function list() {
return drafts.slice();
}
function remove( remove_index ) {
drafts.splice( remove_index, 1 );
store();
}
function clear() {
drafts.splice( 1 );
store();
}
return {
open: open,
openByPath: openByPath,
load: load,
save: save,
create: create,
list: list,
remove: remove,
clear: clear
};
}
\ No newline at end of file
#social {
position: absolute;
right: 10px;
top: 10px;
line-height: 20px;
text-align: right;
overflow: hidden;
}
#social button {
font-family: Arial, "Heiti SC", "Microsoft Yahei";
outline: none;
display: inline-block;
padding: 0 15px;
height: 35px;
font-size: 13px;
line-height: 35px;
text-align: center;
border-radius: 5px;
color: #ffffff;
text-decoration: none;
border: none;
margin-left: 5px;
cursor: pointer;
background: #0099f2;
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0099f2), color-stop(0%, #4096ee), color-stop(100%, #0076dd));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* W3C */
}
#social button:hover {
background: #009fff;
}
#social button[disabled] {
background: #AAA;
}
#social button.baidu-cloud {
padding-left: 35px;
position: relative;
}
#social button.baidu-cloud:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/baiducloud.png);
position: absolute;
left: 7px;
top: 5px;
}
#social button.share {
padding-left: 35px;
position: relative;
}
#social button.share:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/share.png) no-repeat;
position: absolute;
left: 7px;
top: 5px;
}
#social button img {
position: relative;
top: 3px;
border-radius: 2px;
margin-right: 7px;
}
#social button.user-file {
padding-right: 28px;
position: relative;
}
#social button.user-file:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 15px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #FFFFFF transparent transparent transparent;
}
.user-file-menu {
margin-top: 20px;
margin-left: 1px;
}
#social{position:absolute;right:10px;top:10px;line-height:20px;text-align:right;overflow:hidden}
.dropdown{padding-right:28px}.dropdown:after{content:' ';display:block;position:absolute;right:10px;top:15px;width:0;height:0;border:solid;border-width:4px 5px;border-color:#fff transparent transparent transparent}
button{font-family:Arial,"Heiti SC","Microsoft Yahei";outline:none;display:inline-block;padding:0 15px;height:35px;font-size:13px;line-height:35px;text-align:center;border-radius:5px;color:#fff;text-decoration:none;border:none;margin-left:5px;cursor:pointer;background:#0099f2;background:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);}button:hover{background:#009fff}
button:active{background:#007fcc;box-shadow:inset 0 2px 3px rgba(0,0,0,0.2)}
button[disabled]{background:#aaa}
button.baidu-cloud{padding-left:35px;position:relative}button.baidu-cloud:before{content:' ';display:block;width:24px;height:24px;background:url(../themes/default/images/baiducloud.png);position:absolute;left:7px;top:5px}
button.share{padding-left:35px;position:relative}button.share:before{content:' ';display:block;width:24px;height:24px;background:url(../themes/default/images/share.png) no-repeat;position:absolute;left:7px;top:5px}
button img{position:relative;top:3px;border-radius:2px;margin-right:7px}
button.user-file{position:relative;padding-right:28px}button.user-file:after{content:' ';display:block;position:absolute;right:10px;top:15px;width:0;height:0;border:solid;border-width:4px 5px;border-color:#fff transparent transparent transparent}
#draft-btn{position:absolute;left:10px;bottom:10px;padding-left:35px;padding-right:28px}#draft-btn:before{content:' ';display:block;width:24px;height:24px;background:url(../themes/default/images/draft.png) no-repeat;position:absolute;left:7px;top:5px}
#draft-btn:after{content:' ';display:block;position:absolute;right:10px;top:15px;width:0;height:0;border:solid;border-width:4px 5px;border-color:#fff transparent transparent transparent}
.draft-menu span.update-time{float:right;color:#ccc;margin-left:20px;padding-right:16px}
.draft-menu li.draft-item a{position:relative}.draft-menu li.draft-item a:before{content:' ';display:block;width:24px;height:24px;background:url(../themes/default/images/draft.png) no-repeat 0 -24px;position:absolute;left:4px;top:2px}
.draft-menu li.draft-item:hover a:before{background-position:0 -48px}
.draft-menu li.draft-item{position:relative}.draft-menu li.draft-item:hover a.delete{display:block}
.draft-menu li.draft-item a.delete{display:none;cursor:pointer;position:absolute;width:20px;height:20px;right:4px;top:4px;padding:0;background:url(../themes/default/images/close-button.png) no-repeat 0 0}.draft-menu li.draft-item a.delete:before{display:none}
.draft-menu li.draft-item a.delete:hover{background-position:0 -20px}
.draft-menu.kmui-combobox-menu .kmui-combobox-checked{overflow:hidden;opacity:1;color:#ccc}.draft-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-icon{float:left;margin:5px 0;width:28px;background-position:center 0;opacity:.3}
.draft-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-item-label{display:block;margin-left:28px}
.draft-menu.kmui-combobox-menu .kmui-combobox-checked:hover{color:#ccc}.draft-menu.kmui-combobox-menu .kmui-combobox-checked:hover .kmui-combobox-icon{background-position:center 0}
.user-file-menu{margin-top:20px;margin-left:1px}
This diff is collapsed.
......@@ -5,87 +5,184 @@
line-height: 20px;
text-align: right;
overflow: hidden;
button {
font-family: Arial, "Heiti SC", "Microsoft Yahei";
outline: none;
display: inline-block;
padding: 0 15px;
height: 35px;
font-size: 13px;
line-height: 35px;
text-align: center;
border-radius: 5px;
color: #ffffff;
text-decoration: none;
border: none;
margin-left: 5px;
cursor: pointer;background: #0099f2; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0099f2), color-stop(0%,#4096ee), color-stop(100%,#0076dd)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
&:hover {
background: #009fff;
}
}
&[disabled] {
background: #AAA;
}
.dropdown {
padding-right: 28px;
&:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 15px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #FFFFFF transparent transparent transparent;
}
}
&.baidu-cloud {
padding-left: 35px;
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/baiducloud.png);
position: absolute;
left: 7px;
top: 5px;
}
button {
font-family: Arial, "Heiti SC", "Microsoft Yahei";
outline: none;
display: inline-block;
padding: 0 15px;
height: 35px;
font-size: 13px;
line-height: 35px;
text-align: center;
border-radius: 5px;
color: #ffffff;
text-decoration: none;
border: none;
margin-left: 5px;
cursor: pointer;
background: #0099f2; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0099f2), color-stop(0%,#4096ee), color-stop(100%,#0076dd)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
&:hover {
background: #009fff;
}
&:active {
background: darken(#009fff, 10%);
box-shadow: inset 0 2px 3px rgba(0,0,0, .2);
}
&[disabled] {
background: #AAA;
}
&.baidu-cloud {
padding-left: 35px;
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/baiducloud.png);
position: absolute;
left: 7px;
top: 5px;
}
}
&.share {
padding-left: 35px;
position: relative;
&.share {
padding-left: 35px;
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/share.png) no-repeat;
position: absolute;
left: 7px;
top: 5px;
}
}
img {
position: relative;
top: 3px;
border-radius: 2px;
margin-right: 7px;
}
&.user-file {
position: relative;
.dropdown;
}
}
#draft-btn {
position: absolute;
left: 10px;
bottom: 10px;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/draft.png) no-repeat;
position: absolute;
left: 7px;
top: 5px;
}
padding-left: 35px;
.dropdown;
}
.draft-menu {
span.update-time {
float: right;
color: #CCC;
margin-left: 20px;
padding-right: 16px;
}
li.draft-item a {
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/draft.png) no-repeat 0 -24px;
position: absolute;
left: 4px;
top: 2px;
}
}
li.draft-item:hover a:before {
background-position: 0 -48px;
}
li.draft-item {
position: relative;
&:hover a.delete{
display: block;
}
a.delete {
display: none;
cursor: pointer;
position: absolute;
width: 20px;
height: 20px;
right: 4px;
top: 4px;
padding: 0;
background: url(../themes/default/images/close-button.png) no-repeat 0 0;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/share.png) no-repeat;
position: absolute;
left: 7px;
top: 5px;
display: none;
}
&:hover {
background-position: 0 -20px;
}
}
}
&.kmui-combobox-menu .kmui-combobox-checked {
overflow: hidden;
opacity: 1;
color: #CCC;
.kmui-combobox-icon {
float: left;
margin: 5px 0;
width: 28px;
background-position: center 0;
opacity: .3;
}
img {
position: relative;
top: 3px;
border-radius: 2px;
margin-right: 7px;
.kmui-combobox-item-label {
display: block;
margin-left: 28px;
}
&.user-file {
padding-right: 28px;
position: relative;
&:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 15px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #FFFFFF transparent transparent transparent;
&:hover {
color: #CCC;
.kmui-combobox-icon {
background-position: center 0;
}
}
}
......
//dropmenu 类
KM.ui.define('dropmenu', {
KM.ui.define( 'dropmenu', {
tmpl: '<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >' +
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>' +
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active|| \'\' %> <%=ci.disabled||\'\' %>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">' +
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' +
'</li><%}}%>' +
'<%}%>'+
'<%}%>' +
'</ul>',
subTmpl:'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
subTmpl: '<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>' +
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active|| \'\' %> <%=ci.disabled||\'\' %>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">' +
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' +
......@@ -16,32 +16,34 @@ KM.ui.define('dropmenu', {
'<%}%>',
defaultOpt: {
data: [],
click: function () {
}
anchor: 'top',
click: function () {}
},
setData:function(items){
setData: function ( items ) {
this.root().html($.parseTmpl(this.subTmpl,items));
this.root().html( $.parseTmpl( this.subTmpl, items ) );
return this;
},
position:function(offset){
this.root().css({
left:offset.x,
top:offset.y
});
position: function ( offset ) {
this.root().css( {
left: offset.x,
top: offset.y
} );
return this;
},
show:function(){
if(this.trigger('beforeshow') === false){
show: function () {
if ( this.trigger( 'beforeshow' ) === false ) {
return;
}else{
this.root().css({display:'block'});
this.trigger('aftershow');
} else {
this.root().css( {
display: 'block'
} );
this.trigger( 'aftershow' );
}
return this;
},
init: function (options) {
init: function ( options ) {
var me = this;
var eventName = {
click: 1,
......@@ -49,55 +51,57 @@ KM.ui.define('dropmenu', {
mouseout: 1
};
this.root($($.parseTmpl(this.tmpl, options))).on('click', 'li[class!="kmui-disabled kmui-divider kmui-dropdown-submenu"]',function (evt) {
$.proxy(options.click, me, evt, $(this).data('value'), $(this).data('label'),$(this))()
}).find('li').each(function (i, el) {
var $this = $(this);
if (!$this.hasClass("kmui-disabled kmui-divider kmui-dropdown-submenu")) {
var data = options.data[i];
$.each(eventName, function (k) {
data[k] && $this[k](function (evt) {
$.proxy(data[k], el)(evt, data, me.root)
})
})
}
});
this.root( $( $.parseTmpl( this.tmpl, options ) ) ).on( 'click', 'li[class!="kmui-disabled kmui-divider kmui-dropdown-submenu"]', function ( evt ) {
$.proxy( options.click, me, evt, $( this ).data( 'value' ), $( this ).data( 'label' ), $( this ) )();
} ).find( 'li' ).each( function ( i, el ) {
var $this = $( this );
if ( !$this.hasClass( "kmui-disabled kmui-divider kmui-dropdown-submenu" ) ) {
var data = options.data[ i ];
$.each( eventName, function ( k ) {
if ( data[ k ] ) {
$this[ k ]( function ( evt ) {
$.proxy( data[ k ], el )( evt, data, me.root );
} );
}
} );
}
} );
},
_initEvent:function(){
this.root().on('mouseover','li[class="kmui-dropdown-submenu',function(e){
var $submenu = $(this).data('widget');
$submenu.kmui().show($(this),'right','position',5,2)
});
_initEvent: function () {
this.root().on( 'mouseover', 'li[class="kmui-dropdown-submenu', function ( e ) {
var $submenu = $( this ).data( 'widget' );
$submenu.kmui().show( $( this ), 'right', 'position', 5, 2 );
} );
},
disabled: function (cb) {
$('li[class!=kmui-divider]', this.root()).each(function () {
var $el = $(this);
if (cb === true) {
$el.addClass('kmui-disabled')
} else if ($.isFunction(cb)) {
$el.toggleClass('kmui-disabled', cb(li))
disabled: function ( cb ) {
$( 'li[class!=kmui-divider]', this.root() ).each( function () {
var $el = $( this );
if ( cb === true ) {
$el.addClass( 'kmui-disabled' );
} else if ( $.isFunction( cb ) ) {
$el.toggleClass( 'kmui-disabled', cb( $el ) );
} else {
$el.removeClass('kmui-disabled')
$el.removeClass( 'kmui-disabled' );
}
});
} );
},
val: function (val) {
val: function ( val ) {
var currentVal;
$('li[class!="kmui-divider kmui-disabled kmui-dropdown-submenu"]', this.root()).each(function () {
var $el = $(this);
if (val === undefined) {
if ($el.find('em.kmui-dropmenu-checked').length) {
currentVal = $el.data('value');
return false
$( 'li[class!="kmui-divider kmui-disabled kmui-dropdown-submenu"]', this.root() ).each( function () {
var $el = $( this );
if ( val === undefined ) {
if ( $el.find( 'em.kmui-dropmenu-checked' ).length ) {
currentVal = $el.data( 'value' );
return false;
}
} else {
$el.find('em').toggleClass('kmui-dropmenu-checked', $el.data('value') == val)
$el.find( 'em' ).toggleClass( 'kmui-dropmenu-checked', $el.data( 'value' ) == val );
}
});
if (val === undefined) {
return currentVal
} );
if ( val === undefined ) {
return currentVal;
}
},
appendItem: function ( item ) {
......@@ -109,18 +113,18 @@ KM.ui.define('dropmenu', {
var $item = $( html ).click( item.click );
this.root().append( $item );
},
addSubmenu: function (label, menu, index) {
addSubmenu: function ( label, menu, index ) {
index = index || 0;
var $list = $('li[class!=kmui-divider]', this.root());
var $node = $('<li class="kmui-dropdown-submenu"><a tabindex="-1" href="#">' + label + '</a></li>').append(menu);
$node.data('widget',menu);
if (index >= 0 && index < $list.length) {
$node.insertBefore($list[index]);
} else if (index < 0) {
$node.insertBefore($list[0]);
} else if (index >= $list.length) {
$node.appendTo($list);
var $list = $( 'li[class!=kmui-divider]', this.root() );
var $node = $( '<li class="kmui-dropdown-submenu"><a tabindex="-1" href="#">' + label + '</a></li>' ).append( menu );
$node.data( 'widget', menu );
if ( index >= 0 && index < $list.length ) {
$node.insertBefore( $list[ index ] );
} else if ( index < 0 ) {
$node.insertBefore( $list[ 0 ] );
} else if ( index >= $list.length ) {
$node.appendTo( $list );
}
}
}, 'menu');
\ No newline at end of file
}, 'menu' );
\ No newline at end of file
......@@ -41,8 +41,8 @@
text-decoration: none;
}
.kmui-dropdown-menu > li > a:hover,
.kmui-dropdown-menu > li > a:focus {
.kmui-dropdown-menu > li:hover > a,
.kmui-dropdown-menu > li:focus > a {
background: #0099f2; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
......
......@@ -24,6 +24,7 @@ html, body, #kityminder, div.kmui-editor-body {
.kmui-container .kmui-toolbar{
background-color: #fafafa;
z-index: 99999;
margin-right: 400px;
}
.kmui-toolbar .kmui-btn-toolbar{
padding: 5px;
......
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