Commit ed1befc0 authored by techird's avatar techird

update kity reference

parent a5250c99
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
* livereload Default Setting * livereload Default Setting
*-----------------------------------------------------*/ *-----------------------------------------------------*/
'use strict'; 'use strict';
var path = require( 'path' ); var path = require('path');
var lrSnippet = require( 'grunt-contrib-livereload/lib/utils' ).livereloadSnippet; var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
/*----------------------------------------------------- /*-----------------------------------------------------
* Module Setting * Module Setting
*-----------------------------------------------------*/ *-----------------------------------------------------*/
module.exports = function ( grunt ) { module.exports = function (grunt) {
var banner = '/*!\n' + var banner = '/*!\n' +
' * ====================================================\n' + ' * ====================================================\n' +
...@@ -24,36 +24,36 @@ module.exports = function ( grunt ) { ...@@ -24,36 +24,36 @@ module.exports = function ( grunt ) {
srcPath = 'src/', srcPath = 'src/',
distPath = 'dist/'; distPath = 'dist/';
var getPath = function ( readFile ) { var getPath = function (readFile) {
var sources = require( "fs" ).readFileSync( readFile ); var sources = require("fs").readFileSync(readFile);
sources = /Array\(([^)]+)\)/.exec( sources ); sources = /Array\(([^)]+)\)/.exec(sources);
sources = sources[ 1 ].replace( /\/\/.*\n/g, '\n' ).replace( /'|"|\n|\t|\s/g, '' ); sources = sources[1].replace(/\/\/.*\n/g, '\n').replace(/'|"|\n|\t|\s/g, '');
sources = sources.split( "," ); sources = sources.split(",");
sources.forEach( function ( filepath, index ) { sources.forEach(function (filepath, index) {
sources[ index ] = srcPath + filepath; sources[index] = srcPath + filepath;
} ); });
return sources; return sources;
}; };
// Project configuration. // Project configuration.
grunt.initConfig( { grunt.initConfig({
// Metadata. // Metadata.
pkg: grunt.file.readJSON( 'package.json' ), pkg: grunt.file.readJSON('package.json'),
concat: { concat: {
js: { js: {
options: { options: {
banner: banner + '(function(kity, window) {\n\n', banner: banner + '(function(kity, window) {\n\n',
footer: '\n\n})(kity, window)', footer: '\n\n})(kity, window)',
process: function ( src, filepath ) { process: function (src, filepath) {
return src + "\n"; return src + "\n";
} }
}, },
src: getPath( buildPath ), src: getPath(buildPath),
dest: distPath + 'kityminder.all.js' dest: distPath + 'kityminder.all.js'
} }
}, },
...@@ -62,18 +62,18 @@ module.exports = function ( grunt ) { ...@@ -62,18 +62,18 @@ module.exports = function ( grunt ) {
options: { options: {
banner: banner banner: banner
}, },
files: ( function () { files: (function () {
var files = {}; var files = {};
files[ distPath + 'kityminder.all.min.js' ] = distPath + 'kityminder.all.js'; files[distPath + 'kityminder.all.min.js'] = distPath + 'kityminder.all.js';
console.log(files); console.log(files);
return files; return files;
} )() })()
} }
}, },
copy: { copy: {
dir: { dir: {
files: [ { files: [{
src: [ 'dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**', 'index.html' ], src: ['dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**', 'index.html'],
dest: distPath dest: distPath
}] }]
}, },
...@@ -99,22 +99,22 @@ module.exports = function ( grunt ) { ...@@ -99,22 +99,22 @@ module.exports = function ( grunt ) {
online: { online: {
src: distPath + 'index.html', src: distPath + 'index.html',
overwrite: true, overwrite: true,
replacements: [ { replacements: [{
from: /kity\/dist\/kitygraph\.all\.js/ig, from: /kity\/dist\/kity\.js/ig,
to: 'lib/kitygraph.all.min.js' to: 'lib/kitygraph.all.min.js'
}, { }, {
from: /import\.js/, from: /import\.js/,
to: 'kityminder.all.min.js' to: 'kityminder.all.min.js'
} ] }]
}, },
noCache: { noCache: {
src: distPath + 'index.html', src: distPath + 'index.html',
overwrite: true, overwrite: true,
replacements: [ { replacements: [{
from: /src=\"(.+?)\.js\"/ig, from: /src=\"(.+?)\.js\"/ig,
to: 'src="$1.js?_=' + +new Date() + '"' to: 'src="$1.js?_=' + +new Date() + '"'
} ] }]
} }
}, },
...@@ -128,11 +128,11 @@ module.exports = function ( grunt ) { ...@@ -128,11 +128,11 @@ module.exports = function ( grunt ) {
hostname: '*', hostname: '*',
port: 9001, port: 9001,
base: '.', base: '.',
middleware: function ( connect, options, middlewares ) { middleware: function (connect, options, middlewares) {
return [ return [
lrSnippet, lrSnippet,
connect.static( options.base.toString() ), connect.static(options.base.toString()),
connect.directory( options.base.toString() ) connect.directory(options.base.toString())
]; ];
} }
} }
...@@ -141,26 +141,26 @@ module.exports = function ( grunt ) { ...@@ -141,26 +141,26 @@ module.exports = function ( grunt ) {
regarde: { regarde: {
js: { js: {
files: 'src/**/*.js', files: 'src/**/*.js',
tasks: [ 'default', 'livereload' ] tasks: ['default', 'livereload']
} }
} }
/* End [Task liverload] ------------------------------------*/ /* End [Task liverload] ------------------------------------*/
} ); });
// These plugins provide necessary tasks. // These plugins provide necessary tasks.
/* [Build plugin & task ] ------------------------------------*/ /* [Build plugin & task ] ------------------------------------*/
grunt.loadNpmTasks( 'grunt-contrib-concat' ); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks( 'grunt-contrib-uglify' ); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks( 'grunt-contrib-copy' ); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks( 'grunt-text-replace' ); grunt.loadNpmTasks('grunt-text-replace');
// Build task(s). // Build task(s).
grunt.registerTask( 'default', [ 'concat', 'uglify', 'copy', 'replace' ] ); grunt.registerTask('default', ['concat', 'uglify', 'copy', 'replace']);
/* [liverload plugin & task ] ------------------------------------*/ /* [liverload plugin & task ] ------------------------------------*/
grunt.loadNpmTasks( 'grunt-regarde' ); grunt.loadNpmTasks('grunt-regarde');
grunt.loadNpmTasks( 'grunt-contrib-connect' ); grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks( 'grunt-contrib-livereload' ); grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.registerTask( 'live', [ 'livereload-start', 'connect', 'regarde' ] ); grunt.registerTask('live', ['livereload-start', 'connect', 'regarde']);
}; };
\ No newline at end of file
Copyright (c) 2014, FEX,Baidu. Copyright (c) 2014, FEX, Baidu.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -11,7 +11,7 @@ modification, are permitted provided that the following conditions are met: ...@@ -11,7 +11,7 @@ modification, are permitted provided that the following conditions are met:
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of the {organization} nor the names of its * Neither the name of the KityMinder nor the names of its
contributors may be used to endorse or promote products derived from contributors may be used to endorse or promote products derived from
this software without specific prior written permission. this software without specific prior written permission.
......
( function ( utils ) {
var content = '<div class="image-content" style="padding:20px;width:360px;">';
content += '<style>';
content += '.kmui-dialog-<%= container %> input{';
content += 'width: 75%;';
content += 'padding: 6px 12px;';
content += 'font-size: 14px;';
content += 'line-height: 1.42857143;';
content += 'color: #555;';
content += 'background-color: #fff;';
content += 'background-image: none;';
content += 'border: 1px solid #ccc;';
content += 'border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba( 0, 0, 0, .075 );'
content += 'box-shadow: inset 0 1px 1px rgba( 0, 0, 0, .075 ); -webkit-transition: border-color ease-in-out .15s,';
content += 'box-shadow ease-in-out .15s;';
content += 'transition: border-color ease-in-out .15s,';
content += 'box-shadow ease-in-out .15s;';
content += '}';
content += '.kmui-dialog-<%= container %> input:focus{';
content += 'border-color: #66afe9;';
content += 'outline: 0;';
content += '-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);';
content += 'box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);';
content += '}';
content += '.kmui-dialog-<%= container %> button{';
content += 'height:34px;';
content += 'line-height:34px;';
content += 'vertical-align:1px';
content += '}';
content += '</style>';
content += '<input id="image_href"/>';
content += '<button id="image_insert">插入</button>';
content += '<hr style="height: 0; border: none; border-top: 1px solid #ccc;">';
content += '<img id="image_preview" style="max-width: 360px;"/>';
content += '</div>';
KM.registerWidget( 'image', {
tpl: content,
initContent: function ( km ) {
var lang = km.getLang( 'dialogs.image' ),
html;
if ( lang ) {
html = $.parseTmpl( this.tpl, utils.extend( {
'container': 'image'
}, lang ) );
}
this.root().html( html );
},
initEvent: function ( km, $w ) {
$w.find( '#image_insert' ).on( 'click', function () {
km.execCommand( 'image', $w.find( '#image_href' ).val() );
$w.kmui().hide();
} );
$w.find( '#image_href' ).on( 'keydown', function ( e ) {
if ( e.keyCode === 13 ) {
km.execCommand( 'image', $w.find( '#image_href' ).val() );
$w.kmui().hide();
}
} ).on('input', function() {
$w.find('#image_preview').attr('src', $w.find( '#image_href' ).val());
});
var url = km.queryCommandValue( 'image' );
var $input = $w.find( '#image_href' );
$input.val( url || 'http://' );
if(url) $w.find('#image_preview').attr('src', url);
setTimeout( function () {
$input.focus();
} );
},
width: 400
} );
} )( KM.Utils );
\ No newline at end of file
( function ( utils ) { (function (utils) {
KM.registerWidget( 'markers', { KM.registerWidget('markers', {
tpl: "<style>" + tpl: "<style>" +
".kmui-dialog-<%= container %> .priority .icon{background:url(dialogs/markers/images/iconpriority.png) 0 0}" + ".kmui-dialog-<%= container %> .priority .icon{background:url(dialogs/markers/images/iconpriority.png) 0 0}" +
".kmui-dialog-<%= container %> .progress .icon{background:url(dialogs/markers/images/iconprogress.png) 0 0}" + ".kmui-dialog-<%= container %> .progress .icon{background:url(dialogs/markers/images/iconprogress.png) 0 0}" +
...@@ -7,52 +7,73 @@ ...@@ -7,52 +7,73 @@
".kmui-dialog-<%= container %> .icon.p3{background-position: -40px 0}" + ".kmui-dialog-<%= container %> .icon.p3{background-position: -40px 0}" +
".kmui-dialog-<%= container %> .icon.p4{background-position: -60px 0}" + ".kmui-dialog-<%= container %> .icon.p4{background-position: -60px 0}" +
".kmui-dialog-<%= container %> .icon.p5{background-position: -80px 0}" + ".kmui-dialog-<%= container %> .icon.p5{background-position: -80px 0}" +
".kmui-dialog-<%= container %> .icon.p6{background-position: -100px 0}" +
".kmui-dialog-<%= container %> .icon.p7{background-position: -120px 0}" +
".kmui-dialog-<%= container %> .icon.p8{background-position: -140px 0}" +
".kmui-dialog-<%= container %> .icon.p9{background-position: -160px 0}" +
".kmui-dialog-<%= container %> .icon.p0{background-position: -180px 0}" +
".kmui-dialog-<%= container %> ul li{width:40%;display:inline-block}" +
".kmui-dialog-<%= container %> h4{padding:5px 10px; margin:0; background:#eee}" +
"</style>" + "</style>" +
"<h4><%= priority %></h3>" +
"<ul class='icon-list priority'>" + "<ul class='icon-list priority'>" +
"<li value='1' type='priority'><span class='icon p1'></span><span><%= priority %>1</span></li>" + "<li value='1' type='priority'><span class='icon p1'></span><span><%= priority %>1</span></li>" +
"<li value='2' type='priority'><span class='icon p2'></span><span><%= priority %>2</span></li>" + "<li value='2' type='priority'><span class='icon p2'></span><span><%= priority %>2</span></li>" +
"<li value='3' type='priority'><span class='icon p3'></span><span><%= priority %>3</span></li>" + "<li value='3' type='priority'><span class='icon p3'></span><span><%= priority %>3</span></li>" +
"<li value='4' type='priority'><span class='icon p4'></span><span><%= priority %>4</span></li>" + "<li value='4' type='priority'><span class='icon p4'></span><span><%= priority %>4</span></li>" +
"<li value='5' type='priority'><span class='icon p5'></span><span><%= priority %>5</span></li>" + "<li value='5' type='priority'><span class='icon p5'></span><span><%= priority %>5</span></li>" +
"<li value='6' type='priority'><span class='icon p6'></span><span><%= priority %>6</span></li>" +
"<li value='7' type='priority'><span class='icon p7'></span><span><%= priority %>7</span></li>" +
"<li value='8' type='priority'><span class='icon p8'></span><span><%= priority %>8</span></li>" +
"<li value='9' type='priority'><span class='icon p9'></span><span><%= priority %>9</span></li>" +
"<li value='0' type='priority'><span class='icon p0'></span><span><%= none %></span></li>" +
"</ul>" + "</ul>" +
"<h4><%= progress.title %></h4>" +
"<ul class='icon-list progress'>" + "<ul class='icon-list progress'>" +
"<li value='1' type='progress'><span class='icon p1'></span><span><%= progress.notdone %></span></li>" + "<li value='1' type='progress'><span class='icon p1'></span><span><%= progress.notdone %></span></li>" +
"<li value='2' type='progress'><span class='icon p2'></span><span><%= progress.quarterdone %></span></li>" + "<li value='2' type='progress'><span class='icon p2'></span><span><%= progress.done1 %></span></li>" +
"<li value='3' type='progress'><span class='icon p3'></span><span><%= progress.halfdone %></span></li>" + "<li value='3' type='progress'><span class='icon p3'></span><span><%= progress.done2 %></span></li>" +
"<li value='4' type='progress'><span class='icon p4'></span><span><%= progress.threequartersdone %></span></li>" + "<li value='4' type='progress'><span class='icon p4'></span><span><%= progress.done3 %></span></li>" +
"<li value='5' type='progress'><span class='icon p5'></span><span><%= progress.done %></span></li>" + "<li value='5' type='progress'><span class='icon p5'></span><span><%= progress.done4 %></span></li>" +
"<li value='6' type='progress'><span class='icon p6'></span><span><%= progress.done5 %></span></li>" +
"<li value='7' type='progress'><span class='icon p7'></span><span><%= progress.done6 %></span></li>" +
"<li value='8' type='progress'><span class='icon p8'></span><span><%= progress.done7 %></span></li>" +
"<li value='9' type='progress'><span class='icon p9'></span><span><%= progress.done %></span></li>" +
"<li value='0' type='progress'><span class='icon p0'></span><span><%= none %></span></li>" +
"</ul>", "</ul>",
initContent: function ( km, $w ) { initContent: function (km, $w) {
var lang = km.getLang( 'dialogs.markers' ); var lang = km.getLang('dialogs.markers');
if ( lang ) { if (lang) {
var html = $.parseTmpl( this.tpl, utils.extend( { var html = $.parseTmpl(this.tpl, utils.extend({
'container': 'markers' 'container': 'markers'
}, lang ) ); }, lang));
} }
this.root().html( html ); this.root().html(html);
var valPri = km.queryCommandValue("priority") || 0;
var valPro = km.queryCommandValue("progress") || 0;
$w.find("li[type='priority']").removeClass("active");
$w.find("li[type='priority'][value='" + valPri + "']").addClass("active");
$w.find("li[type='progress']").removeClass("active");
$w.find("li[type='progress'][value='" + valPro + "']").addClass("active");
}, },
initEvent: function ( km, $w ) { initEvent: function (km, $w) {
$w.on( "click", "li", function () { $w.on("click", "li", function () {
var $this = $( this ); var $this = $(this);
$this.siblings().removeClass( "active" ); $this.siblings().removeClass("active");
$this.toggleClass( "active" );
var val = $this.val(); var val = $this.val();
if ( !$this.hasClass( "active" ) ) { var type = $this.attr("type");
val = null; km.execCommand(type, val);
} });
var type = $this.attr( "type" ); km.on('interactchange', function (e) {
km.execCommand( type, val ); var valPri = this.queryCommandValue("priority");
} ); var valPro = this.queryCommandValue("progress");
km.on( 'interactchange', function ( e ) { $w.find("li[type='priority']").removeClass("active");
var valPri = this.queryCommandValue( "priority" ); $w.find("li[type='priority'][value='" + valPri + "']").addClass("active");
var valPro = this.queryCommandValue( "progress" ); $w.find("li[type='progress']").removeClass("active");
$w.find( "li[type='priority']" ).removeClass( "active" ); $w.find("li[type='progress'][value='" + valPro + "']").addClass("active");
$w.find( "li[type='priority'][value='" + valPri + "']" ).addClass( "active" ); });
$w.find( "li[type='progress']" ).removeClass( "active" );
$w.find( "li[type='progress'][value='" + valPro + "']" ).addClass( "active" );
} );
}, },
width: 200 width: 200
} ) })
} )( KM.Utils ); })(KM.Utils);
\ No newline at end of file \ No newline at end of file
(function (utils) {
KM.registerWidget('resource', {
tpl:
'<div class="resource-container">' +
'<div class="add-resource">' +
'<input type="text" /><button class="button">添加</button>' +
'<ul class="global-resource"></ul>' +
'</div>' +
'</div>' +
'<div class="no-selected">未选中节点</div>',
initContent: function (km, $w) {
var lang = km.getLang('dialogs.resource'),
html = $.parseTmpl(this.tpl, lang);
this.root().html(html);
},
initEvent: function (km, $w) {
var $container = $w.find('.resource-container');
var $noSelected = $w.find('.no-selected');
var $current = $w.find('.current-resource').hide();
var $addInput = $w.find('.add-resource input');
var $addButton = $w.find('.add-resource button');
var $global = $w.find('.global-resource');
function switchDisplay() {
if (!km.getSelectedNodes().length) {
$container.hide();
$noSelected.show();
} else {
$container.show();
$noSelected.hide();
}
}
function addResource() {
var resource = $addInput.val();
var origin = km.queryCommandValue('resource');
if (resource) {
origin.push(resource);
km.execCommand('resource', origin);
}
$addInput.val(null);
}
$addInput.on('keydown', function (e) {
if (e.keyCode == 13) addResource();
});
$addButton.click(addResource);
switchDisplay();
$global.delegate('input[type=checkbox]', 'change', function () {
km.execCommand('resource', $global.find('input[type=checkbox]:checked').map(function (index, chk) {
return $(chk).data('resource');
}).toArray());
});
km.on('interactchange', function (e) {
var resource = this.queryCommandValue("resource");
var used = this.getUsedResource();
switchDisplay();
$global.empty().append(used.map(function (name) {
var $li = $('<li></li>'),
$label = $('<label></label>').appendTo($li),
$chk = $('<input type="checkbox" />')
.data('resource', name)
.prop('checked', ~resource.indexOf(name))
.appendTo($label);
$label.append(name);
var color = km.getResourceColor(name);
return $li.css({
color: color.dec('l', 60).toString(),
backgroundColor: ~resource.indexOf(name) ? color : color.dec('a', 0.85).toRGBA()
});
}));
}).fire('interactchange');
},
width: 250
});
})(KM.Utils);
\ No newline at end of file
...@@ -7,26 +7,26 @@ ...@@ -7,26 +7,26 @@
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。"> <meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<script src="lib/jquery-2.1.0.min.js?_=1400151442820" charset="utf-8"></script> <script src="lib/jquery-2.1.0.min.js?_=1401256332199" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1400151442820" charset="utf-8"></script> <script src="lib/ZeroClipboard.min.js?_=1401256332199" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } ); ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } );
</script> </script>
<script src="lib/kitygraph.all.min.js?_=1400151442820" charset="utf-8"></script> <script src="lib/kitygraph.all.min.js?_=1401256332199" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1400151442820" charset="utf-8"></script> <script src="kityminder.all.min.js?_=1401256332199" charset="utf-8"></script>
<script src="kityminder.config.js?_=1400151442820" charset="utf-8"></script> <script src="kityminder.config.js?_=1401256332199" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1400151442820" charset="utf-8"></script> <script src="lang/zh-cn/zh-cn.js?_=1401256332199" charset="utf-8"></script>
<script src="lib/zip.js?_=1400151442820" charset="utf-8"></script> <script src="lib/zip.js?_=1401256332199" charset="utf-8"></script>
<script> <script>
zip.inflateJSPath = 'lib/inflate.js'; zip.inflateJSPath = 'lib/inflate.js';
</script> </script>
<script src="lib/jquery.xml2json.js?_=1400151442820" charset="utf-8"></script> <script src="lib/jquery.xml2json.js?_=1401256332199" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1400151442820" charset="utf-8"></script> <script src="lib/baidu-frontia-js-full-1.0.0.js?_=1401256332199" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1400151442820" charset="utf-8"></script> <script src="social/draftmanager.js?_=1401256332199" charset="utf-8"></script>
<script src="social/social.js?_=1400151442820" charset="utf-8"></script> <script src="social/social.js?_=1401256332199" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet"> <link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" /> <link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
( function () { (function () {
function getKMBasePath( docUrl, confUrl ) { function getKMBasePath(docUrl, confUrl) {
return getBasePath( docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath() ); return getBasePath(docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath());
} }
function getConfigFilePath() { function getConfigFilePath() {
var configPath = document.getElementsByTagName( 'script' ); var configPath = document.getElementsByTagName('script');
return configPath[ configPath.length - 1 ].src; return configPath[configPath.length - 1].src;
} }
function getBasePath( docUrl, confUrl ) { function getBasePath(docUrl, confUrl) {
var basePath = confUrl; var basePath = confUrl;
if ( /^(\/|\\\\)/.test( confUrl ) ) { if (/^(\/|\\\\)/.test(confUrl)) {
basePath = /^.+?\w(\/|\\\\)/.exec( docUrl )[ 0 ] + confUrl.replace( /^(\/|\\\\)/, '' ); basePath = /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/, '');
} else if ( !/^[a-z]+:/i.test( confUrl ) ) { } else if (!/^[a-z]+:/i.test(confUrl)) {
docUrl = docUrl.split( "#" )[ 0 ].split( "?" )[ 0 ].replace( /[^\\\/]+$/, '' ); docUrl = docUrl.split("#")[0].split("?")[0].replace(/[^\\\/]+$/, '');
basePath = docUrl + "" + confUrl; basePath = docUrl + "" + confUrl;
} }
return optimizationPath( basePath ); return optimizationPath(basePath);
} }
function optimizationPath( path ) { function optimizationPath(path) {
var protocol = /^[a-z]+:\/\//.exec( path )[ 0 ], var protocol = /^[a-z]+:\/\//.exec(path)[0],
tmp = null, tmp = null,
res = []; res = [];
path = path.replace( protocol, "" ).split( "?" )[ 0 ].split( "#" )[ 0 ]; path = path.replace(protocol, "").split("?")[0].split("#")[0];
path = path.replace( /\\/g, '/' ).split( /\// ); path = path.replace(/\\/g, '/').split(/\//);
path[ path.length - 1 ] = ""; path[path.length - 1] = "";
while ( path.length ) { while (path.length) {
if ( ( tmp = path.shift() ) === ".." ) { if ((tmp = path.shift()) === "..") {
res.pop(); res.pop();
} else if ( tmp !== "." ) { } else if (tmp !== ".") {
res.push( tmp ); res.push(tmp);
} }
} }
return protocol + res.join( "/" ); return protocol + res.join("/");
} }
window.KITYMINDER_CONFIG = { window.KITYMINDER_CONFIG = {
'KITYMINDER_HOME_URL': getKMBasePath(), 'KITYMINDER_HOME_URL': getKMBasePath(),
//定义工具栏 //定义工具栏
toolbars: [ toolbars: [
'hand | zoom-in zoom zoom-out | collapsenode expandnode | undo redo | bold italic | fontfamily fontsize forecolor | saveto | hyperlink unhyperlink | markers | node | help' 'hand | zoom-in zoom zoom-out | collapsenode expandnode | undo redo | bold italic | fontfamily fontsize forecolor | saveto | switchlayout | hyperlink unhyperlink image removeimage | markers resource | node | help'
] ]
//只读模式,默认是false //只读模式,默认是false
//readOnly: true //readOnly: true
...@@ -89,5 +89,10 @@ ...@@ -89,5 +89,10 @@
// } // }
//配置放大缩小的比例 //配置放大缩小的比例
//,zoom:[50,80,100,120,150,200] //,zoom:[50,80,100,120,150,200]
//
//图片尺寸限制
//,maxImageWidth: 200
//,maxImageHeight: 200
//
}; };
} )(); })();
\ No newline at end of file \ No newline at end of file
KityMinder.LANG[ 'zh-cn' ] = { KityMinder.LANG['zh-cn'] = {
'maintopic': '中心主题', 'maintopic': '中心主题',
'topic': '分支主题', 'topic': '分支主题',
'tooltips': { 'tooltips': {
...@@ -15,9 +15,11 @@ KityMinder.LANG[ 'zh-cn' ] = { ...@@ -15,9 +15,11 @@ KityMinder.LANG[ 'zh-cn' ] = {
'hand': '允许拖拽', 'hand': '允许拖拽',
'zoom': '放大缩小', 'zoom': '放大缩小',
'markers': '添加标签', 'markers': '添加标签',
'resource': '分配资源',
'switchlayout': '切换主题', 'switchlayout': '切换主题',
'help': '帮助', 'help': '帮助',
'preference': '偏好设置', 'preference': '偏好设置',
'image': '插入图片',
'hyperlink': '插入链接', 'hyperlink': '插入链接',
'unhyperlink': "删除链接", 'unhyperlink': "删除链接",
'expandnode': "展开节点", 'expandnode': "展开节点",
...@@ -37,18 +39,26 @@ KityMinder.LANG[ 'zh-cn' ] = { ...@@ -37,18 +39,26 @@ KityMinder.LANG[ 'zh-cn' ] = {
'lang_input_target': '是否在新窗口打开:' 'lang_input_target': '是否在新窗口打开:'
}, },
'priority': '优先级', 'priority': '优先级',
'none': '无',
'progress': { 'progress': {
'title': '进度',
'notdone': "未完成", 'notdone': "未完成",
'quarterdone': '完成1/4', 'done1': '完成1/8',
'halfdone': '完成1/2', 'done2': '完成1/4',
'threequartersdone': '完成3/4', 'done3': '完成3/8',
'done4': '完成1/2',
'done5': '完成5/8',
'done6': '完成3/4',
'done7': '完成7/8',
'done': '已完成' 'done': '已完成'
} }
}, },
'help': { 'help': {
}, },
hyperlink: {} 'hyperlink': {},
'image': {},
'resource': {}
}, },
'node': { 'node': {
'appendsiblingnode': '插入同级节点', 'appendsiblingnode': '插入同级节点',
...@@ -60,9 +70,13 @@ KityMinder.LANG[ 'zh-cn' ] = { ...@@ -60,9 +70,13 @@ KityMinder.LANG[ 'zh-cn' ] = {
'default': '左右展开', 'default': '左右展开',
'bottom': '向下展开' 'bottom': '向下展开'
}, },
'hyperlink':{ 'hyperlink': {
'hyperlink':'插入超链接', 'hyperlink': '插入超链接',
'unhyperlink':"取消超链接" 'unhyperlink': "取消超链接"
},
'image': {
'image': '插入图片',
'removeimage': '删除图片'
} }
}; };
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -862,7 +862,10 @@ $( function () { ...@@ -862,7 +862,10 @@ $( function () {
function loadDraft( index ) { function loadDraft( index ) {
var draft = draftManager.open( index ), var draft = draftManager.open( index ),
isRemote; isRemote;
if ( !draft ) return; if ( !draft ) {
minder.initStyle();
return;
}
isRemote = draft.path.indexOf( '/apps/kityminder' ) === 0; isRemote = draft.path.indexOf( '/apps/kityminder' ) === 0;
if ( isRemote ) { if ( isRemote ) {
......
...@@ -14,6 +14,12 @@ ...@@ -14,6 +14,12 @@
.kmui-btn-toolbar .kmui-btn .kmui-icon-font, .kmui-btn-toolbar .kmui-btn .kmui-icon-forecolor { .kmui-btn-toolbar .kmui-btn .kmui-icon-font, .kmui-btn-toolbar .kmui-btn .kmui-icon-forecolor {
background-position: -720px 1px; background-position: -720px 1px;
} }
.kmui-btn-toolbar .kmui-btn .kmui-icon-image {
background: url(../images/picture_add.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-removeimage {
background: url(../images/picture_delete.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-hand { .kmui-btn-toolbar .kmui-btn .kmui-icon-hand {
background: url(../images/hand.png) no-repeat 2px 2px; background: url(../images/hand.png) no-repeat 2px 2px;
} }
...@@ -41,10 +47,12 @@ ...@@ -41,10 +47,12 @@
.kmui-btn-toolbar .kmui-btn .kmui-icon-collapsenode { .kmui-btn-toolbar .kmui-btn .kmui-icon-collapsenode {
background: url(../images/contract.png) no-repeat 2px 2px; background: url(../images/contract.png) no-repeat 2px 2px;
} }
.kmui-btn-toolbar .kmui-btn .kmui-icon-hyperlink { .kmui-btn-toolbar .kmui-btn .kmui-icon-hyperlink {
background: url(../images/link.png) no-repeat 2px 2px; background: url(../images/link.png) no-repeat 2px 2px;
} }
.kmui-btn-toolbar .kmui-btn .kmui-icon-unhyperlink { .kmui-btn-toolbar .kmui-btn .kmui-icon-unhyperlink {
background: url(../images/unlink.png) no-repeat 2px 2px; background: url(../images/unlink.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-resource {
background: url(../images/resource.png) no-repeat 2px 2px;
} }
\ No newline at end of file
...@@ -7,6 +7,25 @@ ...@@ -7,6 +7,25 @@
border-radius: 5px; border-radius: 5px;
box-shadow: 3px 3px 8px rgba(0,0,0, .5); box-shadow: 3px 3px 8px rgba(0,0,0, .5);
} }
.kmui-modal input[type=text] {
width: 75%;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
vertical-align: middle;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba( 0, 0, 0, .075 );
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.kmui-modal input[type=text]:focus {
border-color: #66afe9;
outline: 0;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
}
.kmui-modal-header { .kmui-modal-header {
padding: 5px 10px; padding: 5px 10px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
......
...@@ -13,4 +13,5 @@ ...@@ -13,4 +13,5 @@
@import "separator.css"; @import "separator.css";
@import "markers.css"; @import "markers.css";
@import "help.css"; @import "help.css";
@import "dropmenu.css"; @import "dropmenu.css";
\ No newline at end of file @import "resource.dialog.css"
\ No newline at end of file
.kmui-dialog-resource{width:300px}.kmui-dialog-resource .add-resource{padding:10px}.kmui-dialog-resource .add-resource input[type=text]{width:142px}
.kmui-dialog-resource .add-resource button{margin-right:0}
.kmui-dialog-resource .add-resource .global-resource{list-style:none;margin:0;padding:5px 0 0}.kmui-dialog-resource .add-resource .global-resource li{margin:0 10px 5px 0;display:inline-block;border-radius:5px}.kmui-dialog-resource .add-resource .global-resource li label{padding:4px 8px 4px 6px;display:block}
.kmui-dialog-resource .no-selected{padding:10px}
.kmui-dialog-resource {
width: 300px;
.add-resource {
padding: 10px;
input[type=text] {
width: 142px;
}
button {
margin-right: 0;
}
.global-resource {
list-style: none;
margin: 0;
padding: 5px 0 0;
li {
margin: 0 10px 5px 0;
display: inline-block;
label {
padding: 4px 8px 4px 6px;
display: block;
}
border-radius: 5px;
}
}
}
.no-selected {
padding: 10px;
}
}
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } ); ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } );
</script> </script>
<script src="kity/dist/kitygraph.all.js" charset="utf-8"></script> <script src="kity/dist/kity.js" charset="utf-8"></script>
<script src="import.js" charset="utf-8"></script> <script src="import.js" charset="utf-8"></script>
<script src="kityminder.config.js" charset="utf-8"></script> <script src="kityminder.config.js" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js" charset="utf-8"></script> <script src="lang/zh-cn/zh-cn.js" charset="utf-8"></script>
......
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