(function($)
{
"use strict";
$('body').on('click', '.st-del-social', function(e)
{
e.preventDefault();
$(this).parent().remove();
})
$('.vc_ui-button-action[data-vc-ui-element=button-save]').on('click', function()
{
var value;
if($('.st_add_social').length >0) {
value = $('.st_add_social').find('.st-social').serialize();
$('.st-social-value').val( encodeURIComponent(value) );
}
if($('.st_add_icon_cat').length >0) {
value = $('.st_add_icon_cat').find('.st-icon_cat').serialize();
$('.st-icon_cat-value').val( encodeURIComponent(value) );
}
if($('.st_add_social_ex').length >0) {
value = $('.st_add_social_ex').find('.st-social_ex').serialize();
$('.st-social-value_ex').val( encodeURIComponent(value) );
}
if($('.st_add_location').length >0) {
var value = $('.st_add_location').find('.st-location-save').serialize();
$('.st-location-value').val( encodeURIComponent(value) );
}
if($('.st_add_image_text').length >0) {
value = $('.st_add_image_text').find('.st-image_text').serialize();
$('.st-image_text-value').val( encodeURIComponent(value) );
}
if($('.st_add_image_adv').length >0) {
value = $('.st_add_image_adv').find('.st-image_adv').serialize();
$('.st-image_adv-value').val( encodeURIComponent(value) );
}
if($('.st_add_account_menu').length >0) {
value = $('.st_add_account_menu').find('.sv-account').serialize();
$('.st-account-value').val( encodeURIComponent(value) );
}
});
//Image Adv add
$('.st-button-add-image_adv').on('click', function()
{
var key = $('.st_add_image_adv').find('.image_adv-item').last().data('item');
if(key == '' || key == undefined)
{
key = 1;
}else
{
key = parseInt(key) + 1;
}
var item = '
';
$('.st_add_image_adv').append(item);
});
//account add
$('.st-button-add-account').on('click', function()
{
var key = $('.st_add_account_menu').find('.account-item').last().data('item');
if(key == '' || key == undefined)
{
key = 1;
}else
{
key = parseInt(key) + 1;
}
var item = '';
$('.st_add_account_menu').append(item);
});
//Social add
$('.st-button-add').on('click', function()
{
var key = $('.st_add_social').find('.social-item').last().data('item');
if(key == '' || key == undefined)
{
key = 1;
}else
{
key = parseInt(key) + 1;
}
var item = '';
$('.st_add_social').append(item);
});
//Icon Category add
$('.st-button-add-icon_cat').on('click', function()
{
var key = $('.st_add_icon_cat').find('.icon_cat-item').last().data('item');
if(key == '' || key == undefined)
{
key = 1;
}else
{
key = parseInt(key) + 1;
}
var item = '';
item += '
';
item += '
Delete';
item += '
';
$('.st_add_icon_cat').append(item);
});
//Social + title add
$('.st-button-add_ex').on('click', function()
{
var key = $('.st_add_social_ex').find('.social-item_ex').last().data('item');
if(key == '' || key == undefined)
{
key = 1;
}else
{
key = parseInt(key) + 1;
}
var item = '';
$('.st_add_social').append(item);
});
// maps location
var set_first = 1;
$('.st-location-add-map').on('click', function()
{
var key = $('.st_add_location').find('.location-item').last().attr('data-item');
// console.log('sss');
if(key == '' || key == undefined)
{
key = set_first;
set_first++;
}else
{
key = parseInt(key) + 1;
}
var item = '';
$('.st_add_location').append(item);
$('.st_add_location').find('.location-item').last().attr('data-item',key);
});
//Image text add
$('.st-button-add-image_text').on('click', function()
{
var key = $('.st_add_image_text').find('.image_text-item').last().data('item');
if(key == '' || key == undefined)
{
key = 1;
}else
{
key = parseInt(key) + 1;
}
var item = '';
$('.st_add_image_text').append(item);
});
// Delete
$('body').on('click', '.st-del-item', function(e)
{
e.preventDefault();
$(this).parent().remove();
})
})(jQuery)