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,IAAI,EAAO,EAAE,MACZ,EAAU,EAAK,KAAK,sBACpB,EAAS,EAAK,QAAQ,mBAElB,EAAO,SAAS,cACpB,EAAO,SAAS,YAChB,EAAO,KAAK,kBAAkB,YAAY,UAC1C,EAAO,KAAK,YAAY,KAAK,EAAK,QAClC,EAAK,QAAQ,MAAM,SAAS,UAC5B,EAAK,QAAU,EACf,MAAM,GAAG,gBAAgB,EAAM,GAEjC,GACD,CAEI,EAAE,gDAAgD,QACrD,EAAE,gDAAgD,YAGnD,EAAE,mDAAmD,GAAG,SAAS,WAChE,IAAI,EAAO,EAAE,MACZ,EAAe,EAAK,QAAQ,iBAAiB,KAAK,MAClD,EAAQ,EAAK,MACb,EAAQ,EAAK,QAAQ,iBAAiB,KAAK,KAEhC,IAAR,GACH,EAAa,KAAK,MAAM,SAAS,UACjC,EAAM,YAAY,UAClB,EAAa,KAAK,oBAAsB,EAAM,cAAgB,MAAM,YAAY,YAEhF,EAAa,KAAK,MAAM,YAAY,UACpC,EAAM,SAAS,UAEjB,IAEA,EAAE,+CAA+C,OAAM,WACtD,IAAI,EAAO,EAAE,MACZ,EAAQ,EAAK,KAAK,SAEnB,EAAM,IAAI,IACV,EAAK,SAAS,UACd,EAAM,QAAQ,QACf,IAEA,EAAE,qBAAqB,MAAK,WAC3B,IAAI,EAAS,EAAE,MACd,EAAO,EAAO,KAAK,aACnB,EAAS,EAAO,KAAK,gBAEtB,EAAK,OAAM,SAAS,GACnB,EAAE,iBAEkB,IAAhB,EAAO,OACV,EAAE,KAAM,WAAW,QAAU,gBAAiB,CAC7C,IAAM,EAAO,KAAK,YAClB,MAAO,EAAO,QACZ,SAAS,GACX,MAAM,GAAG,WAAW,EACrB,GAEF,GACD,GACD,GACa,GAGR,MAAM,KAEd,CAhaA,CAgaE","file":"/wp/plugins/puchi-ab-testing/trunk/admin/js/statistic.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /wp/plugins/puchi-ab-testing/trunk/admin/js/statistic.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function($){\r\n        'use strict'\r\n        window.puchi = {\r\n                el : {\r\n                        window : $(window),\r\n                        document : $(document)\r\n                },\r\n\t\tdef: {\r\n\t\t\tchartColor : {\r\n\t\t\t\t0:{\r\n\t\t\t\t\tcolor: \"rgba(33, 150, 243, 1)\",\r\n\t\t\t\t\toColor: \"rgba(33, 150, 243, 0.5)\",\r\n\t\t\t\t},\r\n\t\t\t\t1:{\r\n\t\t\t\t\tcolor: \"rgba(82, 185, 71, 1)\",\r\n\t\t\t\t\toColor: \"rgba(82, 185, 71, 0.5)\",\r\n\t\t\t\t},\r\n\t\t\t\t2:{\r\n\t\t\t\t\tcolor: \"rgba(239, 83, 80, 1)\",\r\n\t\t\t\t\toColor: \"rgba(239, 83, 80, 0.5)\"\r\n\t\t\t\t},\r\n\t\t\t\t3:{\r\n\t\t\t\t\tcolor: \"rgba(121, 85, 72, 1)\",\r\n\t\t\t\t\toColor: \"rgba(121, 85, 72, 0.5)\"\r\n\t\t\t\t},\r\n\t\t\t\t4:{\r\n\t\t\t\t\tcolor: \"rgba(103, 58, 183, 1)\",\r\n\t\t\t\t\toColor: \"rgba(103, 58, 183, 0.5)\"\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tpchChart: '',\r\n\t\t\tpchChartData: ''\r\n\t\t},\r\n\t\tfn : {\r\n\t\t\tpuchiConfirm: function(data){\r\n\t\t\t\t$.confirm({\r\n\t\t\t\t\ttitle: data.title,\r\n\t\t\t\t\tanimateFromElement: false,\r\n\t\t\t\t\tcontent: data.content,\r\n\t\t\t\t\tbuttons:  {\r\n\t\t\t\t\t\tconfirm:  {\r\n\t\t\t\t\t\t\tbtnClass: 'button button-primary',\r\n\t\t\t\t\t\t\taction: data.action\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tcancel: {\r\n\t\t\t\t\t\t\tbtnClass: 'button',\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t},\r\n\t\t\t\t\tbackgroundDismiss : true\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t\tpuchiAlert: function(data){\r\n\t\t\t\t$.alert({\r\n\t\t\t\t\ttitle: data.title,\r\n\t\t\t\t\tcontent: data.content,\r\n\t\t\t\t\tanimateFromElement: false,\r\n\t\t\t\t\tbuttons: {close: {btnClass: 'btn-hidden',action: function(){}}},\r\n\t\t\t\t\tautoClose: \"close|100\",\r\n\t\t\t\t\tbackgroundDismiss : true\r\n\t\t\t\t});\t\r\n\t\t\t},\r\n\t\t\tpuchiGenerateTbl: function(){\r\n\t\t\t\t$('.pch-tbl').each(function(){\r\n\t\t\t\t\tvar data = $(this).data('table'),\r\n\t\t\t\t\t\targs = {\r\n\t\t\t\t\t\t\tpagingType: 'full_numbers',\r\n\t\t\t\t\t\t\tlanguage: {\r\n\t\t\t\t\t\t\t\tpaginate: {\r\n\t\t\t\t\t\t\t\t\tlast: '&#187;', \r\n\t\t\t\t\t\t\t\t\tfirst: '&#171;' ,\r\n\t\t\t\t\t\t\t\t\tnext: '&#155;', \r\n\t\t\t\t\t\t\t\t\tprevious: '&#139;' \r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t      },\r\n\t\t\t\t\t\t      order: [[ 1, \"desc\" ]]\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tif( typeof data !== 'undefined' && typeof data === 'object' && data !== null  ){\r\n\t\t\t\t\t\t\tfor (var prop in data) {\r\n\t\t\t\t\t\t\t\tif (data.hasOwnProperty(prop)) {\r\n\t\t\t\t\t\t\t\t\targs[prop] = data[prop];\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t$(this).find('table').DataTable(args);\r\n\t\t\t\t\t$('<div class=\"clear\"></div>').insertBefore($(this).find('table'));\r\n\t\t\t\t\t$('<div class=\"clear\"></div>').appendTo($(this).find(' > *:first-child'));\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t\tpuchiFetchTable: function(data, target){\r\n\t\t\t\t$.post( puchi_data.api_url + \"get_range_statistic_data/\" ,{\r\n\t\t\t\t\ttype : data.type,\r\n\t\t\t\t\tpage : data.page,\r\n\t\t\t\t\tsplit : data.split,\r\n\t\t\t\t\tcontent: data.content\r\n\t\t\t\t}, function(result){\r\n\t\t\t\t\ttarget.html(result.content);\r\n\t\t\t\t\ttarget.removeClass('fetching');\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t\tpuchiDrawChart: function(data){\r\n\t\t\t\tconst labels = data.label;\r\n\t\t\t\tvar datasets = [],\r\n\t\t\t\t\tn = 0;\r\n\t\t\t\t\r\n\t\t\t\t$.each(data.split, function(i, v){\r\n\t\t\t\t\tdatasets.push({\r\n\t\t\t\t\t\tlabel: v.label,\r\n\t\t\t\t\t\tdata: v.data[data.type],\r\n\t\t\t\t\t\tborderColor: puchi.def.chartColor[n].color,\r\n\t\t\t\t\t\tbackgroundColor: puchi.def.chartColor[n].oColor\r\n\t\t\t\t\t});\r\n\t\t\t\t\tn++;\r\n\t\t\t\t});\r\n\t\t\t\t\r\n\t\t\t\tvar localConfig = {\r\n\t\t\t\t\ttype: 'line',\r\n\t\t\t\t\tdata: {\r\n\t\t\t\t\t\tlabels: labels,\r\n\t\t\t\t\t\tdatasets: datasets\r\n\t\t\t\t\t},\r\n\t\t\t\t\toptions: {\r\n\t\t\t\t\t\tresponsive: true,\r\n\t\t\t\t\t\tlegend: {\r\n\t\t\t\t\t\t\tdisplay: true,\r\n\t\t\t\t\t\t\tposition: 'bottom'\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\thover: {\r\n\t\t\t\t\t\t\tmode: 'index'\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\ttooltips: {}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tif (puchi.def.pchChart != '') {\r\n\t\t\t\t\tpuchi.def.pchChart.destroy();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tsetTimeout(function() {\r\n\t\t\t\t\tvar ctx = document.getElementById('pch-chart').getContext('2d');\r\n\t\t\t\t\tpuchi.def.pchChart =  new Chart(ctx, localConfig);\r\n\t\t\t\t\t$('.pch-chart-widget .pch-widget-body').removeClass('fetching');\r\n\t\t\t\t}, 100);\r\n\t\t\t},\r\n\t\t\tpuchiFetchChartData: function(page, split, range, custom, type){\r\n\t\t\t\t$.post( puchi_data.api_url + \"get_chart_statistic_data/\" ,{\r\n\t\t\t\t\tpage : page,\r\n\t\t\t\t\tsplit : split,\r\n\t\t\t\t\trange: range,\r\n\t\t\t\t\tcustom: custom\r\n\t\t\t\t}, function(result){\r\n\t\t\t\t\tif (result.status == 'ok') {\r\n\t\t\t\t\t\tpuchi.def.pchChartData = result;\r\n\t\t\t\t\t\tpuchi.def.pchChartData.type = type;\r\n\t\t\t\t\t\tpuchi.fn.puchiDrawChart(puchi.def.pchChartData);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tif (puchi.def.pchChart != '') {\r\n\t\t\t\t\t\t\tpuchi.def.pchChart.destroy();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t$('.pch-chart-widget .pch-widget-body').removeClass('fetching');\r\n\t\t\t\t\t\tpuchi.def.pchChartData = '';\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t\tpuchiFetchTableData: function(page, split, range, custom) {\r\n\t\t\t\t$.post( puchi_data.api_url + \"get_table_statistic_data/\", {\r\n\t\t\t\t\tpage: page,\r\n\t\t\t\t\tsplit: split,\r\n\t\t\t\t\trange: range,\r\n\t\t\t\t\tcustom: custom\r\n\t\t\t\t}, function(data){\r\n\t\t\t\t\tif (data.status == 'ok') {\r\n\t\t\t\t\t\tvar table = $(\"#pch-stat-content-tbl table\");\r\n\t\t\t\t\t\tif (table.hasClass('dataTable')) {\r\n\t\t\t\t\t\t\ttable.dataTable().fnDestroy();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t$('#pch-stat-content-tbl table tbody').html(data.content);\r\n\t\t\t\t\t\tpuchi.fn.puchiGenerateTbl();\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t},\r\n                run: function(){\r\n\t\t\t\r\n                        //WINDOW LOAD\r\n                        puchi.el.window.load(function(){\r\n\t\t\t\tif ($('#pch-chart').length) {\r\n\t\t\t\t\t// Init datepicker\r\n\t\t\t\t\t$(\".pch-datepicker\").datepicker({ dateFormat: 'yy-mm-dd' });\r\n\t\t\t\t\tvar from = $('input[name=\"from\"].pch-datepicker').first(),\r\n\t\t\t\t\t\tto = $('input[name=\"to\"].pch-datepicker').first();\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tfrom.on('change', function() {\r\n\t\t\t\t\t\tvar start_date = $(this).datepicker('getDate');\r\n\t\t\t\t\t\tto.datepicker(\"option\", \"disabled\", false) ;\r\n\t\t\t\t\t\tstart_date.setDate(start_date.getDate() + 1);\r\n\t\t\t\t\t\tto.datepicker('option', 'minDate', start_date);\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\tto.datepicker(\"option\", \"minDate\", new Date()) ;\r\n\t\t\t\t\tto.datepicker(\"option\", \"maxDate\", new Date()) ;\r\n\t\t\t\t\tto.datepicker(\"option\", \"disabled\", true) ;\r\n\t\t\t\t\tfrom.datepicker(\"option\", \"maxDate\", new Date()) ;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('#ui-datepicker-div *').remove();\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar chartConfig = $('.pch-chart-widget').data('chart'),\r\n\t\t\t\t\t\tpage = chartConfig.page,\r\n\t\t\t\t\t\tsplit = chartConfig.split,\r\n\t\t\t\t\t\trange = chartConfig.range,\r\n\t\t\t\t\t\tcustom = [],\r\n\t\t\t\t\t\ttype = chartConfig.type;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tpuchi.fn.puchiFetchChartData(page, split, range, custom, type);\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.pch-chart-type .dropholder a' ).click(function(e){\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tif (!$(this).closest('li').hasClass('active')) {\r\n\t\t\t\t\t\t\tvar self = $(this),\r\n\t\t\t\t\t\t\t\tparent = self.closest('.pch-chart-widget'),\r\n\t\t\t\t\t\t\t\ttitle = parent.find('.pch-widget-head').find('h2');\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tparent.find('.pch-chart-type > span b').html(self.text());\r\n\t\t\t\t\t\t\t$('.pch-chart-type .dropholder li').removeClass('active');\r\n\t\t\t\t\t\t\tself.closest('li').addClass('active');\r\n\t\t\t\t\t\t\ttitle.html(self.text());\r\n\t\t\t\t\t\t\ttype = self.attr('data-stat');\r\n\t\t\t\t\t\t\tpuchi.def.pchChartData.type = self.attr('data-stat');\r\n\t\t\t\t\t\t\tpuchi.fn.puchiDrawChart(puchi.def.pchChartData);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.pch-chart-range .dropholder a' ).click(function(e){\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tif (!$(this).closest('li').hasClass('active')) {\r\n\t\t\t\t\t\t\tvar self = $(this),\r\n\t\t\t\t\t\t\t\tparent = self.closest('.pch-range-select');\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif (!parent.hasClass('fetching')) {\r\n\t\t\t\t\t\t\t\trange = self.attr('data-range');\r\n\t\t\t\t\t\t\t\tif (range != 'custom') {\r\n\t\t\t\t\t\t\t\t\tparent.find('.custom-range').removeClass('displayed');\r\n\t\t\t\t\t\t\t\t\tparent.addClass('fetching');\r\n\t\t\t\t\t\t\t\t\tpuchi.fn.puchiFetchChartData(page, split, range, custom, type);\r\n\t\t\t\t\t\t\t\t\tpuchi.fn.puchiFetchTableData(page, split, range, custom);\r\n\t\t\t\t\t\t\t\t\tparent.removeClass('fetching');\r\n\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\tparent.find('.custom-range').addClass('displayed');\r\n\t\t\t\t\t\t\t\t\tif (custom.length > 1) {\r\n\t\t\t\t\t\t\t\t\t\tparent.addClass('fetching');\r\n\t\t\t\t\t\t\t\t\t\tpuchi.fn.puchiFetchChartData(page, split, range, custom, type);\r\n\t\t\t\t\t\t\t\t\t\tpuchi.fn.puchiFetchTableData(page, split, range, custom);\r\n\t\t\t\t\t\t\t\t\t\tparent.removeClass('fetching');\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t$('.pch-chart-range .dropholder li').removeClass('active');\r\n\t\t\t\t\t\t\t\tparent.find('.pch-chart-range > span b').html(self.text());\r\n\t\t\t\t\t\t\t\tself.closest('li').addClass('active');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.pch-range-select .custom-range input[name=\"from\"]').change(function() {\r\n\t\t\t\t\t\tvar from = $(this).val();\r\n\t\t\t\t\t\tcustom[0] = from;\r\n\t\t\t\t\t\tif (custom.length > 1) {\r\n\t\t\t\t\t\t\tpuchi.fn.puchiFetchChartData(page, split, range, custom, type);\r\n\t\t\t\t\t\t\tpuchi.fn.puchiFetchTableData(page, split, range, custom);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.pch-range-select .custom-range input[name=\"to\"]').change(function() {\r\n\t\t\t\t\t\tvar to = $(this).val();\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tcustom[1] = to;\r\n\t\t\t\t\t\tif (custom.length > 1) {\r\n\t\t\t\t\t\t\tpuchi.fn.puchiFetchChartData(page, split, range, custom, type);\r\n\t\t\t\t\t\t\tpuchi.fn.puchiFetchTableData(page, split, range, custom);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ($('#pch-stat-content-tbl').length) {\r\n\t\t\t\t\t\tpuchi.fn.puchiFetchTableData(page, split, range, custom);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n                        });\r\n                        \r\n                        //WINDOW READY\r\n                        puchi.el.document.ready(function(){\r\n\t\t\t\tif ($('#pch-stat-page-tbl').length) {\r\n\t\t\t\t\t$.get( puchi_data.api_url + \"get_page_statistic_data/\", function(data){\r\n\t\t\t\t\t\t$('#pch-stat-page-tbl table tbody').html(data.content);\r\n\t\t\t\t\t\tif (data.status == 'ok') {\r\n\t\t\t\t\t\t\tpuchi.fn.puchiGenerateTbl();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t$(document).on('click','.pch-tbl .action .delete', function(e){\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar self = $(this),\r\n\t\t\t\t\t\t\ttarget = self.closest('tr'),\r\n\t\t\t\t\t\t\ttitle = target.find('td:first-child a').text(),\r\n\t\t\t\t\t\t\ttable = self.closest('table'),\r\n\t\t\t\t\t\t\tdata = {\r\n\t\t\t\t\t\t\t\t'title' : puchi_data.lang.confirm,\r\n\t\t\t\t\t\t\t\t'content' : puchi_data.lang.s1 + \" <b>\"+ title+\"</b> \" + puchi_data.lang.s2,\r\n\t\t\t\t\t\t\t\t'action' : function(){ \r\n\t\t\t\t\t\t\t\t\ttarget.fadeOut('fast', function(){\r\n\t\t\t\t\t\t\t\t\t\t$.post( puchi_data.api_url + \"delete_page_statistic_data/\" ,{ id: target.data('id') } );\r\n\t\t\t\t\t\t\t\t\t\ttable.dataTable().fnDestroy();\r\n\t\t\t\t\t\t\t\t\t\ttarget.remove();\r\n\t\t\t\t\t\t\t\t\t\tpuchi.fn.puchiGenerateTbl();\r\n\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\tpuchi.fn.puchiConfirm(data);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//STATISTIC TABLE\r\n\t\t\t\tif ($('.pch-range-widget').length) {\r\n\t\t\t\t\tvar parent = $('.pch-range-widget'),\r\n\t\t\t\t\t\ttarget = parent.find('.pch-widget-body'),\r\n\t\t\t\t\t\tdata = parent.data('table');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\tpuchi.fn.puchiFetchTable(data, target);\r\n\t\t\t\t\t}, 1);\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.pch-stat-type .dropholder a').click(function(e){\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tvar self = $(this),\r\n\t\t\t\t\t\t\ttitle = self.closest('.pch-widget-head').find('h2'),\r\n\t\t\t\t\t\t\tstat = self.attr('data-stat'),\r\n\t\t\t\t\t\t\tparent = self.closest('.pch-dropselect');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (!target.hasClass('fetching')) {\r\n\t\t\t\t\t\t\ttarget.addClass('fetching');\r\n\t\t\t\t\t\t\tparent.find('.dropholder li').removeClass('active');\r\n\t\t\t\t\t\t\tparent.find('> span b').html(self.text());\t\t\t\r\n\t\t\t\t\t\t\tself.closest('li').addClass('active');\r\n\t\t\t\t\t\t\ttitle.html(self.text());\r\n\t\t\t\t\t\t\tdata.type = stat;\r\n\t\t\t\t\t\t\tpuchi.fn.puchiFetchTable(data, target);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.pch-split-content .dropholder a').click(function(e){\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tvar self = $(this),\r\n\t\t\t\t\t\t\tcontent = self.attr('data-split-content'),\r\n\t\t\t\t\t\t\tparent = self.closest('.pch-dropselect');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (!target.hasClass('fetching')) {\r\n\t\t\t\t\t\t\ttarget.addClass('fetching');\r\n\t\t\t\t\t\t\tparent.find('.dropholder li').removeClass('active');\r\n\t\t\t\t\t\t\tparent.find('> span b').html(self.text());\t\t\t\r\n\t\t\t\t\t\t\tself.closest('li').addClass('active');\r\n\t\t\t\t\t\t\tdata.content = content;\r\n\t\t\t\t\t\t\tpuchi.fn.puchiFetchTable(data, target);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif ($('.pch-dropselect .dropholder .split-holder ul').length) {\r\n\t\t\t\t\t$(\".pch-dropselect .dropholder .split-holder ul\").scrollBox();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$(\".pch-dropselect .dropholder .split-holder input\").on(\"keyup\", function(){\r\n\t\t\t\t\tvar self = $(this),\r\n\t\t\t\t\t\ttargetParent = self.closest('.split-holder').find('ul'),\r\n\t\t\t\t\t\tvalue = self.val(),\r\n\t\t\t\t\t\tclose = self.closest('.split-holder').find('i');\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (value !='') {\r\n\t\t\t\t\t\ttargetParent.find('li').addClass('hidden');\r\n\t\t\t\t\t\tclose.removeClass('hidden');\r\n\t\t\t\t\t\ttargetParent.find('li[data-filter*=\"' + value.toLowerCase() + '\"]').removeClass('hidden');\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\ttargetParent.find('li').removeClass('hidden');\r\n\t\t\t\t\t\tclose.addClass('hidden');\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\t\r\n\t\t\t\t$(\".pch-dropselect .dropholder .split-holder i\").click(function(){\r\n\t\t\t\t\tvar self = $(this),\r\n\t\t\t\t\t\tinput = self.prev('input');\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tinput.val('');\r\n\t\t\t\t\tself.addClass('hidden');\r\n\t\t\t\t\tinput.trigger('keyup');\r\n\t\t\t\t});\r\n\t\t\t\t\r\n\t\t\t\t$('.pch-setting-item').each(function(){\r\n\t\t\t\t\tvar parent = $(this),\r\n\t\t\t\t\t\tself = parent.find('.btn-save'),\r\n\t\t\t\t\t\ttarget = parent.find('.pch-to-save');\r\n\t\t\t\t\t\r\n\t\t\t\t\tself.click(function(e){\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (target.val() != '') {\r\n\t\t\t\t\t\t\t$.post( puchi_data.api_url + \"set_settings/\" ,{\r\n\t\t\t\t\t\t\t\tkey : target.attr('data-key'),\r\n\t\t\t\t\t\t\t\tvalue: target.val()\r\n\t\t\t\t\t\t\t}, function(result){\r\n\t\t\t\t\t\t\t\tpuchi.fn.puchiAlert(result);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t});\r\n                }\r\n        }\r\n        \r\n        puchi.run();\r\n        \r\n}(jQuery));"]}