forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit_server_php.js
More file actions
41 lines (36 loc) · 1.41 KB
/
edit_server_php.js
File metadata and controls
41 lines (36 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function toggleOptions(){
if($('#advanced-options').is(':visible')){
$.removeCookie('advanced');
$('#advanced-options').hide();
$('#basic-options').show();
} else {
$.cookie('advanced', 1);
$('#advanced-options').show();
$('#basic-options').hide();
var advance_options = $('#advanced-options textarea');
$('#vstobjects input[type=text]').each(function(i, elm){
var search = $(elm).attr('regexp');
var prev_value = $(elm).attr('prev_value');
$(elm).attr('prev_value', $(elm).val());
var regexp = new RegExp('^('+search+')(.+)('+prev_value+')', 'm');
advance_options.val(advance_options.val().replace(regexp, '$1$2' + $(elm).val()));
})
}
}
$('#vstobjects').submit(function(){
if($('#basic-options').is(':visible')){
var advance_options = $('#advanced-options textarea');
$('#vstobjects input[type=text]').each(function(i, elm){
var search = $(elm).attr('regexp');
var prev_value = $(elm).attr('prev_value');
$(elm).attr('prev_value', $(elm).val());
var regexp = new RegExp('^('+search+')(.+)('+prev_value+')', 'm');
advance_options.val(advance_options.val().replace(regexp, '$1$2' + $(elm).val()));
})
}
});
$(document).ready(function() {
if($.cookie('advanced')){
toggleOptions();
}
});