Merge branch 'v2.0' of https://github.com/ckcz123/mota-js into v2.0

This commit is contained in:
ckcz123 2018-03-10 17:53:32 +08:00
commit e5098cd7d1
4 changed files with 23 additions and 8 deletions

View File

@ -210,12 +210,14 @@ body{
color: #D50000; color: #D50000;
font-weight: 700; font-weight: 700;
font-size: 14px; font-size: 14px;
line-height: 1.2em;
} }
.infoText{ .infoText{
color: #2196F3; color: #2196F3;
} }
.successText{ .successText{
color: #00897B color: #00897B;
line-height: 1.2em;
} }
table, td { table, td {

View File

@ -203,11 +203,7 @@ editor_mode.prototype.showMode = function (mode) {
editor_mode.dom[mode].style=''; editor_mode.dom[mode].style='';
if(editor_mode[mode])editor_mode[mode](); if(editor_mode[mode])editor_mode[mode]();
document.getElementById('editModeSelect').value=mode; document.getElementById('editModeSelect').value=mode;
var tips = [ var tips = tip_in_showMode;
'涉及图片的更改需要F5刷新浏览器来生效',
'文本域可以通过双击,在文本编辑器或事件编辑器中编辑',
'事件编辑器中的显示文本和自定义脚本的方块也可以双击',
];
if(!selectBox.isSelected)printf('tips: '+tips[~~(tips.length*Math.random())]); if(!selectBox.isSelected)printf('tips: '+tips[~~(tips.length*Math.random())]);
} }

View File

@ -29,7 +29,13 @@ editor_multi.import = function(id_){
editor_multi.isString=true; editor_multi.isString=true;
codeEditor.setValue(JSON.parse(input.value)||''); codeEditor.setValue(JSON.parse(input.value)||'');
} else { } else {
codeEditor.setValue(input.value||''); eval('var tobj='+input.value);
var tmap={};
var tstr = JSON.stringify(tobj,function(k,v){if(typeof(v)===typeof('') && v.slice(0,8)==='function'){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},4);
for(var id_ in tmap){
tstr = tstr.replace('"'+id_+'"',tmap[id_])
}
codeEditor.setValue(tstr||'');
} }
editor_multi.show(); editor_multi.show();
return true; return true;
@ -58,7 +64,13 @@ editor_multi.confirm = function (){
if(editor_multi.isString){ if(editor_multi.isString){
input.value = JSON.stringify(value); input.value = JSON.stringify(value);
} else { } else {
input.value = value; eval('var tobj='+value);
var tmap={};
var tstr = JSON.stringify(tobj,function(k,v){if(v instanceof Function){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},4);
for(var id_ in tmap){
tstr = tstr.replace('"'+id_+'"',JSON.stringify(tmap[id_]))
}
input.value = tstr;
} }
editor_multi.hide(); editor_multi.hide();
input.onchange(); input.onchange();

View File

@ -215,6 +215,11 @@ printf = function(str_,type) {
},1); },1);
} }
printe = function(str_){printf(str_,'error')} printe = function(str_){printf(str_,'error')}
tip_in_showMode = [
'涉及图片的更改需要F5刷新浏览器来生效',
'文本域可以通过双击,在文本编辑器或事件编辑器中编辑',
'事件编辑器中的显示文本和自定义脚本的方块也可以双击',
];
var tip = new Vue({ var tip = new Vue({
el: '#tip', el: '#tip',
data: { data: {