var phone = "628119012099";var message = "Saya ingin order ...";var size = '60px';var backgroundColor = '#25D366';var position = 'right';var headerColor = '#128c7e';var headerTitle = 'Kontak kami via whatsapp !';var buttonImage = 'https://whatsapp-notifications.magecomp.us/assets/front/img/btn4.png';var popupMessage = "Hi mixy, Ada yang bisa kami bantu?";var image = "https://whatsapp-notifications.magecomp.us/assets/front/img/btn4.png";function waFloatBtn(){ function addCssHtml(){ var css = '.floating-wpp{position:fixed;bottom:15px;left:15px;font-size:14px;transition:bottom .2s}.floating-wpp .floating-wpp-button{position:relative;border-radius:50%;box-shadow:1px 1px 4px rgba(60,60,60,.4);transition:box-shadow .2s;cursor:pointer;overflow:hidden}.floating-wpp .floating-wpp-button img,.floating-wpp .floating-wpp-button svg{position:absolute;width:100%;height:auto;object-fit:cover;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}.floating-wpp:hover{bottom:17px}.floating-wpp:hover .floating-wpp-button{box-shadow:1px 2px 8px rgba(60,60,60,.4)}.floating-wpp .floating-wpp-popup{border-radius:6px;background-color:#E5DDD5;position:absolute;overflow:hidden;padding:0;box-shadow:1px 2px 8px rgba(60,60,60,.25);width:0;height:0;bottom:0;opacity:0;transition:bottom .1s ease-out,opacity .2s ease-out;transform-origin:bottom}.floating-wpp .floating-wpp-popup.active{padding:0 12px 12px;width:260px;height:auto;bottom:82px;opacity:1}.floating-wpp .floating-wpp-popup .floating-wpp-message{background-color:#fff;padding:8px;border-radius:0 5px 5px;box-shadow:1px 1px 1px rgba(0,0,0,.15);opacity:0;transition:opacity .2s}.floating-wpp .floating-wpp-popup.active .floating-wpp-message{opacity:1;transition-delay:.2s}.floating-wpp .floating-wpp-popup .floating-wpp-head{text-align:right;color:#fff;margin:0 -15px 10px;padding:6px 12px;display:flex;justify-content:space-between;cursor:pointer}.floating-wpp .floating-wpp-input-message{background-color:#fff;margin:10px -15px -15px;padding:0 15px;display:flex;align-items:center}.floating-wpp .floating-wpp-input-message textarea{border:1px solid #ccc;border-radius:4px;box-shadow:none;padding:8px;margin:10px 0;width:100%;max-width:100%;font-family:inherit;font-size:inherit;resize:none}.floating-wpp .floating-wpp-btn-send{margin-left:12px;font-size:0;cursor:pointer}'; head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); head.appendChild(style); style.type = 'text/css'; if (style.styleSheet){ // This is required for IE8 and below. style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } $('
').prependTo('body'); } addCssHtml(); (function ($) { $.fn.floatingWhatsApp = function (options) { var settings = $.extend({ phone: '', message: '', size: '72px', backgroundColor: '#25D366', position: 'left', popupMessage: '', showPopup: false, showOnIE: true, autoOpenTimeout: 0, headerColor: '#128C7E', headerTitle: 'WhatsApp Chat', zIndex: 0, buttonImage: '', }, options); var isMobile = mobilecheck(); //set the .floating-wpp default class this.addClass('floating-wpp'); //#region jQuery Elements var $button = $(document.createElement('div')); var $buttonImageContainer = $(document.createElement('div')); var $popup = $(document.createElement('div')); var $header = $(document.createElement('div')); var $popupMessage = $(document.createElement('div')); var $btnSend = $(document.createElement('div')); var $inputMessage = $(document.createElement('div')); //#endregion //#region Main Button $buttonImageContainer.addClass('floating-wpp-button-image'); $button.addClass('floating-wpp-button') .append($(settings.buttonImage)) .css({ 'width': settings.size, 'height': settings.size, 'background-color': settings.backgroundColor }); if (!isInternetExplorer() || settings.showOnIE) { $button.append($buttonImageContainer).appendTo(this); } $button.on('click', function () { if (isMobile && settings.showPopup) { openPopup(); } else { sendWhatsappMessage(); } }); //#endregion //#region Fake Chat Pop-up if (settings.showPopup) { var $textarea = $(document.createElement('textarea')); var $closeBtn = $(document.createElement('strong')); var $sendIcon = $('') $popup.addClass('floating-wpp-popup'); $header.addClass('floating-wpp-head'); $popupMessage.addClass('floating-wpp-message'); $inputMessage.addClass('floating-wpp-input-message'); $btnSend.addClass('floating-wpp-btn-send'); $popupMessage.text(settings.popupMessage); $textarea.val(settings.message); if (!settings.popupMessage) { $popupMessage.hide(); } $header.append('' + settings.headerTitle + '', $closeBtn) .css('background-color', settings.headerColor); $btnSend.append($sendIcon); $inputMessage.append($textarea, $btnSend); $closeBtn.addClass('close').html('×'); $popup.append( $header, $popupMessage, $inputMessage) .appendTo(this); $popupMessage.click(function () { //sendWhatsappMessage(); }); $closeBtn.click(function () { //popup.removeClass('active'); }); $header.click(function () { $popup.removeClass('active'); }); $textarea.keypress(function (event) { settings.message = $(this).val(); if (event.keyCode == 13 && !event.shiftKey && !isMobile) { event.preventDefault(); $btnSend.click(); } }); $btnSend.click(function () { settings.message = $textarea.val(); sendWhatsappMessage(); }); this.mouseenter(function () { openPopup(); }); if (settings.autoOpenTimeout > 0) { setTimeout(function () { openPopup(); }, settings.autoOpenTimeout); } function openPopup() { if (!$popup.hasClass('active')) { $popup.addClass('active'); $textarea.focus(); } } } if (settings.zIndex) { // $(this).css('z-index', settings.zIndex); $(this).css('z-index','7878784545454'); } if (settings.position === 'right') { this.css({ left: 'auto', right: '15px' }); $popup.css('right', '0'); } //#endregion function cleanPhoneNumber(input) { // Remove all non-numeric characters let cleaned = input.replace(/[^\d]/g, ""); return cleaned; } function sendWhatsappMessage() { var apilink = 'https://'; if(navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { apilink+='wa.me/'+ cleanPhoneNumber(settings.phone); } else { apilink += isMobile ? 'api' : 'web'; apilink += '.whatsapp.com/send?phone=' + settings.phone + '&text=' + encodeURI(settings.message); } window.open(apilink); } } function isInternetExplorer() { var userAgent = window.navigator.userAgent; return userAgent.indexOf("MSIE") >= 0 || userAgent.match(/Trident.*rv\:11\./); } function mobilecheck() { var check = false; (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera); return check; } }(jQuery)); $(function () { jQuery('#McWaBtn').floatingWhatsApp({ phone: phone, popupMessage: popupMessage, message: message, size:size, showPopup: true, showOnIE: false, headerTitle: headerTitle, headerColor: headerColor, backgroundColor:'#fff', position : position, buttonImage: '', zIndex: 1000, }); }); } if(typeof jQuery == 'undefined'){ var headTag = document.getElementsByTagName("head")[0]; var jqTag = document.createElement('script'); jqTag.type = 'text/javascript'; jqTag.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js'; jqTag.onload = waFloatBtn; headTag.appendChild(jqTag); }else{ waFloatBtn(); }