mirror of
https://github.com/serghey-rodin/vesta.git
synced 2024-12-25 21:41:13 -08:00
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
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();
|
|
}
|
|
});
|