'+substr_content.replace('', '').replace('
', '')+'...'+
'
'+substr_content+'...'+
' '+
'
'+
''+
''+
''+
'';
append_html += ''+
''+
''+
'';
append_html +=
''+
''+
''+
''+
''+
''+
''+
''+
''+
''+
''+
''+
''+
''+
''+
'';
append_html +=
''+
'';
$('.edn-append-mcontent-prev').append(append_html);
$('.edn-button-count').val(count);
// $('.edn-text-content-wrap input[type="text"]').each(function () {
// $(this).val('');
// });
// $('.edn-text-content-wrap a.wp-color-result').each(function () {
// $(this).css('background-color','');
// });
tinymce.init({selector:'textarea'});
tinymce.get(inputid).setContent('');
$('.edn-add-multiple-content').hide();
}
});
function randomstring(L) {
var s = '';
var randomchar = function() {
var n = Math.floor(Math.random() * 62);
if (n < 10) return n; //1-10
if (n < 36) return String.fromCharCode(n + 55); //A-Z
return String.fromCharCode(n + 61); //a-z
}
while (s.length < L) s += randomchar();
return s;
}
//sortable initialization
$('.edn-append-mcontent-prev').sortable({
containment: "parent"
});
$('.edn-append-mcontent-prev').on('click', '.edn-delete-content', function () {
if (confirm(edn_pro_script_variable.icon_delete_confirm))
{
//var content_counter = $('.edn-button-count').val();
// content_counter--;
// $('.edn-button-count').val(content_counter);
var selector = $(this);
$(this).closest('.edn-sortable-content').fadeOut(800, function () {
selector.closest('.edn-sortable-content').remove();
});
return false;
}
});
$('.edn-append-mcontent-prev').on('click', '.edn-content-head', function (e) {
var selector = $(this);
var id = selector.attr('id');
var id_array = id.split('_');
if (selector.parent().find('.edn-arrow i').hasClass('dashicons-arrow-down'))
{
selector.parent().find('i.dashicons-arrow-down').removeClass('dashicons-arrow-down').addClass('dashicons-arrow-up');
if (selector.next().find('.edn-show-slide-call-button').is(':checked')) {
$('.edn-sctat_'+id_array[1]).show();
}else{
$('.edn-sctat_'+id_array[1]).hide();
}
if(selector.next().find('.edn-slide-call-action-type:checked').val()=='custom'){
$('.edn-slide-call-action-'+id_array[1]).hide();
$('.edn-custom-but-block-'+id_array[1]).show();
}else if(selector.next().find('.edn-slide-call-action-type:checked').val()=='shortcode-popup'){
$('.edn-slide-call-action-'+id_array[1]).hide();
$('.edn-shortcode-popup-but-block-'+id_array[1]).show();
// alert('#edn-m-shortcode-button-block-'+id_array[1]);
$('#edn-m-shortcode-button-block-'+id_array[1]).show();
}
else {
$('.edn-slide-call-action-'+id_array[1]).hide();
$('.edn-contact-but-block-'+id_array[1]).show();
}
if(selector.next().find('.edn-slide-call-action-type:checked').val() !='shortcode_popup' && selector.next().find('.edn-slide-call-action-type:checked').val() !='custom'){
if(selector.next().find('.edn-slide-contact-choose:checked').val()=='c-form'){
$('.edn-slide-cotnact-from-'+id_array[1]).hide();
$('.edn-slide-cc-form-'+id_array[1]).show();
}else{
$('.edn-slide-cotnact-from-'+id_array[1]).hide();
$('.edn-slide-cf7-'+id_array[1]).show();
}
}
}
else
{
selector.parent().find('i.dashicons-arrow-up').removeClass('dashicons-arrow-up').addClass('dashicons-arrow-down');
$('.edn-sctat_'+id_array[1]).hide();
}
selector.closest('.edn-sortable-content').find('.edn-multiple-slide-down').slideToggle(500);
});
//Choose Subscribe From
$('input[name="edn_subs_choose"]').click(function(){
var val = $(this).val();
if(val=='subs-c-form'){
$('.edn-subs-from').hide();
$('#edn-subs-custom-form').show();
}else if(val=='mailchip'){
$('.edn-subs-from').hide();
$('#edn-subs-mailchip-form').show();
}
else if(val=='constant-contact'){
$('.edn-subs-from').hide();
$('#edn-subs-constant-contact-form').show();
}
});
if($('input[name="edn_subs_choose"]:checked').val()=='subs-c-form'){
$('.edn-subs-from').hide();
$('#edn-subs-custom-form').show();
}else if($('input[name="edn_subs_choose"]:checked').val()=='mailchip'){
$('.edn-subs-from').hide();
$('#edn-subs-mailchip-form').show();
}else if($('input[name="edn_subs_choose"]:checked').val()=='aweber-newsletter'){
$('.edn-subs-from').hide();
$('#edn-subs-aweber-form').show();
}
else if($('input[name="edn_subs_choose"]:checked').val()=='constant-contact'){
$('.edn-subs-from').hide();
$('#edn-subs-constant-contact-form').show();
}
//reset button for show only once
$('#edn_reset_button').click(function(){
$.ajax({
url: edn_pro_script_variable.ajax_url,
type: 'post',
dataType: 'html',
data: {
action:'ajax_reset_showonce_backend',
nonce: edn_pro_script_variable.ajax_nonce,
},
beforeSend: function() {
$('.edn-ajax-loader').show('slow');
},
complete: function() {
$('.edn-ajax-loader').hide('slow');
},
success: function( resp ) {
if(resp=="success"){
$('#edn-reset-message').html('Flag Reset Successfully.').delay(2000).fadeOut();
}else{
$('#edn-reset-message').html(resp).delay(2000).fadeOut();
}
}
});
});
//Choose Notification Bar Effects
$('input[name="edn_bar_effect_option"]').click(function(){
var val = $(this).val();
if(val=='1'){
$('.edn-bar-efect-block').hide();
$('#edn-bar-ticker').show();
}else if(val=='2'){
$('.edn-bar-efect-block').hide();
$('#edn-bar-slider').show();
}else if(val=='3'){
$('.edn-bar-efect-block').hide();
$('#edn-bar-scroll').show();
}
});
if($('input[name="edn_bar_effect_option"]:checked').val()=='1'){
$('.edn-bar-efect-block').hide();
$('#edn-bar-ticker').show();
}else if($('input[name="edn_bar_effect_option"]:checked').val()=='2'){
$('.edn-bar-efect-block').hide();
$('#edn-bar-slider').show();
}else{
$('.edn-bar-efect-block').hide();
$('#edn-bar-scroll').show();
}
// Slide Multiple Call to action button
$('.edn-show-slide-call-button').change(function () {
var id = this.id;
var id_array = id.split('_');
if ($(this).is(':checked')) {
$('.edn-sctat_'+id_array[1]).show();
}else{
$('.edn-sctat_'+id_array[1]).hide();
}
});
//edit slide down call to action type for multiple
$('.edn-slide-call-action-type').click(function(){
var id = this.id;
var id_array = id.split('_');
var val = $(this).val();
if(val=='custom'){
$('.edn-slide-call-action-'+id_array[1]).hide();
$('.edn-custom-but-block-'+id_array[1]).show();
}else if(val=='contact'){
$('.edn-slide-call-action-'+id_array[1]).hide();
$('.edn-contact-but-block-'+id_array[1]).show();
}else if(val=='shortcode-popup'){
$('.edn-slide-call-action-'+id_array[1]).hide();
$('.edn-shortcode-popup-but-block-'+id_array[1]).show();
$('#edn-m-shortcode-button-block-'+id_array[1]).show();
}
});
//slide Contact From for multiple
$('.edn-slide-contact-choose').click(function(){
var id = this.id;
var id_array = id.split('_');
var val = $(this).val();
if(val=='c-form'){
$('.edn-slide-cotnact-from-'+id_array[1]).hide();
$('.edn-slide-cc-form-'+id_array[1]).show();
}else if(val=='form-7'){
$('.edn-slide-cotnact-from-'+id_array[1]).hide();
$('.edn-slide-cf7-'+id_array[1]).show();
}
});
/* Demo font style change */
$('.edn-color-picker').wpColorPicker();
//color picker
var myOptions = {
palettes: true,
change: function(event, ui){
$('#edn-label-font-text').css('background-color',ui.color.toString());
//alert(ui.color.toString());
},
};
$('#edn_bg_color').wpColorPicker(myOptions);//background color of notification bar
$('#edn-social-heading-text-color').wpColorPicker();//background color of notification bar
//color picker
var myOptions2 = {
palettes: true,
change: function(event, ui){
$('#edn-label-font-text').css('color',ui.color.toString());
//alert(ui.color.toString());
},
};
$('#edn_font_color').wpColorPicker(myOptions2);//background color of notification bar
var fontfamily = $( ".ednfont option:selected" ).text();
var fontsize = $( "#ednsize option:selected" ).text();
var bgcolor = $( "#edn_bg_color" ).val();
var fontcolor = $( "#edn_font_color" ).val();
//button
var btn_bg_color = $( "#cf_bg_color" ).val();
var btn_font_color = $( "#cf_font_color" ).val();
var btn_bghover_color = $( "#cf_hover_bg_color" ).val();
var btn_fonthover_color = $( "#cf_hover_font_color" ).val();
//button color picker
var myOptions3 = {
palettes: true,
change: function(event, ui){
ft_color = ui.color.toString();
$('#edn-label-font-text .btn_preview').css('color',ui.color.toString());
//alert(ui.color.toString());
},
};
var myOptions4 = {
palettes: true,
change: function(event, ui){
bg_color = ui.color.toString();
$('#edn-label-font-text .btn_preview').css('background-color',ui.color.toString());
//alert(ui.color.toString());
},
};
var myOptions5 = {
palettes: true,
change: function(event, ui){
$('#edn-label-font-text .btn_preview').on('mouseenter',function(){
var hover_element = $(this).attr('class');
$('#edn-label-font-text .btn_preview:hover').css('background-color',ui.color.toString());
});
$('#edn-label-font-text .btn_preview').on('mouseleave',function(){
var hover_element = $(this).attr('class');
$('#edn-label-font-text .btn_preview').css('background-color',bg_color);
});
},
};
$("#edn-label-font-text .btn_preview").hover(function(){
$(this).css("background-color",btn_bghover_color);
$(this).css("color",btn_fonthover_color);
}, function(){
$(this).css("background-color",btn_bg_color);
$(this).css("color",btn_font_color);
});
var myOptions6 = {
palettes: true,
change: function(event, ui){
$('#edn-label-font-text .btn_preview').on('mouseenter',function(){
var hover_element = $(this).attr('class');
$('#edn-label-font-text .btn_preview:hover').css('color',ui.color.toString());
});
$('#edn-label-font-text .btn_preview').on('mouseleave',function(){
var hover_element = $(this).attr('class');
$('#edn-label-font-text .btn_preview').css('color',ft_color);
});
},
};
$('#cf_font_color').wpColorPicker(myOptions3);//background color of notification bar
$('#cf_bg_color').wpColorPicker(myOptions4);//background color of notification bar
$('#cf_hover_bg_color').wpColorPicker(myOptions5);//background color of notification bar
$('#cf_hover_font_color').wpColorPicker(myOptions6);//background color of notification bar
//google font switching
$('.ednfont').change(function () {
var label_font = $(this).val();
var font_size = $( "#ednsize option:selected" ).text();
$("#edn-label-font-style").html('');
$("#edn-label-font-style").html('#edn-label-font-text {font-size: ' + font_size + 'px;font-family: "' + label_font + '" !important; }');
if(label_font != "Default" && label_font != ''){
WebFont.load({
google: {
families: [label_font]
}
});
}
});
$("#edn-label-font-text .btn_preview").hover(function(){
$(this).css("background-color",btn_bghover_color);
$(this).css("color",btn_fonthover_color);
}, function(){
$(this).css("background-color",btn_bg_color);
$(this).css("color",btn_font_color);
});
$("#edn-label-font-style").html('#edn-label-font-text {font-size: ' + fontsize + 'px;font-family: "' + fontfamily + '"; }');
if(bgcolor == ''){
bgcolor = "#fff";
}
$('#edn-label-font-text').css('background-color',bgcolor);
if(fontcolor == ''){
fontcolor = "#000";
}
$('#edn-label-font-text').css('color',fontcolor);
$('#edn-label-font-text .btn_preview').css('background-color',btn_bg_color);
$('#edn-label-font-text .btn_preview').css('border',btn_bg_color);
$('#edn-label-font-text .btn_preview').css('color',btn_font_color);
//$('#edn-label-font-text .btn_preview:hover').css('background-color',btn_bghover_color);
// $('#edn-label-font-text .btn_preview:hover').css('color',btn_fonthover_color);
if(fontfamily != "Default" && fontfamily != ''){
WebFont.load({
google: {
families: [fontfamily]
}
});
}
$("#ednsize").change(function(){
var family = $( ".ednfont option:selected" ).text();
var size = $(this).val();
$("#edn-label-font-style").html('#edn-label-font-text {font-size: ' + size + 'px;font-family: "' + family + '"; } }');
});
/* Subscriber check all */
$('#ednpro-subs-checkall').change(function() {
if ($(this).prop('checked')) {
$(".edn-select-all-subs").prop( "checked", true );
}
else {
$(".edn-select-all-subs").prop( "checked", false );
}
});//check all end
/* added code for subscribe form confimration name and email */
/* custom form */
if($("#custom_confirm").is(':checked')){
$('#edn-subs-confirm-fields').show();
} else {
$('#edn-subs-confirm-fields').hide();
}
if($("#mailchimp_confirm").is(':checked')){
$('#edn-subs-mailchimp-confirm').show();
} else {
$('#edn-subs-mailchimp-confirm').hide();
}
if($("#cc_confirm").is(':checked')){
$('#edn-subs-cc-confirm').show();
} else {
$('#edn-subs-cc-confirm').hide();
}
$('.edn_subs_confirm').on('click',function () {
var subsid = $(this).attr('id');
if(subsid == "custom_confirm"){
if ($(this).is(':checked')) {
$('#edn-subs-confirm-fields').show('slow');
} else {
$('#edn-subs-confirm-fields').hide('slow');
}
}else if(subsid == "mailchimp_confirm"){
if ($(this).is(':checked')) {
$('.edn-subs-mailchimp-confirm').show('slow');
} else {
$('.edn-subs-mailchimp-confirm').hide('slow');
}
}else{
if ($(this).is(':checked')) {
$('.edn-subs-cc-confirm').show('slow');
} else {
$('.edn-subs-cc-confirm').hide('slow');
}
}
});
$('#edn-positions').change(function(){
var position = $(this).val();
$('.edn-position-preview').hide();
$('#edn-positon-'+position).show();
var upperposition = position.toUpperCase().replace('_',' ');
$('#edn-positon-'+position+' .edn-backend-inner-title').html('Notification Bar Position Preview: '+upperposition);
});
var current_position = $( "#edn-positions option:selected" ).val();
if(current_position != ''){
$('#edn-positon-'+current_position).show();
}
//test mail using ajax
/* $('#edn-test_mail').click(function(){
var mail_to = $('input[name="edn_test_mail_to"]').val();
var mail_subject = $('input[name="edn_test_mail_subject"]').val();
var mail_message = $('textarea[name="edn_test_mail_message"]').val();
if(mail_to == ''){
alert('Please fill to email field.');
}else{
$.ajax({
url: edn_pro_script_variable.ajax_url,
type: 'post',
dataType: 'html',
data: {
action:'test_smtp',
mail_to: mail_to,
mail_subject: mail_subject,
mail_message: mail_message
},
beforeSend: function() {
$('.edn-ajax-loader').show('slow');
},
complete: function() {
$('.edn-ajax-loader').hide('slow');
},
success: function( resp ) {
alert(resp);
$('.edn_testmessage').css('display','block');
$('.edn_testmessage').html(resp);
}
});
}
}); */
/*
* Added features :version 1.0.10
* Open Panel Section
*/
/* enable open panel*/
$('#edn-open-panel').change(function () {
if ($(this).is(':checked')) {
$('.edn-open-panel-wrap').slideDown();
}else{
$('.edn-open-panel-wrap').slideUp();
}
});
if ($('#edn-open-panel').is(':checked')) {
$('.edn-open-panel-wrap').slideDown();
}else{
$('.edn-open-panel-wrap').slideUp();
}
//add widgets popup chooser
$('.edn_add_widgets').click(function () {
$('.edn-addwidgets').show();
});
$('.edn-close-widgets,.edn-lightbox').click(function () {
$('.edn-addwidgets').hide();
});
//var clicks = 0;
$('.all_wp_widgets').each(function() {
$(this).click(function(){
// clicks += 1;
var count = $('.listed_selected_widgets > div.ednpro_widget_area').length;
var widget_id =$(this).attr('data-value');
var widget_title =$(this).attr('data-text');
if(count == 3){
alert(selected_widget_limits);
}else{
var widgets = {
action: "add_selected_widget",
widget_id: widget_id,
title: widget_title,
nonce : admin_nonce
};
$.post(AjaxUrl, widgets, function (response) {
var widget = $(response.data); //display widgets by json
$('.edn_listed_widgets').show();
$('.listed_selected_widgets').append(widget);
add_events_widget(widget);
});
}
});
});
//editing widget data
var widget_area = $('.edn_listed_widgets').find('.listed_selected_widgets');
$('.ednpro_widget_area', widget_area).each(function() {
add_events_widget($(this));
});
function add_events_widget(widget) {
var widget_title = widget.find(".widget_title span.wptitle");
var widget_edit = widget.find(".widget-action");
var widget_inner = widget.find(".widget_inner");
var widget_id = widget.attr("data-id");
widget_edit.on('click',function(){
if (! widget.hasClass("ednpro_open") && ! widget.data("ednpro_loaded")) {
widget_title.addClass('ednpro_loading');
// retrieve the widget settings form
$.post(AjaxUrl, {
action: "edit_widget_data",
widget_id: widget_id,
_wpnonce: admin_nonce,
dataType : 'html'
}, function (response) {
var $response = $(response);
var $form = $response.find('form');
// bind delete button action
$(".ednpro_delete", $form).on("click", function (e) {
e.preventDefault();
var data = {
action: "ednpro_delete_widget",
widget_id: widget_id,
_wpnonce: admin_nonce
};
$.post(AjaxUrl, data, function (delete_response) {
widget.remove();
});
});
// bind close button action
$(".ednpro_close", $form).on("click", function (e) {
e.preventDefault();
widget.toggleClass("ednpro_open");
});
// bind save button action
$form.on("submit", function (e) {
e.preventDefault();
var dataa = $(this).serialize();
$('.ednpro_save_data').show();
$('.saving_msg').text(saving_data);
$.post(AjaxUrl, dataa, function (submit_response) {
$('.ednpro_save_data').fadeOut('slow');
});
});
widget_inner.html($response);
widget.data("ednpro_loaded", true).toggleClass("ednpro_open");
widget_title.removeClass('ednpro_loading');
});
} else {
widget.toggleClass("ednpro_open");
}
// close all other widgets
$(".ednpro_widget_area").not(widget).removeClass("ednpro_open");
});
return widget;
}
$('.listed_selected_widgets').sortable({
containment: "parent"
});
/*
* APEX COuntdown JS
*/
$('.apex_countlayout').change(function(){
var val = $(this).val();
$('.preview-counter').css('display','block');
$('.preview_image').css('display','none');
$('#counter_'+val).css('display','block');
});
var countlayout = $('.apex_countlayout option:selected').val();
$('.preview-counter').css('display','block');
$('.preview_image').css('display','none');
$('#counter_'+countlayout).css('display','block');
if (!document.getElementById("apexnb_uploadBtn")) {
//It does not exist
}else{
document.getElementById("apexnb_uploadBtn").onchange = function () {
var val = this.value;
var pathArray = val.split('\\');
document.getElementById("apexnb_uploadFile").value = pathArray[pathArray.length - 1];
};
}
$('.apexnb-file-type').css('display','none');
$('#apexnb-choose-file-type').change(function(){
var filetype = $(this).val();
if(filetype == "upload_demofile"){
$('.apexnb-demofile').css('display','block');
$('.apexnb-uploadfile').css('display','none');
}else if(filetype == "upload_customfile"){
$('.apexnb-demofile').css('display','none');
$('.apexnb-uploadfile').css('display','block');
$(".apexnb-file-type1,.apexnb-file-type2").css('display','none');
}else{
$('.apexnb-demofile,.apexnb-uploadfile').css('display','none');
$(".apexnb-file-type1,.apexnb-file-type2").css('display','none');
}
});
$('.toggledDropDown').hide();
var apexnb_ajax_url = edn_pro_script_variable.ajaxurl;
var apexnb_ajax_nonce = edn_pro_script_variable.ajaxnonce ;
$(".apexnb-file-type1,.apexnb-file-type2").css('display','none');
$('#apexnb-first-choice').change(function(){
var choice_demo = $(this).val();
var options = '';
$.ajax({
url: apexnb_ajax_url,
type: 'post',
dataType: 'json',
data: {
action:'get_demo_files',
first_choice :choice_demo,
nonce: apexnb_ajax_nonce,
},
beforeSend: function() {
$('.edn-ajax-loader').show('slow');
},
complete: function() {
$('.edn-ajax-loader').hide('slow');
},
success: function(resp) {
// console.log(resp);
$(".apexnb-file-type1").css('display','block');
options += '
';
for (var i = 0; i < resp.length - 2; i++) {
var newValue = resp[i].replace(/-/g, " ");
var myString = newValue.substr(0,1).toUpperCase() + newValue.substr(1);
options += '
';
}
$("#apexnb-second-choice").html(options);
}
});
});
$('#apexnb-second-choice').change(function(){
var second_choice = $(this).val();
var first_choice = $('#apexnb-first-choice option:selected').val();
var options = '';
$.ajax({
url: apexnb_ajax_url,
type: 'post',
dataType: 'json',
data: {
action:'get_demo_filess',
first_choice :first_choice,
second_choice :second_choice,
nonce: apexnb_ajax_nonce,
},
beforeSend: function() {
$('.edn-ajax-loader').show('slow');
},
complete: function() {
$('.edn-ajax-loader').hide('slow');
},
success: function(resp) {
// console.log(resp);
$(".apexnb-file-type2").css('display','block');
for (var i = 0; i < resp.length - 2; i++) {
var newValue = resp[i].replace(/-/g, " ");
newValue = newValue.replace('.json', '');
var newValue2 = resp[i].replace('.json', '');
var myString = newValue.substr(0,1).toUpperCase() + newValue.substr(1);
options += '
';
}
$("#apexnb-third-choice").html(options);
}
});
});
});//$(function () end
}(jQuery));