⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.63
Server IP:
217.76.53.76
Server:
Linux vmi1397931.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
Server Software:
Apache
PHP Version:
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
onlinestore.ng
/
public
/
custom
/
js
/
Edit File: custom.js
"use strict"; // theme implementation $(document).ready(function() { if ($(".dataTable").length > 0) { const dataTable = new simpleDatatables.DataTable(".dataTable"); } if ($(".dataTable1").length > 0) { const dataTable = new simpleDatatables.DataTable(".dataTable1"); } var dataTabelLang = { paginate: { previous: "{{__('Previous')}}", next: "{{__('Next')}}" }, lengthMenu: "{{__('Show')}} _MENU_ {{__('entries')}}", zeroRecords: "{{__('No data available in table')}}", info: "{{__('Showing')}} _START_ {{__('to')}} _END_ {{__('of')}} _TOTAL_ {{__('entries')}}", infoEmpty: " ", search: "{{__('Search:')}}" } }); if ($(".multi-select").length > 0) { $( $(".multi-select") ).each(function( index,element ) { var id = $(element).attr('id'); var multipleCancelButton = new Choices( '#'+id, { removeItemButton: true, } ); }); } function addCommas(num) { var number = parseFloat(num).toFixed(2).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,'); return ((site_currency_symbol_position == "pre") ? site_currency_symbol : '') + number + ((site_currency_symbol_position == "post") ? site_currency_symbol : ''); } $('.show_confirm').click(function (event) { var form = $(this).closest("form"); const swalWithBootstrapButtons = Swal.mixin({ customClass: { confirmButton: 'btn btn-success', cancelButton: 'btn btn-danger' }, buttonsStyling: false }) swalWithBootstrapButtons.fire({ title: 'Are you sure?', text: "This action can not be undone. Do you want to continue?", icon: 'warning', showCancelButton: true, confirmButtonText: 'Yes', cancelButtonText: 'No', reverseButtons: true }).then((result) => { if(result.isConfirmed) { form.submit(); } }) }); $(document).on("click", '.bs-pass-para',function () { const swalWithBootstrapButtons = Swal.mixin({ customClass: { confirmButton: 'btn btn-success', cancelButton: 'btn btn-danger' }, buttonsStyling: false }) swalWithBootstrapButtons.fire({ title: $(this).data('confirm'), text: $(this).data('text'), icon: 'warning', showCancelButton: true, confirmButtonText: 'Yes', cancelButtonText: 'No', reverseButtons: false, }).then((result) => { if (result.isConfirmed) { document.getElementById($(this).data('confirm-yes')).submit(); } else if ( result.dismiss === Swal.DismissReason.cancel ) { } }) }); // *********** $(document).on('click', '.fc-day-grid-event', function (e) { // if (!$(this).hasClass('project')) { e.preventDefault(); var event = $(this); var title = $(this).find('.fc-content .fc-title').html(); var size = 'lg'; var url = $(this).attr('href'); $("#commonModal .modal-title").html(title); $("#commonModal .modal-dialog").addClass('modal-' + size); $.ajax({ url: url, success: function (data) { $('#commonModal .modal-body').html(data); $("#commonModal").modal('show'); common_bind(); }, error: function (data) { data = data.responseJSON; toastrs('Error', data.error, 'error') } }); // } }); $(document).ready(function () { $('#enable_header_img').trigger('change'); $('#enable_subscriber').trigger('change'); $('#enable_flat').trigger('change'); $('#domainnote').trigger('change'); $('#enable_product_variant').trigger('change'); $('#enable_social_button').trigger('change'); if ($(".summernote-simple").length) { // setTimeout(function (){ // $('.summernote-simple').summernote({ // dialogsInBody: !0, // minHeight: 200, // toolbar: [ // ['style', ['style']], // ["font", ["bold", "italic", "underline", "clear", "strikethrough"]], // ['fontname', ['fontname']], // ['color', ['color']], // ["para", ["ul", "ol", "paragraph"]], // ] // }); $('.summernote-simple').summernote({ toolbar: [ ['style', ['style']], ['font', ['bold', 'italic', 'underline', 'strikethrough']], ['list', ['ul', 'ol', 'paragraph']], ['insert', ['link', 'unlink']], ], height: 250, }); // },3000); } $(document).ready(function () { $('.custom-list-group-item').on('click', function () { var href = $(this).attr('data-href'); $('.tabs-card').addClass('d-none'); $(href).removeClass('d-none'); $('#tabs .custom-list-group-item').removeClass('text-primary'); $(this).addClass('text-primary'); }); }); $('[data-confirm]').each(function () { var me = $(this), me_data = me.data('confirm'); me_data = me_data.split("|"); me.fireModal({ title: me_data[0], body: me_data[1], buttons: [ { text: me.data('confirm-text-yes') || 'Yes', class: 'btn btn-sm btn rounded-pill', handler: function () { eval(me.data('confirm-yes')); } }, { text: me.data('confirm-text-cancel') || 'Cancel', class: 'btn btn-sm btn-secondary ', id : 'close-button', handler: function (modal) { $.destroyModal(modal); eval(me.data('confirm-no')); } } ] }) }); var Select = function () { var e = $('[data-toggle="select"]'); e.length && e.each(function () { $(this).select2({ minimumResultsForSearch: -1 }) }) }() }); $(document).on('change', '#enable_subscriber', function (e) { if ($('#enable_subscriber').is(':checked')) { $('#subscriber').show(); } else { $('#subscriber').hide(); } }); $(document).on('change', 'body #blog_social_form #enable_social_button', function (e) { $('body #blog_social_form #enable_social_button').toggleClass('data-check'); if ($('body #blog_social_form #enable_social_button').hasClass('data-check')) { $('body #blog_social_form .social-btn').hide(); } else { $('body #blog_social_form .social-btn').show(); } }); $(document).on('change', 'body #store_blog_from #enable_social_button', function (e) { if ($('body #store_blog_from #enable_social_button').is(':checked')) { $('body #store_blog_from .sub_social_button').show(); } else { $('body #store_blog_from .sub_social_button').hide(); } }); $(document).on('change', '#product-coupon-store #enable_flat', function (e) { if ($(this).is(':checked')) { $('#product-coupon-store .flat_discount').show(); $('#product-coupon-store .nonflat_discount').hide(); } else { $('#product-coupon-store .flat_discount').hide(); $('#product-coupon-store .nonflat_discount').show(); } }); $(document).on('change', '#enable_product_variant', function (e) { if ($('#enable_product_variant').is(':checked')) { $('#productVariant').show(); $('.proprice').hide(); } else { $('#productVariant').hide(); $('.proprice').show(); } }); $(document).on('change', '.domain_click#enable_storelink', function (e) { $('#StoreLink').show(); $('.sundomain').hide(); $('.domain').hide(); $('#domainnote').hide(); $("#subdomainnote").hide(); if ($('input[name="domain_switch"]').is(':checked')) { $('.domain_text').show(); } else { $(".domain_text").hide(); } $( "#enable_storelink" ).parent().addClass('active'); $( "#enable_domain" ).parent().removeClass('active'); $( "#enable_subdomain" ).parent().removeClass('active'); }); $(document).on('change', '.domain_click#enable_domain', function (e) { $('.domain').show(); $('#StoreLink').hide(); $('.sundomain').hide(); $('#domainnote').show(); $("#subdomainnote").hide(); if ($('input[name="domain_switch"]').is(':checked')) { $('.domain_text').show(); } else { $(".domain_text").hide(); } $( "#enable_domain" ).parent().addClass('active'); $( "#enable_storelink" ).parent().removeClass('active'); $( "#enable_subdomain" ).parent().removeClass('active'); }); $(document).on('change', '.domain_click#enable_subdomain', function (e) { $('.sundomain').show(); $('#StoreLink').hide(); $('.domain').hide(); $('#domainnote').hide(); $("#subdomainnote").show(); if ($('input[name="domain_switch"]').is(':checked')) { $('.domain_text').show(); } else { $(".domain_text").hide(); } $( "#enable_subdomain" ).parent().addClass('active'); $( "#enable_domain" ).parent().removeClass('active'); $( "#enable_storelink" ).parent().removeClass('active'); }); $(document).on('change', '#enable_header_img', function (e) { if ($('#enable_header_img').is(':checked')) { $('#headerimg').show(); } else { $('#headerimg').hide(); } }); $(document).on('click', 'a[data-ajax-popup="true"], button[data-ajax-popup="true"], div[data-ajax-popup="true"]', function () { var data = {}; var title = $(this).data('title'); var size = ($(this).data('size') == '') ? 'md' : $(this).data('size'); var url = $(this).data('url'); $("#commonModal .modal-title").html(title); $("#commonModal .modal-dialog").addClass('modal-' + size); if ($('#vc_name_hidden').length > 0) { data['vc_name'] = $('#vc_name_hidden').val(); } if ($('#store_id').length > 0) { data['store_id'] = $('#store_id').val(); } if ($('#discount_hidden').length > 0) { data['discount'] = $('#discount_hidden').val(); } $.ajax({ url: url, data:data, success: function (data) { $('#commonModal .modal-body').html(data); $("#commonModal").modal('show'); taskCheckbox(); common_bind("#commonModal"); common_bind_select("#commonModal"); $('#enable_subscriber').trigger('change'); $('#enable_flat').trigger('change'); $('#enable_domain').trigger('change'); $('#enable_header_img').trigger('change'); $('#enable_product_variant').trigger('change'); $('#enable_social_button').trigger('change'); if ($(".multi-select").length > 0) { $( $(".multi-select") ).each(function( index,element ) { var id = $(element).attr('id'); var multipleCancelButton = new Choices( '#'+id, { removeItemButton: true, } ); }); } }, error: function (data) { data = data.responseJSON; } }); }); $(document).on('click', 'a[data-ajax-popup-over="true"], button[data-ajax-popup-over="true"], div[data-ajax-popup-over="true"]', function () { var validate = $(this).attr('data-validate'); var id = ''; if (validate) { id = $(validate).val(); } var title = $(this).data('title'); var size = ($(this).data('size') == '') ? 'md' : $(this).data('size'); var url = $(this).data('url'); $("#commonModalOver .modal-title").html(title); $("#commonModalOver .modal-dialog").addClass('modal-' + size); $.ajax({ url: url + '?id=' + id, success: function (data) { $('#commonModalOver .modal-body').html(data); $("#commonModalOver").modal('show'); taskCheckbox(); }, error: function (data) { data = data.responseJSON; show_toastr('Error', data.error, 'error') } }); }); function show_toastr(title, message, type) { var o, i; var icon = ''; var cls = ''; if (type == 'success') { icon = 'fas fa-check-circle'; // $('.toast-body').addClass('bg-success'); cls = 'primary'; } else { icon = 'fas fa-times-circle'; cls = 'danger'; } $.notify({icon: icon, title: " " + title, message: message, url: ""}, { element: "body", type: cls, allow_dismiss: !0, placement: {from: 'top', align: 'right'}, offset: {x: 15, y: 15}, spacing: 10, z_index: 1080, delay: 2500, timer: 2000, url_target: "_blank", mouse_over: !1, animate: {enter: o, exit: i}, template: '
' +'
' +'
'+message+'
' +'
' +'
' +'
' }); } function arrayToJson(form) { var data = $(form).serializeArray(); var indexed_array = {}; $.map(data, function (n, i) { indexed_array[n['name']] = n['value']; }); return indexed_array; } $(document).on("submit", "#commonModalOver form", function (e) { e.preventDefault(); var data = arrayToJson($(this)); data.ajax = true; var url = $(this).attr('action'); $.ajax({ url: url, data: data, type: 'POST', success: function (data) { show_toastr('Success', data.success, 'success'); $(data.target).append('
' + data.record.name + '
'); $(data.target).val(data.record.id); $(data.target).trigger('change'); $("#commonModalOver").modal('hide'); $(".selectric").selectric({ disableOnMobile: false, nativeOnMobile: false }); }, error: function (data) { data = data.responseJSON; show_toastr('Error', data.error, 'error') } }); }); function common_bind(selector = "body") { var $datepicker = $(selector + ' .datepicker'); if ($(".datepicker").length) { $('.datepicker').daterangepicker({ singleDatePicker: true, format: 'yyyy-mm-dd', locale: date_picker_locale, }); } if ($(".custom-datepicker").length) { $('.custom-datepicker').daterangepicker({ singleDatePicker: true, format: 'Y-MM', locale: { format: 'Y-MM' } }); } if ($(".summernote-simple").length) { // $('.summernote-simple').summernote({ // dialogsInBody: !0, // minHeight: 200, // toolbar: [ // ['style', ['style']], // ["font", ["bold", "italic", "underline", "clear", "strikethrough"]], // ['fontname', ['fontname']], // ['color', ['color']], // ["para", ["ul", "ol", "paragraph"]], // ] // }); $('.summernote-simple').summernote({ toolbar: [ ['style', ['style']], ['font', ['bold', 'italic', 'underline', 'strikethrough']], ['list', ['ul', 'ol', 'paragraph']], ['insert', ['link', 'unlink']], ], height: 250, }); } } function common_bind_select(selector = "body") { if (jQuery().selectric) { $(".selectric").selectric({ disableOnMobile: false, nativeOnMobile: false }); } if ($(".jscolor").length) { jscolor.installByClassName("jscolor"); } // LetterAvatar.transform(); var Select = function () { var e = $('[data-toggle="select"]'); e.length && e.each(function () { $(this).select2({ minimumResultsForSearch: -1 }) }) }() } function common_bind_confirmation() { $('[data-confirm]').each(function () { var me = $(this), me_data = me.data('confirm'); me_data = me_data.split("|"); me.fireModal({ title: me_data[0], body: me_data[1], buttons: [ { text: me.data('confirm-text-yes') || 'Yes', class: 'btn btn-danger btn-shadow', handler: function () { eval(me.data('confirm-yes')); } }, { text: me.data('confirm-text-cancel') || 'Cancel', class: 'btn btn-secondary', id : 'close-button', handler: function (modal) { $.destroyModal(modal); eval(me.data('confirm-no')); } } ] }) }); } function taskCheckbox() { var checked = 0; var count = 0; var percentage = 0; count = $("#check-list input[type=checkbox]").length; checked = $("#check-list input[type=checkbox]:checked").length; percentage = parseInt(((checked / count) * 100), 10); if (isNaN(percentage)) { percentage = 0; } $(".custom-label").text(percentage + "%"); $('#taskProgress').css('width', percentage + '%'); $('#taskProgress').removeClass('bg-warning'); $('#taskProgress').removeClass('bg-primary'); $('#taskProgress').removeClass('bg-success'); $('#taskProgress').removeClass('bg-danger'); if (percentage <= 15) { $('#taskProgress').addClass('bg-danger'); } else if (percentage > 15 && percentage <= 33) { $('#taskProgress').addClass('bg-warning'); } else if (percentage > 33 && percentage <= 70) { $('#taskProgress').addClass('bg-primary'); } else { $('#taskProgress').addClass('bg-success'); } } (function ($, window, i) { // Bootstrap 4 Modal $.fn.fireModal = function (options) { var options = $.extend({ size: 'modal-md', center: false, animation: true, title: 'Modal Title', closeButton: true, header: true, bodyClass: '', footerClass: '', body: '', buttons: [], autoFocus: true, created: function () { }, appended: function () { }, onFormSubmit: function () { }, modal: {} }, options); this.each(function () { i++; var id = 'fire-modal-' + i, trigger_class = 'trigger--' + id, trigger_button = $('.' + trigger_class); $(this).addClass(trigger_class); // Get modal body let body = options.body; if (typeof body == 'object') { if (body.length) { let part = body; body = body.removeAttr('id').clone().removeClass('modal-part'); part.remove(); } else { body = '
Modal part element not found!
'; } } // Modal base template var modal_template = '
' + '
' + '
' + '
' + ((options.header == true) ? '
' + '
' + options.title + '
' + ((options.closeButton == true) ? '
' + '
×
' + '
' : '') + '
' : '') + '
' + '
' + (options.buttons.length > 0 ? ' ' : '') + '
' + '
' + '
' + '
'; // Convert modal to object var modal_template = $(modal_template); // Start creating buttons from 'buttons' option var this_button; options.buttons.forEach(function (item) { // get option 'id' let id = "id" in item ? item.id : ''; // Button template this_button = '
' + item.text + '
'; // add click event to the button this_button = $(this_button).off('click').on("click", function () { // execute function from 'handler' option item.handler.call(this, modal_template); }); // append generated buttons to the modal footer $(modal_template).find('.modal-footer').append(this_button); }); // append a given body to the modal $(modal_template).find('.modal-body').append(body); // add additional body class if (options.bodyClass) $(modal_template).find('.modal-body').addClass(options.bodyClass); // add footer body class if (options.footerClass) $(modal_template).find('.modal-footer').addClass(options.footerClass); // execute 'created' callback options.created.call(this, modal_template, options); // modal form and submit form button let modal_form = $(modal_template).find('.modal-body form'), form_submit_btn = modal_template.find('button[type=submit]'); // append generated modal to the body $("body").append(modal_template); // execute 'appended' callback options.appended.call(this, $('#' + id), modal_form, options); // if modal contains form elements if (modal_form.length) { // if `autoFocus` option is true if (options.autoFocus) { // when modal is shown $(modal_template).on('shown.bs.modal', function () { // if type of `autoFocus` option is `boolean` if (typeof options.autoFocus == 'boolean') modal_form.find('input:eq(0)').focus(); // the first input element will be focused // if type of `autoFocus` option is `string` and `autoFocus` option is an HTML element else if (typeof options.autoFocus == 'string' && modal_form.find(options.autoFocus).length) modal_form.find(options.autoFocus).focus(); // find elements and focus on that }); } // form object let form_object = { startProgress: function () { modal_template.addClass('modal-progress'); }, stopProgress: function () { modal_template.removeClass('modal-progress'); } }; // if form is not contains button element if (!modal_form.find('button').length) $(modal_form).append('
'); // add click event form_submit_btn.on('click', function () { modal_form.submit(); }); // add submit event modal_form.submit(function (e) { // start form progress form_object.startProgress(); // execute `onFormSubmit` callback options.onFormSubmit.call(this, modal_template, e, form_object); }); } $(document).on("click", '.' + trigger_class, function () { $('#' + id).modal(options.modal); $('#' + id).addClass('show'); return false; }); $(document).on('click','#close-button',function(){ $('#' + id).removeClass('show'); $('body').removeClass('no-scroll'); }); }); } // Bootstrap Modal Destroyer $.destroyModal = function (modal) { modal.modal('hide'); modal.on('hidden.bs.modal', function () { }); } })(jQuery, this, 0); var Charts = (function () { // Variable var $toggle = $('[data-toggle="chart"]'); var mode = 'light';//(themeMode) ? themeMode : 'light'; var fonts = { base: 'Open Sans' } // Colors var colors = { gray: { 100: '#f6f9fc', 200: '#e9ecef', 300: '#dee2e6', 400: '#ced4da', 500: '#adb5bd', 600: '#8898aa', 700: '#525f7f', 800: '#32325d', 900: '#212529' }, theme: { 'default': '#172b4d', 'primary': '#5e72e4', 'secondary': '#f4f5f7', 'info': '#11cdef', 'success': '#2dce89', 'danger': '#f5365c', 'warning': '#fb6340' }, black: '#12263F', white: '#FFFFFF', transparent: 'transparent', }; // Methods // Chart.js global options function chartOptions() { // Options var options = { defaults: { global: { responsive: true, maintainAspectRatio: false, defaultColor: (mode == 'dark') ? colors.gray[700] : colors.gray[600], defaultFontColor: (mode == 'dark') ? colors.gray[700] : colors.gray[600], defaultFontFamily: fonts.base, defaultFontSize: 13, layout: { padding: 0 }, legend: { display: false, position: 'bottom', labels: { usePointStyle: true, padding: 16 } }, elements: { point: { radius: 0, backgroundColor: colors.theme['primary'] }, line: { tension: .4, borderWidth: 4, borderColor: colors.theme['primary'], backgroundColor: colors.transparent, borderCapStyle: 'rounded' }, rectangle: { backgroundColor: colors.theme['warning'] }, arc: { backgroundColor: colors.theme['primary'], borderColor: (mode == 'dark') ? colors.gray[800] : colors.white, borderWidth: 4 } }, tooltips: { enabled: true, mode: 'index', intersect: false, } }, doughnut: { cutoutPercentage: 83, legendCallback: function (chart) { var data = chart.data; var content = ''; data.labels.forEach(function (label, index) { var bgColor = data.datasets[0].backgroundColor[index]; content += '
'; content += '
'; content += label; content += '
'; }); return content; } } } } // yAxes Chart.scaleService.updateScaleDefaults('linear', { gridLines: { borderDash: [2], borderDashOffset: [2], color: (mode == 'dark') ? colors.gray[900] : colors.gray[300], drawBorder: false, drawTicks: false, drawOnChartArea: true, zeroLineWidth: 0, zeroLineColor: 'rgba(0,0,0,0)', zeroLineBorderDash: [2], zeroLineBorderDashOffset: [2] }, ticks: { beginAtZero: true, padding: 10, callback: function (value) { if (!(value % 10)) { return value } } } }); // xAxes Chart.scaleService.updateScaleDefaults('category', { gridLines: { drawBorder: false, drawOnChartArea: false, drawTicks: false }, ticks: { padding: 20 }, maxBarThickness: 10 }); return options; } // Parse global options function parseOptions(parent, options) { for (var item in options) { if (typeof options[item] !== 'object') { parent[item] = options[item]; } else { parseOptions(parent[item], options[item]); } } } // Push options function pushOptions(parent, options) { for (var item in options) { if (Array.isArray(options[item])) { options[item].forEach(function (data) { parent[item].push(data); }); } else { pushOptions(parent[item], options[item]); } } } // Pop options function popOptions(parent, options) { for (var item in options) { if (Array.isArray(options[item])) { options[item].forEach(function (data) { parent[item].pop(); }); } else { popOptions(parent[item], options[item]); } } } // Toggle options function toggleOptions(elem) { var options = elem.data('add'); var $target = $(elem.data('target')); var $chart = $target.data('chart'); if (elem.is(':checked')) { // Add options pushOptions($chart, options); // Update chart $chart.update(); } else { // Remove options popOptions($chart, options); // Update chart $chart.update(); } } // Update options function updateOptions(elem) { var options = elem.data('update'); var $target = $(elem.data('target')); var $chart = $target.data('chart'); // Parse options parseOptions($chart, options); // Toggle ticks toggleTicks(elem, $chart); // Update chart $chart.update(); } // Toggle ticks function toggleTicks(elem, $chart) { if (elem.data('prefix') !== undefined || elem.data('prefix') !== undefined) { var prefix = elem.data('prefix') ? elem.data('prefix') : ''; var suffix = elem.data('suffix') ? elem.data('suffix') : ''; // Update ticks $chart.options.scales.yAxes[0].ticks.callback = function (value) { if (!(value % 10)) { return prefix + value + suffix; } } // Update tooltips $chart.options.tooltips.callbacks.label = function (item, data) { var label = data.datasets[item.datasetIndex].label || ''; var yLabel = item.yLabel; var content = ''; if (data.datasets.length > 1) { content += '
' + label + '
'; } content += '
' + prefix + yLabel + suffix + '
'; return content; } } } // Events // Parse global options if (window.Chart) { parseOptions(Chart, chartOptions()); } // Toggle options $toggle.on({ 'change': function () { var $this = $(this); if ($this.is('[data-add]')) { toggleOptions($this); } }, 'click': function () { var $this = $(this); if ($this.is('[data-update]')) { updateOptions($this); } } }); // Return return { colors: colors, fonts: fonts, mode: mode }; })(); PurposeStyle = function () { var e = getComputedStyle(document.body); return { colors: { gray: {100: "#f6f9fc", 200: "#e9ecef", 300: "#dee2e6", 400: "#ced4da", 500: "#adb5bd", 600: "#8898aa", 700: "#525f7f", 800: "#32325d", 900: "#212529"}, theme: { primary: e.getPropertyValue("--primary") ? e.getPropertyValue("--primary").replace(" ", "") : "#6e00ff", info: e.getPropertyValue("--info") ? e.getPropertyValue("--info").replace(" ", "") : "#00B8D9", success: e.getPropertyValue("--success") ? e.getPropertyValue("--success").replace(" ", "") : "#36B37E", danger: e.getPropertyValue("--danger") ? e.getPropertyValue("--danger").replace(" ", "") : "#FF5630", warning: e.getPropertyValue("--warning") ? e.getPropertyValue("--warning").replace(" ", "") : "#FFAB00", dark: e.getPropertyValue("--dark") ? e.getPropertyValue("--dark").replace(" ", "") : "#212529" }, transparent: "transparent" }, fonts: {base: "Nunito"} } } var PurposeStyle = PurposeStyle(); // PLUS MINUS QUANTITY JS function wcqib_refresh_quantity_increments() { jQuery("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").each(function (a, b) { var c = jQuery(b); c.addClass("buttons_added"), c.children().first().before('
'), c.children().last().after('
') }) } String.prototype.getDecimals || (String.prototype.getDecimals = function () { var a = this, b = ("" + a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); return b ? Math.max(0, (b[1] ? b[1].length : 0) - (b[2] ? +b[2] : 0)) : 0 }), jQuery(document).ready(function () { wcqib_refresh_quantity_increments() }), jQuery(document).on("updated_wc_div", function () { wcqib_refresh_quantity_increments() }), jQuery(document).on("click", ".plus, .minus", function () { var a = jQuery(this).closest(".quantity").find('input[name="quantity"], input[name="quantity[]"]'), b = parseFloat(a.val()), c = parseFloat(a.attr("max")), d = parseFloat(a.attr("min")), e = a.attr("step"); b && "" !== b && "NaN" !== b || (b = 0), "" !== c && "NaN" !== c || (c = ""), "" !== d && "NaN" !== d || (d = 0), "any" !== e && "" !== e && void 0 !== e && "NaN" !== parseFloat(e) || (e = 1), jQuery(this).is(".plus") ? c && b >= c ? a.val(c) : a.val((b + parseFloat(e)).toFixed(e.getDecimals())) : d && b <= d ? a.val(d) : b > 0 && a.val((b - parseFloat(e)).toFixed(e.getDecimals())), a.trigger("change") }); $(document).on('click', 'input[name="quantity"], input[name="quantity[]"]', function (e) { // Allow: backspace, delete, tab, escape, enter and . if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 || // Allow: Ctrl+A (e.keyCode == 65 && e.ctrlKey === true) || // Allow: home, end, left, right (e.keyCode >= 35 && e.keyCode <= 39)) { // let it happen, don't do anything return; } // Ensure that it is a number and stop the keypress if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) { e.preventDefault(); } });
Simpan