Compare v6.8.7 vs v.6.8.12

Created Diff never expires
0 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
516 lines
0 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
516 lines
$(function(){
$(function(){
$.fn.extend({
$.fn.extend({
fixedThead:function(options){
fixedThead:function(options){
var _that = $(this);
var _that = $(this);
console.log(_that);
console.log(_that);
var option = {
var option = {
height:400,
height:400,
shadow:true,
shadow:true,
resize:true
resize:true
};
};
options = $.extend(option,options);
options = $.extend(option,options);
if($(this).find('table').length === 0){
if($(this).find('table').length === 0){
return false;
return false;
}
}
var _height = $(this)[0].style.height,_table_config = _height.match(/([0-9]+)([%\w]+)/);
var _height = $(this)[0].style.height,_table_config = _height.match(/([0-9]+)([%\w]+)/);
if(_table_config === null){
if(_table_config === null){
_table_config = [null,options.height,'px'];
_table_config = [null,options.height,'px'];
}else{
}else{
$(this).css({
$(this).css({
'boxSizing': 'content-box',
'boxSizing': 'content-box',
'paddingBottom':$(this).find('thead').height()
'paddingBottom':$(this).find('thead').height()
});
});
}
}
$(this).css({'position':'relative'});
$(this).css({'position':'relative'});
var _thead = $(this).find('thead')[0].outerHTML,
var _thead = $(this).find('thead')[0].outerHTML,
_tbody = $(this).find('tbody')[0].outerHTML,
_tbody = $(this).find('tbody')[0].outerHTML,
_thead_div = $('<div class="thead_div"><table class="table table-hover mb0"></table></div>'),
_thead_div = $('<div class="thead_div"><table class="table table-hover mb0"></table></div>'),
_shadow_top = $('<div class="tbody_shadow_top"></div>'),
_shadow_top = $('<div class="tbody_shadow_top"></div>'),
_tbody_div = $('<div class="tbody_div" style="height:'+ _table_config[1] + _table_config[2] +';"><table class="table table-hover mb0" style="margin-top:-'+ $(this).find('thead').height() +'px"></table></div>'),
_tbody_div = $('<div class="tbody_div" style="height:'+ _table_config[1] + _table_config[2] +';"><table class="table table-hover mb0" style="margin-top:-'+ $(this).find('thead').height() +'px"></table></div>'),
_shadow_bottom = $('<div class="tbody_shadow_bottom"></div>');
_shadow_bottom = $('<div class="tbody_shadow_bottom"></div>');
_thead_div.find('table').append(_thead);
_thead_div.find('table').append(_thead);
_tbody_div.find('table').append(_thead);
_tbody_div.find('table').append(_thead);
_tbody_div.find('table').append(_tbody);
_tbody_div.find('table').append(_tbody);
$(this).html('');
$(this).html('');
$(this).append(_thead_div);
$(this).append(_thead_div);
$(this).append(_shadow_top);
$(this).append(_shadow_top);
$(this).append(_tbody_div);
$(this).append(_tbody_div);
$(this).append(_shadow_bottom);
$(this).append(_shadow_bottom);
var _table_width = _that.find('.thead_div table')[0].offsetWidth,
var _table_width = _that.find('.thead_div table')[0].offsetWidth,
_body_width = _that.find('.tbody_div table')[0].offsetWidth,
_body_width = _that.find('.tbody_div table')[0].offsetWidth,
_length = _that.find('tbody tr:eq(0)>td').length;
_length = _that.find('tbody tr:eq(0)>td').length;
$(this).find('tbody tr:eq(0)>td').each(function(index,item){
$(this).find('tbody tr:eq(0)>td').each(function(index,item){
var _item = _that.find('thead tr:eq(0)>th').eq(index);
var _item = _that.find('thead tr:eq(0)>th').eq(index);
if(index === (_length-1)){
if(index === (_length-1)){
_item.attr('width',$(item)[0].clientWidth + (_table_width - _body_width));
_item.attr('width',$(item)[0].clientWidth + (_table_width - _body_width));
}else{
}else{
_item.attr('width',$(item)[0].offsetWidth);
_item.attr('width',$(item)[0].offsetWidth);
}
}
});
});
if(options.resize){
if(options.resize){
$(window).resize(function(){
$(window).resize(function(){
var _table_width = _that.find('.thead_div table')[0].offsetWidth,
var _table_width = _that.find('.thead_div table')[0].offsetWidth,
_body_width = _that.find('.tbody_div table')[0].offsetWidth,
_body_width = _that.find('.tbody_div table')[0].offsetWidth,
_length = _that.find('tbody tr:eq(0)>td').length;
_length = _that.find('tbody tr:eq(0)>td').length;
_that.find('tbody tr:eq(0)>td').each(function(index,item){
_that.find('tbody tr:eq(0)>td').each(function(index,item){
var _item = _that.find('thead tr:eq(0)>th').eq(index);
var _item = _that.find('thead tr:eq(0)>th').eq(index);
if(index === (_length-1)){
if(index === (_length-1)){
_item.attr('width',$(item)[0].clientWidth + (_table_width - _body_width));
_item.attr('width',$(item)[0].clientWidth + (_table_width - _body_width));
}else{
}else{
_item.attr('width',$(item)[0].offsetWidth);
_item.attr('width',$(item)[0].offsetWidth);
}
}
});
});
});
});
}
}
if(options.shadow){
if(options.shadow){
var table_body = $(this).find('.tbody_div')[0];
var table_body = $(this).find('.tbody_div')[0];
if(_table_config[1] >= table_body.scrollHeight){
if(_table_config[1] >= table_body.scrollHeight){
$(this).find('.tbody_shadow_top').hide();
$(this).find('.tbody_shadow_top').hide();
$(this).find('.tbody_shadow_bottom').hide();
$(this).find('.tbody_shadow_bottom').hide();
}else{
}else{
$(this).find('.tbody_shadow_top').hide();
$(this).find('.tbody_shadow_top').hide();
$(this).find('.tbody_shadow_bottom').show();
$(this).find('.tbody_shadow_bottom').show();
}
}
$(this).find('.tbody_div').scroll(function(e){
$(this).find('.tbody_div').scroll(function(e){
var _scrollTop = $(this)[0].scrollTop,
var _scrollTop = $(this)[0].scrollTop,
_scrollHeight = $(this)[0].scrollHeight,
_scrollHeight = $(this)[0].scrollHeight,
_clientHeight = $(this)[0].clientHeight,
_clientHeight = $(this)[0].clientHeight,
_shadow_top = _that.find('.tbody_shadow_top'),
_shadow_top = _that.find('.tbody_shadow_top'),
_shadow_bottom = _that.find('.tbody_shadow_bottom');
_shadow_bottom = _that.find('.tbody_shadow_bottom');
if(_scrollTop == 0){
if(_scrollTop == 0){
_shadow_top.hide();
_shadow_top.hide();
_shadow_bottom.show();
_shadow_bottom.show();
}else if(_scrollTop > 0 && _scrollTop < (_scrollHeight - _clientHeight)){
}else if(_scrollTop > 0 && _scrollTop < (_scrollHeight - _clientHeight)){
_shadow_top.show();
_shadow_top.show();
_shadow_bottom.show();
_shadow_bottom.show();
}else if(_scrollTop == (_scrollHeight - _clientHeight)){
}else if(_scrollTop == (_scrollHeight - _clientHeight)){
_shadow_top.show();
_shadow_top.show();
_shadow_bottom.hide();
_shadow_bottom.hide();
}
}
})
})
}
}
}
}
});
});
}(jQuery))
}(jQuery))


