From 0b8eb535571ef94072a917bd4f5afe9caae13f6c Mon Sep 17 00:00:00 2001 From: nuintun Date: Mon, 23 Nov 2015 21:47:32 +0800 Subject: [PATCH] update files --- static/css/index.css | 16 +++++++++++++--- static/js/app/index.js | 3 ++- static/js/util/index.js | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 static/js/util/index.js diff --git a/static/css/index.css b/static/css/index.css index c4e4dce..01111fc 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -294,7 +294,8 @@ header [class*=" icon-"] { height: calc(100% - 31px); overflow: auto; } -.ui-project-tree li:nth-child(odd) { +.ui-project-tree li:nth-child(odd), +.ui-command-popup li:nth-child(odd) { background-color: #eee; } .ui-project-tree li { @@ -355,6 +356,8 @@ header [class*=" icon-"] { float: left; font-size: 14px; color: #333; + height: 39px; + line-height: 39px; } .ui-command a { padding: 0 10px; @@ -372,17 +375,24 @@ header [class*=" icon-"] { position: absolute; top: 39px; right: 0; - line-height: 30px; - background-color: #eee; + background-color: #fff; + border: 1px dashed #ccc; + border-top: none; + border-right: none; + background-clip: content-box; } .ui-command-popup li { float: none; + min-width: 67px; } .ui-project-tree a, .ui-command li a, .ui-command-popup li a { color: inherit; } +.ui-command-popup li a { + width: 100%; +} .ui-project-tree a:hover, .ui-project-tree .active, .ui-command a:hover { diff --git a/static/js/app/index.js b/static/js/app/index.js index 1c087cc..f4fa8f9 100644 --- a/static/js/app/index.js +++ b/static/js/app/index.js @@ -5,6 +5,7 @@ 'use strict'; var ipc = require('ipc-renderer'); +var util = require('../util'); var Vue = require('../vue/vue'); require('../components/app-configure'); @@ -38,7 +39,7 @@ window.addEventListener('DOMContentLoaded', function (){ this.activeIndex = index; }, 'save-configure': function (){ - ipc.send('app-configure', 'save', JSON.parse(JSON.stringify(this.configure))); + ipc.send('app-configure', 'save', util.normalize(this.configure)); } } }); diff --git a/static/js/util/index.js b/static/js/util/index.js new file mode 100644 index 0000000..82e2625 --- /dev/null +++ b/static/js/util/index.js @@ -0,0 +1,37 @@ +/** + * Created by nuintun on 2015/11/23. + */ + +'use strict'; + +module.exports = { + normalize: function (vue){ + return JSON.parse(JSON.stringify(vue)); + }, + clone: function (object){ + var result; + + switch (typeof object) { + case 'object': + if (object === null) { + result = null; + } else { + if (Array.isArray(object)) { + result = object.slice(0); + } else { + result = {}; + + Object.keys(object).forEach(function (key){ + result[key] = module.exports.clone(object[key]); + }); + } + } + break; + default: + result = object; + break; + } + + return result; + } +};