| 1 |
|
| 2 |
var height = 0, |
| 3 |
height2 = 0, |
| 4 |
height3 = 0; |
| 5 |
|
| 6 |
jQuery(document).ready(function ($) { |
| 7 |
|
| 8 |
$(".analytify-chosen").chosen(); |
| 9 |
$('.remove-stats').remove(); |
| 10 |
$("#start_date").datepicker({ |
| 11 |
dateFormat : 'yy-mm-dd', |
| 12 |
changeMonth : true, |
| 13 |
changeYear : true, |
| 14 |
beforeShow: function() { |
| 15 |
$('#ui-datepicker-div').addClass('mycalander'); |
| 16 |
}, |
| 17 |
yearRange: '-9y:c+nn' |
| 18 |
}).datepicker('setDate',new Date()); |
| 19 |
|
| 20 |
$("#end_date").datepicker({ |
| 21 |
dateFormat : 'yy-mm-dd', |
| 22 |
changeMonth : true, |
| 23 |
changeYear : true, |
| 24 |
beforeShow: function() { |
| 25 |
$('#ui-datepicker-div').addClass('mycalander'); |
| 26 |
}, |
| 27 |
yearRange: '-9y:c+nn' |
| 28 |
}).datepicker('setDate',new Date()); |
| 29 |
|
| 30 |
|
| 31 |
$("#view_analytics").click(function () { |
| 32 |
|
| 33 |
var start_date = $("#start_date").val(); |
| 34 |
var end_date = $("#end_date").val(); |
| 35 |
var urlpost = $("#post_ID").val(); |
| 36 |
|
| 37 |
$.ajax({ |
| 38 |
|
| 39 |
type: 'POST', |
| 40 |
url: ajaxurl, |
| 41 |
data: 'action=get_ajax_single_admin_analytics&start_date=' + start_date + "&end_date=" + end_date+"&post_id="+urlpost, |
| 42 |
|
| 43 |
beforeSend: function () { |
| 44 |
$(".loading").css("display", "block").css( "text-align", "center" ); |
| 45 |
$(".show-hide").css("display", "none").html(''); |
| 46 |
}, |
| 47 |
success: function (data, textStatus, XMLHttpRequest) { |
| 48 |
$(".loading").css("display", "none"); |
| 49 |
$(".show-hide").html(data).css("display", "block"); |
| 50 |
//$(".show-hide").css("display", "block"); |
| 51 |
}, |
| 52 |
error: function (MLHttpRequest, textStatus, errorThrown) { |
| 53 |
alert("An error"); |
| 54 |
} |
| 55 |
}); |
| 56 |
|
| 57 |
}); |
| 58 |
|
| 59 |
$('input[name="auth_step"]').on("change",function () { |
| 60 |
|
| 61 |
$('.' + $('input[name="auth_step"]:checked').val()).show(); |
| 62 |
$('.' + $('input[name="auth_step"]:not(:checked)').val()).hide(); |
| 63 |
|
| 64 |
}); |
| 65 |
|
| 66 |
|
| 67 |
$('input[name="auth_step"]').each( function () { |
| 68 |
console.log($(this).val()); |
| 69 |
if($(this).is(':checked')) $('.' +$(this).val()).show(); |
| 70 |
}); |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
$('#populate_keys').on("click",function(){ |
| 75 |
|
| 76 |
$.ajax({ |
| 77 |
|
| 78 |
type: 'POST', |
| 79 |
url: ajaxurl, |
| 80 |
data: 'action=get_ajax_secret_keys&n=' + Math.floor((Math.random() * 100) + 1), |
| 81 |
|
| 82 |
success: function (data, textStatus, XMLHttpRequest) { |
| 83 |
var obj = JSON.parse(data); |
| 84 |
|
| 85 |
$('#analytify_clientid').val(obj[0].id); |
| 86 |
$('#analytify_clientsecret').val(obj[0].secret); |
| 87 |
$('#analytify_apikey').val(obj[0].key); |
| 88 |
}, |
| 89 |
error: function (MLHttpRequest, textStatus, errorThrown) { |
| 90 |
alert("Couldn't fetch the keys, Please create your own from Google console."); |
| 91 |
} |
| 92 |
}); |
| 93 |
}); |
| 94 |
|
| 95 |
/*$('input[name="auth_step"]').on("click",function () { |
| 96 |
$('.user_access_code').show(); |
| 97 |
});*/ |
| 98 |
/*$("#disable_front").change(function(){ |
| 99 |
var ischecked=$(this).is(':checked'); |
| 100 |
if(ischecked) |
| 101 |
{ |
| 102 |
$(".disable").css("display", "none"); |
| 103 |
} |
| 104 |
else |
| 105 |
{ |
| 106 |
$(".disable").css("display", "block"); |
| 107 |
} |
| 108 |
});*/ |
| 109 |
$(".arrow_btn").on("click",function () { |
| 110 |
$(this).parent().next().slideToggle('slow').next().slideToggle('slow').end().end().toggleClass('close'); |
| 111 |
}); |
| 112 |
|
| 113 |
|
| 114 |
$(".grids_auto_size").each(function(){ |
| 115 |
if(($(this).height())>height){ |
| 116 |
height = $(this).height(); |
| 117 |
} |
| 118 |
}); |
| 119 |
|
| 120 |
|
| 121 |
$(".grids_auto_size").each(function(){ |
| 122 |
$(this).css("min-height",height); |
| 123 |
}); |
| 124 |
$(".keywordscont").each(function(){ |
| 125 |
if(($(this).height())>height2){ |
| 126 |
height2 = $(this).height(); |
| 127 |
} |
| 128 |
}); |
| 129 |
$(".keywordscont").each(function(){ |
| 130 |
$(this).css("min-height",height2); |
| 131 |
}); |
| 132 |
|
| 133 |
$(".stats").each(function(){ |
| 134 |
if(($(this).height())>height3){ |
| 135 |
height3 = $(this).height(); |
| 136 |
} |
| 137 |
}); |
| 138 |
$(".stats").each(function(){ |
| 139 |
$(this).css("min-height",height3); |
| 140 |
}); |
| 141 |
}); |
| 142 |
|
| 143 |
jQuery(window).resize(function($){ |
| 144 |
|
| 145 |
jQuery(".grids_auto_size").each(function(){ |
| 146 |
jQuery(this).css("min-height",height); |
| 147 |
}); |
| 148 |
|
| 149 |
jQuery(".keywordscont").each(function(){ |
| 150 |
jQuery(this).css("min-height",height2); |
| 151 |
}); |
| 152 |
|
| 153 |
jQuery(".stats").each(function(){ |
| 154 |
jQuery(this).css("min-height",height3); |
| 155 |
}); |
| 156 |
|
| 157 |
}); |