$(document).ready(function() {
$(document).ready(function() {
$(".sub-menu a.sub-menu-a").click(function() {
$(".sub-menu a.sub-menu-a").click(function() {
$(this).next(".sub").slideToggle("slow").siblings(".sub:visible").slideUp("slow");
$(this).next(".sub").slideToggle("slow").siblings(".sub:visible").slideUp("slow");
});
});
});
});
var aceEditor = {
var aceEditor = {
layer_view: '',
layer_view: '',
aceConfig:{}, //ace配置参数
aceConfig:{}, //ace配置参数
editor: null,
editor: null,
supportedModes: {
supportedModes: {
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
BatchFile: ["bat|cmd"],
BatchFile: ["bat|cmd"],
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
CSharp: ["cs"],
CSharp: ["cs"],
CSS: ["css"],
CSS: ["css"],
Dockerfile: ["^Dockerfile"],
Dockerfile: ["^Dockerfile"],
golang: ["go"],
golang: ["go"],
HTML: ["html|htm|xhtml|vue|we|wpy"],
HTML: ["html|htm|xhtml|vue|we|wpy"],
Java: ["java"],
Java: ["java"],
JavaScript: ["js|jsm|jsx"],
JavaScript: ["js|jsm|jsx"],
'JSON': ["json"],
'JSON': ["json"],
JSP: ["jsp"],
JSP: ["jsp"],
LESS: ["less"],
LESS: ["less"],
Lua: ["lua"],
Lua: ["lua"],
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
Markdown: ["md|markdown"],
Markdown: ["md|markdown"],
MySQL: ["mysql"],
MySQL: ["mysql"],
Nginx: ["nginx|conf"],
Nginx: ["nginx|conf"],
INI: ["ini|conf|cfg|prefs"],
INI: ["ini|conf|cfg|prefs"],
ObjectiveC: ["m|mm"],
ObjectiveC: ["m|mm"],
Perl: ["pl|pm"],
Perl: ["pl|pm"],
Perl6: ["p6|pl6|pm6"],
Perl6: ["p6|pl6|pm6"],
pgSQL: ["pgsql"],
pgSQL: ["pgsql"],
PHP_Laravel_blade: ["blade.php"],
PHP_Laravel_blade: ["blade.php"],
PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
Powershell: ["ps1"],
Powershell: ["ps1"],
Python: ["py"],
Python: ["py"],
R: ["r"],
R: ["r"],
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
Rust: ["rs"],
Rust: ["rs"],
SASS: ["sass"],
SASS: ["sass"],
SCSS: ["scss"],
SCSS: ["scss"],
SH: ["sh|bash|^.bashrc"],
SH: ["sh|bash|^.bashrc"],
SQL: ["sql"],
SQL: ["sql"],
SQLServer: ["sqlserver"],
SQLServer: ["sqlserver"],
Swift: ["swift"],
Swift: ["swift"],
Text: ["txt"],
Text: ["txt"],
Typescript: ["ts|typescript|str"],
Typescript: ["ts|typescript|str"],
VBScript: ["vbs|vb"],
VBScript: ["vbs|vb"],
Verilog: ["v|vh|sv|svh"],
Verilog: ["v|vh|sv|svh"],
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
YAML: ["yaml|yml"],
YAML: ["yaml|yml"],
Compress: ['tar|zip|7z|rar|gz|arj|z'],
Compress: ['tar|zip|7z|rar|gz|arj|z'],
images: ['icon|jpg|jpeg|png|bmp|gif|tif|emf']
images: ['icon|jpg|jpeg|png|bmp|gif|tif|emf']
},
},
nameOverrides: {
nameOverrides: {
ObjectiveC: "Objective-C",
ObjectiveC: "Objective-C",
CSharp: "C#",
CSharp: "C#",
golang: "Go",
golang: "Go",
C_Cpp: "C and C++",
C_Cpp: "C and C++",
PHP_Laravel_blade: "PHP (Blade Template)",
PHP_Laravel_blade: "PHP (Blade Template)",
Perl6: "Perl 6",
Perl6: "Perl 6",
},
},
pathAarry: [],
pathAarry: [],
encodingList: ['ASCII', 'UTF-8', 'GBK', 'GB2312', 'BIG5'],
encodingList: ['ASCII', 'UTF-8', 'GBK', 'GB2312', 'BIG5'],
themeList: [
themeList: [
'chrome',
'chrome',
'monokai'
'monokai'
],
],
fontSize: '13px',
fontSize: '13px',
editorTheme: 'monokai', // 编辑器主题
editorTheme: 'monokai', // 编辑器主题
editorLength: 0,
editorLength: 0,
isAceView: true,
isAceView: true,
ace_active: '',
ace_active: '',
is_resizing: false,
is_resizing: false,
menu_path:'', //当前文件目录根地址
menu_path:'', //当前文件目录根地址
refresh_config:{
refresh_config:{
el:{}, // 需要重新获取的元素,为DOM对象
el:{}, // 需要重新获取的元素,为DOM对象
path:'',// 需要获取的路径文件信息
path:'',// 需要获取的路径文件信息
group:1,// 当前列表层级,用来css固定结构
group:1,// 当前列表层级,用来css固定结构
is_empty:true
is_empty:true
}, //刷新配置参数
}, //刷新配置参数
// 事件编辑器-方法,事件绑定
// 事件编辑器-方法,事件绑定
eventEditor: function() {
eventEditor: function() {
var _this = this,_icon = '<span class="icon"><i class="glyphicon glyphicon-ok" aria-hidden="true"></i></span>';
var _this = this,_icon = '<span class="icon"><i class="glyphicon glyphicon-ok" aria-hidden="true"></i></span>';
$(window).resize(function(){
$(window).resize(function(){
if(_this.ace_active != undefined) _this.setEditorView()
if(_this.ace_active != undefined) _this.setEditorView()
if( $('.aceEditors .layui-layer-maxmin').length >0){
if( $('.aceEditors .layui-layer-maxmin').length >0){
$('.aceEditors').css({
$('.aceEditors').css({
'top':0,
'top':0,
'left':0,
'left':0,
'width':$(this)[0].innerWidth,
'width':$(this)[0].innerWidth,
'height':$(this)[0].innerHeight
'height':$(this)[0].innerHeight
});
});
}
}
})
})
$(document).click(function(e){
$(document).click(function(e){
$('.ace_toolbar_menu').hide();
$('.ace_toolbar_menu').hide();
$('.ace_conter_editor .ace_editors').css('fontSize', _this.aceConfig.aceEditor.fontSize + 'px');
$('.ace_conter_editor .ace_editors').css('fontSize', _this.aceConfig.aceEditor.fontSize + 'px');
$('.ace_toolbar_menu .menu-tabs,.ace_toolbar_menu .menu-encoding,.ace_toolbar_menu .menu-files').hide();
$('.ace_toolbar_menu .menu-tabs,.ace_toolbar_menu .menu-encoding,.ace_toolbar_menu .menu-files').hide();
});
});
$('.ace_editor_main').on('click',function(){
$('.ace_editor_main').on('click',function(){
$('.ace_toolbar_menu').hide();
$('.ace_toolbar_menu').hide();
});
});
$('.ace_toolbar_menu').click(function(e){
$('.ace_toolbar_menu').click(function(e){
e.stopPropagation();
e.stopPropagation();
e.preventDefault();
e.preventDefault();
});
});
// 显示工具条
// 显示工具条
$('.ace_header .pull-down').click(function(){
$('.ace_header .pull-down').click(function(){
if($(this).find('i').hasClass('glyphicon-menu-down')){
if($(this).find('i').hasClass('glyphicon-menu-down')){
$('.ace_header').css({'top':'-35px'});
$('.ace_header').css({'top':'-35px'});
$('.ace_overall').css({'top':'0'});
$('.ace_overall').css({'top':'0'});
$(this).css({'top':'35px','height':'40px','line-height':'40px'});
$(this).css({'top':'35px','height':'40px','line-height':'40px'});
$(this).find('i').addClass('glyphicon-menu-up').removeClass('glyphicon-menu-down');
$(this).find('i').addClass('glyphicon-menu-up').removeClass('glyphicon-menu-down');
}else{
}else{
$('.ace_header').css({'top':'0'});
$('.ace_header').css({'top':'0'});
$('.ace_overall').css({'top':'35px'});
$('.ace_overall').css({'top':'35px'});
$(this).removeAttr('style');
$(this).removeAttr('style');
$(this).find('i').addClass('glyphicon-menu-down').removeClass('glyphicon-menu-up');
$(this).find('i').addClass('glyphicon-menu-down').removeClass('glyphicon-menu-up');
}
}
_this.setEditorView();
_this.setEditorView();
});
});
// 切换TAB视图
// 切换TAB视图
$('.ace_conter_menu').on('click', '.item', function (e) {
$('.ace_conter_menu').on('click', '.item', function (e) {
var _id = $(this).attr('data-id'),_item = _this.editor['ace_editor_' + _id];
var _id = $(this).attr('data-id'),_item = _this.editor['ace_editor_' + _id];
$('.item_tab_'+ _id).addClass('active').siblings().removeClass('active');
$('.item_tab_'+ _id).addClass('active').siblings().removeClass('active');
$('#ace_editor_'+ _id).addClass('active').siblings().removeClass('active');
$('#ace_editor_'+ _id).addClass('active').siblings().removeClass('active');
_this.ace_active = _id;
_this.ace_active = _id;
_this.currentStatusBar(_id);
_this.currentStatusBar(_id);
_this.is_file_history(_item);
_this.is_file_history(_item);
});
});
// 移上TAB按钮变化,仅文件被修改后
// 移上TAB按钮变化,仅文件被修改后
$('.ace_conter_menu').on('mouseover', '.item .icon-tool', function () {
$('.ace_conter_menu').on('mouseover', '.item .icon-tool', function () {
var type = $(this).attr('data-file-state');
var type = $(this).attr('data-file-state');
if (type != '0') {
if (type != '0') {
$(this).removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove');
$(this).removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove');
}
}
});
});
// 移出tab按钮变化,仅文件被修改后
// 移出tab按钮变化,仅文件被修改后
$('.ace_conter_menu').on('mouseout', '.item .icon-tool', function () {
$('.ace_conter_menu').on('mouseout', '.item .icon-tool', function () {
var type = $(this).attr('data-file-state');
var type = $(this).attr('data-file-state');
if (type != '0') {
if (type != '0') {
$(this).removeClass('glyphicon-remove').addClass('glyphicon-exclamation-sign');
$(this).removeClass('glyphicon-remove').addClass('glyphicon-exclamation-sign');
}
}
});
});
// 关闭编辑视图
// 关闭编辑视图
$('.ace_conter_menu').on('click', '.item .icon-tool', function(e) {
$('.ace_conter_menu').on('click', '.item .icon-tool', function(e) {
var file_type = $(this).attr('data-file-state');
var file_type = $(this).attr('data-file-state');
var file_title = $(this).attr('data-title');
var file_title = $(this).attr('data-title');
var _path = $(this).parent().parent().attr('title');
var _path = $(this).parent().parent().attr('title');
var _id = $(this).parent().parent().attr('data-id');
var _id = $(this).parent().parent().attr('data-id');
switch (file_type) {
switch (file_type) {
// 直接关闭
// 直接关闭
case '0':
case '0':
_this.removeEditor(_id);
_this.removeEditor(_id);
break;
break;
// 未保存
// 未保存
case '1':
case '1':
var loadT = layer.open({
var loadT = layer.open({
type: 1,
type: 1,
area: ['400px', '180px'],
area: ['400px', '180px'],
title: 'Tips',
title: 'Tips',
content: '<div class="ace-clear-form">\
content: '<div class="ace-clear-form">\
<div class="clear-icon"></div>\
<div class="clear-icon"></div>\
<div class="clear-title">Do you want to save changes to &nbsp<span class="size_ellipsis" style="max-width:150px;vertical-align: top;" title="' + file_title + '">' + file_title + '</span>&nbsp?</div>\
<div class="clear-title">Do you want to save changes to &nbsp<span class="size_ellipsis" style="max-width:150px;vertical-align: top;" title="' + file_title + '">' + file_title + '</span>&nbsp?</div>\
<div class="clear-tips">If you don\'t save, the changes will be lost!</div>\
<div class="clear-tips">If you don\'t save, the changes will be lost!</div>\
<div class="ace-clear-btn" style="">\
<div class="ace-clear-btn" style="">\
<button type="button" class="btn btn-sm btn-default" style="float:left" data-type="2">Dont save</button>\
<button type="button" class="btn btn-sm btn-default" style="float:left" data-type="2">Dont save</button>\
<button type="button" class="btn btn-sm btn-default" style="margin-right:10px;" data-type="1">Cancel</button>\
<button type="button" class="btn btn-sm btn-default" style="margin-right:10px;" data-type="1">Cancel</button>\
<button type="button" class="btn btn-sm btn-success" data-type="0">Save</button>\
<button type="button" class="btn btn-sm btn-success" data-type="0">Save</button>\
</div>\
</div>\
</div>',
</div>',
success: function(layers, index) {
success: function(layers, index) {
$('.ace-clear-btn .btn').click(function() {
$('.ace-clear-btn .btn').click(function() {
var _type = $(this).attr('data-type'),
var _type = $(this).attr('data-type'),
editor_item = _this.editor['ace_editor_' + _id];
editor_item = _this.editor['ace_editor_' + _id];
switch (_type) {
switch (_type) {
case '0': //保存文件
case '0': //保存文件
_this.saveFileBody({
_this.saveFileBody({
path: _path,
path: _path,
data: editor_item.ace.getValue(),
data: editor_item.ace.getValue(),
encoding: editor_item.encoding
encoding: editor_item.encoding
}, function(res) {
}, function(res) {
layer.close(index);
layer.close(index);
_this.removeEditor(editor_item.id);
_this.removeEditor(editor_item.id);
layer.msg(res.msg, { icon: 1 });
layer.msg(res.msg, { icon: 1 });
editor_item.fileType = 0;
editor_item.fileType = 0;
$('.item_tab_' + editor_item.id + ' .icon-tool').attr('data-file-state', '0').removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove');
$('.item_tab_' + editor_item.id + ' .icon-tool').attr('data-file-state', '0').removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove');
});
});
break;
break;
case '1': //关闭视图
case '1': //关闭视图
layer.close(index);
layer.close(index);
break;
break;
case '2': //取消保存
case '2': //取消保存
_this.removeEditor(_id);
_this.removeEditor(_id);
layer.close(index);
layer.close(index);
break;
break;
}
}
});
});
}
}
});
});
break;
break;
}
}
$('.ace_toolbar_menu').hide();
$('.ace_toolbar_menu').hide();
$('.ace_toolbar_menu .menu-tabs,.ace_toolbar_menu .menu-encoding,.ace_toolbar_menu .menu-files').hide();
$('.ace_toolbar_menu .menu-tabs,.ace_toolbar_menu .menu-encoding,.ace_toolbar_menu .menu-files').hide();
e.stopPropagation();
e.stopPropagation();
e.preventDefault();
e.preventDefault();
});
});
$(window).keyup(function(e){
$(window).keyup(function(e){
if(e.keyCode === 116 && $('#ace_conter').length == 1){
if(e.keyCode === 116 && $('#ace_conter').length == 1){
layer.msg('Unable to refresh in editor mode. Please close and try again');
layer.msg('Unable to refresh in editor mode. Please close and try again');
}
}
});
});
// 新建编辑器视图
// 新建编辑器视图
$('.ace_editor_add').click(function() {
$('.ace_editor_add').click(function() {
_this.addEditorView();
_this.addEditorView();
});
});
// 底部状态栏功能按钮
// 底部状态栏功能按钮
$('.ace_conter_toolbar .pull-right span').click(function(e) {
$('.ace_conter_toolbar .pull-right span').click(function(e) {
var _type = $(this).attr('data-type'),
var _type = $(this).attr('data-type'),
_item = _this.editor['ace_editor_' + _this.ace_active];
_item = _this.editor['ace_editor_' + _this.ace_active];
$('.ace_toolbar_menu').show();
$('.ace_toolbar_menu').show();
switch (_type) {
switch (_type) {
case 'cursor':
case 'cursor':
$('.ace_toolbar_menu').hide();
$('.ace_toolbar_menu').hide();
$('.ace_header .jumpLine').click();
$('.ace_header .jumpLine').click();
break;
break;
case 'history':
case 'history':
$('.ace_toolbar_menu').hide();
$('.ace_toolbar_menu').hide();
if (_item.historys.length === 0) {
if (_item.historys.length === 0) {
layer.msg(lan.public.history_file_empty, { icon: 0 });
layer.msg(lan.public.history_file_empty, { icon: 0 });
return false;
return false;
}
}
_this.layer_view = layer.open({
_this.layer_view = layer.open({
type: 1,
type: 1,
area: '550px',
area: '550px',
title: lan.public.history_version + '[ ' + _item.fileName + ' ]',
title: lan.public.history_version + '[ ' + _item.fileName + ' ]',
skin: 'historys_layer',
skin: 'historys_layer',
content: '<div class="pd20">\
content: '<div class="pd20">\
<div class="divtable">\
<div class="divtable">\
<table class="historys table table-hover">\
<table class="historys table table-hover">\
<thead><tr><th>' + lan.public.file_name + '</th><th>' + lan.public.v_time + '</th><th style="text-align:right;">' + lan.public.operate + '</th></tr></thead>\
<thead><tr><th>' + lan.public.file_name + '</th><th>' + lan.public.v_time + '</th><th style="text-align:right;">' + lan.public.operate + '</th></tr></thead>\
<tbody></tbody>\
<tbody></tbody>\
</table>\
</table>\
</div>\
</div>\
</div>',
</div>',
success: function(layeo, index) {
success: function(layeo, index) {
var _html = '';
var _html = '';
for (var i = 0; i < _item.historys.length; i++) {
for (var i = 0; i < _item.historys.length; i++) {
_html += '<tr><td><span class="size_ellipsis" style="max-width:200px">' + _item.fileName + '</span></td><td>' + bt.format_data(_item.historys[i]) + '</td><td align="right"><a href="javascript:;" class="btlink open_history_file" data-time="' + _item.historys[i] + '">' + lan.public.open_file + '</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:;" class="btlink recovery_file_historys" data-history="' + _item.historys[i] + '" data-path="' + _item.path + '">' + lan.public.restore + '</a></td></tr>'
_html += '<tr><td><span class="size_ellipsis" style="max-width:200px">' + _item.fileName + '</span></td><td>' + bt.format_data(_item.historys[i]) + '</td><td align="right"><a href="javascript:;" class="btlink open_history_file" data-time="' + _item.historys[i] + '">' + lan.public.open_file + '</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:;" class="btlink recovery_file_historys" data-history="' + _item.historys[i] + '" data-path="' + _item.path + '">' + lan.public.restore + '</a></td></tr>'
}
}
if (_html === '') _html += '<tr><td colspan="3">' + lan.public.no_file_history + '</td></tr>'
if (_html === '') _html += '<tr><td colspan="3">' + lan.public.no_file_history + '</td></tr>'
$('.historys tbody').html(_html);
$('.historys tbody').html(_html);
$('.historys_layer').css('top', ($(window).height() / 2) - ($('.historys_layer').height() / 2) + 'px')
$('.historys_layer').css('top', ($(window).height() / 2) - ($('.historys_layer').height() / 2) + 'px')
$('.open_history_file').click(function() {
$('.open_history_file').click(function() {
var _history = $(this).attr('data-time');
var _history = $(this).attr('data-time');
_this.openHistoryEditorView({ filename: _item.path, history: _history }, function() {
_this.openHistoryEditorView({ filename: _item.path, history: _history }, function() {
layer.close(index);
layer.close(index);
$('.ace_conter_tips').show();
$('.ace_conter_tips').show();
$('.ace_conter_tips .tips').html(lan.public.read_only_file + _item.path + ',' + lan.public.history_v + ' [ ' + bt.format_data(new Number(_history)) + ' ]<a href="javascript:;" class="ml35 btlink" data-path="' + _item.path + '" data-history="' + _history + '">' + lan.public.restore_history + '</a>');
$('.ace_conter_tips .tips').html(lan.public.read_only_file + _item.path + ',' + lan.public.history_v + ' [ ' + bt.format_data(new Number(_history)) + ' ]<a href="javascript:;" class="ml35 btlink" data-path="' + _item.path + '" data-history="' + _history + '">' + lan.public.restore_history + '</a>');
});
});
});
});
$('.recovery_file_historys').click(function() {
$('.recovery_file_historys').click(function() {
_this.event_ecovery_file(this);
_this.event_ecovery_file(this);
});
});
}
}
});
});
break;
break;
case 'tab':
case 'tab':
$('.ace_toolbar_menu .menu-tabs').show().siblings().hide();
$('.ace_toolbar_menu .menu-tabs').show().siblings().hide();
$('.tabsType').find(_item.softTabs ? '[data-value="nbsp"]' : '[data-value="tabs"]').addClass('active').append(_icon);
$('.tabsType').find(_item.softTabs ? '[data-value="nbsp"]' : '[data-value="tabs"]').addClass('active').append(_icon);
$('.tabsSize [data-value="' + _item.tabSize + '"]').addClass('active').append(_icon);
$('.tabsSize [data-value="' + _item.tabSize + '"]').addClass('active').append(_icon);
break;
break;
case 'encoding':
case 'encoding':
_this.getEncodingList(_item.encoding);
_this.getEncodingList(_item.encoding);
$('.ace_toolbar_menu .menu-encoding').show().siblings().hide();
$('.ace_toolbar_menu .menu-encoding').show().siblings().hide();
break;
break;
case 'lang':
case 'lang':
$('.ace_toolbar_menu').hide();
$('.ace_toolbar_menu').hide();
layer.msg(lan.public.can_not_switch_lan, { icon: 6 });
layer.msg(lan.public.can_not_switch_lan, { icon: 6 });
break;
break;
}
}
e.stopPropagation();
e.stopPropagation();
e.preventDefault();
e.preventDefault();
});
});
// 隐藏目录
// 隐藏目录
$('.tips_fold_icon .glyphicon').click(function() {
$('.tips_fold_icon .glyphicon').click(function() {
if ($(this).hasClass('glyphicon-menu-left')) {
if ($(this).hasClass('glyphicon-menu-left')) {
$('.ace_conter_tips').css('right', '0');
$('.ace_conter_tips').css('right', '0');
$('.tips_fold_icon').css('left', '0');
$('.tips_fold_icon').css('left', '0');
$(this).removeClass('glyphicon-menu-left').addClass('glyphicon-menu-right');
$(this).removeClass('glyphicon-menu-left').addClass('glyphicon-menu-right');
} else {
} else {
$('.ace_conter_tips').css('right', '-100%');
$('.ace_conter_tips').css('right', '-100%');
$('.tips_fold_icon').css('left', '-25px');
$('.tips_fold_icon').css('left', '-25px');
$(this).removeClass('glyphicon-menu-right').addClass('glyphicon-menu-left');
$(this).removeClass('glyphicon-menu-right').addClass('glyphicon-menu-left');
}
}
});
});
// 设置换行符
// 设置换行符
$('.menu-tabs').on('click', 'li', function(e) {
$('.menu-tabs').on('click', 'li', function(e) {
var _val = $(this).attr('data-value'),
var _val = $(this).attr('data-value'),
_item = _this.editor['ace_editor_' + _this.ace_active];
_item = _this.editor['ace_editor_' + _this.ace_active];
if ($(this).parent().hasClass('tabsType')) {
if ($(this).parent().hasClass('tabsType')) {
//_item.ace.getSession().setUseSoftTabs(_val == 'nbsp');
//_item.ace.getSession().setUseSoftTabs(_val == 'nbsp');
_this.aceConfig.aceEditor.useSoftTabs = _val == 'nbsp';
_this.aceConfig.aceEditor.useSoftTabs = _val == 'nbsp';
_item.softTabs = _val == 'nbsp';
_item.softTabs = _val == 'nbsp';
} else {
} else {
//_item.ace.getSession().setTabSize(_val);
//_item.ace.getSession().setTabSize(_val);
_this.aceConfig.aceEditor.tabSize = _val;
_this.aceConfig.aceEditor.tabSize = _val;
_item.tabSize = _val;
_item.tabSize = _val;
}
}
_this.saveAceConfig(_this.aceConfig,function(res){
_this.saveAceConfig(_this.aceConfig,function(res){
if(res.status){
if(res.status){
layer.msg('Successful setup', {icon: 1});
layer.msg('Successful setup', {icon: 1});
}
}
});
});
$(this).siblings().removeClass('active').find('.icon').remove();
$(this).siblings().removeClass('active').find('.icon').remove();
$(this).addClass('active').append(_icon);
$(this).addClass('active').append(_icon);
_this.currentStatusBar(_item.id);
_this.currentStatusBar(_item.id);
e.stopPropagation();
e.stopPropagation();
e.preventDefault();
e.preventDefault();
});
});
// 设置编码内容
// 设置编码内容
$('.menu-encoding').on('click', 'li', function(e) {
$('.menu-encoding').on('click', 'li', function(e) {
var _item = _this.editor['ace_editor_' + _this.ace_active],
var _item = _this.editor['ace_editor_' + _this.ace_active],
_icon = '<span class="icon"><i class="glyphicon glyphicon-ok" aria-hidden="true"></i></span>';
_icon = '<span class="icon"><i class="glyphicon glyphicon-ok" aria-hidden="true"></i></span>';
layer.msg(lan.public.set_file_encoding + ':' + $(this).attr('data-value'));
layer.msg(lan.public.set_file_encoding + ':' + $(this).attr('data-value'));
$('.ace_conter_toolbar [data-type="encoding"]').html(lan.public.encoding + ': <i>' + $(this).attr('data-value') + '</i>');
$('.ace_conter_toolbar [data-type="encoding"]').html(lan.public.encoding + ': <i>' + $(this).attr('data-value') + '</i>');
$(this).addClass('active').append(_icon).siblings().removeClass('active').find('span').remove();
$(this).addClass('active').append(_icon).siblings().removeClass('active').find('span').remove();
_item.encoding = $(this).attr('data-value');
_item.encoding = $(this).attr('data-value');
_this.saveFileMethod(_item);
_this.saveFileMethod(_item);
});
});
// 搜索内容键盘事件
// 搜索内容键盘事件
$('.menu-files .menu-input').keyup(function() {
$('.menu-files .menu-input').keyup(function() {
_this.searchRelevance($(this).val());
_this.searchRelevance($(this).val());
if ($(this).val != '') {
if ($(this).val != '') {
$(this).next().show();
$(this).next().show();
} else {
} else {
$(this).next().hide();
$(this).next().hide();
}
}
});
});
// 清除搜索内容事件
// 清除搜索内容事件
$('.menu-files .menu-conter .fa').click(function() {
$('.menu-files .menu-conter .fa').click(function() {
$('.menu-files .menu-input').val('').next().hide();
$('.menu-files .menu-input').val('').next().hide();
_this.searchRelevance()
_this.searchRelevance()
});
});
// 顶部状态栏
// 顶部状态栏
$('.ace_header>span').click(function(e) {
$('.ace_header>span').click(function(e) {
var type = $(this).attr('class'),
var type = $(this).attr('class'),
editor_item = _this.editor['ace_editor_' + _this.ace_active];
editor_item = _this.editor['ace_editor_' + _this.ace_active];
var _icon = '<span class="icon"><i class="glyphicon glyphicon-ok" aria-hidden="true"></i></span>';
var _icon = '<span class="icon"><i class="glyphicon glyphicon-ok" aria-hidden="true"></i></span>';
switch (type) {
switch (type) {
case 'saveFile': //保存当时文件
case 'saveFile': //保存当时文件
_this.saveFileMethod(editor_item);
_this.saveFileMethod(editor_item);
break;
break;
case 'saveFileAll': //保存全部
case 'saveFileAll': //保存全部
var loadT = layer.open({
var loadT = layer.open({
type: 1,
type: 1,
area: ['350px', '180px'],
area: ['350px', '180px'],
title: 'Tips',
title: 'Tips',
content: '<div class="ace-clear-form">\
content: '<div class="ace-clear-form">\
<div class="clear-icon"></div>\
<div class="clear-icon"></div>\
<div class="clear-title">Do you want to save changes to all files?</div>\
<div class="clear-title">Do you want to save changes to all files?</div>\
<div class="clear-tips">If you don\'t save, the changes will be lost!</div>\
<div class="clear-tips">If you don\'t save, the changes will be lost!</div>\
<div class="ace-clear-btn" style="">\
<div class="ace-clear-btn" style="">\
<button type="button" class="btn btn-sm btn-default clear-btn" style="margin-right:10px;" >Cancel</button>\
<button type="button" class="btn btn-sm btn-default clear-btn" style="margin-right:10px;" >Cancel</button>\
<button type="button" class="btn btn-sm btn-success save-all-btn">Save</button>\
<button type="button" class="btn btn-sm btn-success save-all-btn">Save</button>\
</div>\
</div>\
</div>',
</div>',
success: function(layers, index) {
success: function(layers, index) {
$('.clear-btn').click(function() {
$('.clear-btn').click(function() {
layer.close(index);
layer.close(index);
});
});
$('.save-all-btn').click(function() {
$('.save-all-btn').click(function() {
var _arry = [],
var _arry = [],
editor = aceEditor['editor'];
editor = aceEditor['editor'];
for (var item in editor) {
for (var item in editor) {
_arry.push({
_arry.push({
path: editor[item]['path'],
path: editor[item]['path'],
data: editor[item]['ace'].getValue(),
data: editor[item]['ace'].getValue(),
encoding: editor[item]['encoding'],
encoding: editor[item]['encoding'],
})
})
}
}
_this.saveAllFileBody(_arry, function() {
_this.saveAllFileBody(_arry, function() {
$('.ace_conter_menu>.item').each(function(el, index) {
$('.ace_conter_menu>.item').each(function(el, index) {
var _id = $(this).attr('data-id');
var _id = $(this).attr('data-id');
$(this).find('i').attr('data-file-state', '0').removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove')
$(this).find('i').attr('data-file-state', '0').removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove')
aceEditor.editor['ace_editor_' + _id].fileType = 0;
aceEditor.editor['ace_editor_' + _id].fileType = 0;
});
});
layer.close(index);
layer.close(index);
});
});
});
});
}
}
});
});
break;
break;
case 'refreshs': //刷新文件
case 'refreshs': //刷新文件
if (editor_item.fileType === 0) {
if (editor_item.fileType === 0) {
aceEditor.getFileBody({ path: editor_item.path }, function(res) {
aceEditor.getFileBody({ path: editor_item.path }, function(res) {
editor_item.ace.setValue(res.data);
editor_item.ace.setValue(res.data);
editor_item.fileType = 0;
editor_item.fileType = 0;
$('.item_tab_' + editor_item.id + ' .icon-tool').attr('data-file-state', '0').removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove');
$('.item_tab_' + editor_item.id + ' .icon-tool').attr('data-file-state', '0').removeClass('glyphicon-exclamation-sign').addClass('glyphicon-remove');
layer.msg('Refresh successfully', { icon: 1 });
layer.msg('Refresh successfully', { icon: 1 });
});
});
return false;
return false;
}
}
var loadT = layer.open({
var loadT = layer.open({
type: 1,
type: 1,
//area: ['350px', '180px'],
//area: ['350px', '180px'],
title: 'Tips',
title: 'Tips',
content: '<div class="ace-clear-form">\
content: '<div class="ace-clear-form">\
<div class="clear-icon"></div>\
<div class="clear-icon"></div>\
<div class="clear-title">Whether to refresh the current file</div>\
<div class="clear-title">Whether to refresh the current file</div>\
<div class="clear-tips">Refreshing the current file will overwrite the current modification and continue!</div>\
<div class="clear-tips">Refreshing the current file will overwrite the current modification and continue!</div>\
<div class="ace-clear-btn" style="">\
<div class="ace-clear-btn" style="">\
<button type="button" class="btn btn-sm btn-default clear-btn" style="margin-right:10px;" >Cancel</button>\
<button type="button" class="btn btn-sm btn-default clear-btn" style="margin-right:10px;" >Cancel</button>\
<button type="button" class="btn btn-sm btn-success save-all-btn">Save</button>\
<button type="button" class="btn btn-sm btn-success save-all-btn">Save</button>\
</div>\
</div>\
</div>',
</div>',
success: function(layers, index) {
success: function(layers, index) {