Last active
April 20, 2017 11:01
-
-
Save maichanchinh/16d1f6b4cfca52bf762cf4af5a56878c to your computer and use it in GitHub Desktop.
From gọi lại số điện thoại
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <meta charset="utf-8"> | |
| <!-- | |
| Hướng dẫn sử dụng các loại form chèn vào LadingPage | |
| --> | |
| <!-- | |
| Bước 1 | |
| Chèn phần này vào thẻ Head --> | |
| <style type="text/css"> | |
| body{background: #249249} | |
| .contact_form { | |
| max-width: 250px; | |
| } | |
| .contact_form .form_title { | |
| font-size: 17px; | |
| text-align: center; | |
| -o-object-fit: cover; | |
| object-fit: cover; | |
| font-family: "Open Sans", sans-serif; | |
| color: white; | |
| font-weight: 400; | |
| line-height: 21px; | |
| } | |
| .contact_form .form_box { | |
| display: inline-block; | |
| width: 100%; | |
| } | |
| .contact_form .form_phone_number { | |
| float: left; | |
| height: 35px; | |
| font-size: 14px; | |
| width: 60%; | |
| padding: 0 0 0 5px; | |
| border: none; | |
| } | |
| .contact_form button.submit_btn { | |
| float: left; | |
| width: 40%; | |
| font-size: 14px; | |
| height: 35px; | |
| border: none; | |
| border-radius: 10px; | |
| background: #FF9900; | |
| margin-left: -10px; | |
| } | |
| </style> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" /> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script> | |
| <!-- Bước 2 | |
| Chèn phần này vào cuối trang trước thẻ </body> --> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> | |
| <script type="text/javascript"> | |
| var jW = $.noConflict(); | |
| var dateFormat=function(){var t=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,e=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,a=/[^-+\dA-Z]/g,m=function(t,e){for(t=String(t),e=e||2;t.length<e;)t="0"+t;return t};return function(d,n,r){var y=dateFormat;if(1!=arguments.length||"[object String]"!=Object.prototype.toString.call(d)||/\d/.test(d)||(n=d,d=void 0),d=d?new Date(d):new Date,isNaN(d))throw SyntaxError("invalid date");n=String(y.masks[n]||n||y.masks["default"]),"UTC:"==n.slice(0,4)&&(n=n.slice(4),r=!0);var s=r?"getUTC":"get",i=d[s+"Date"](),o=d[s+"Day"](),u=d[s+"Month"](),M=d[s+"FullYear"](),l=d[s+"Hours"](),T=d[s+"Minutes"](),h=d[s+"Seconds"](),c=d[s+"Milliseconds"](),g=r?0:d.getTimezoneOffset(),S={d:i,dd:m(i),ddd:y.i18n.dayNames[o],dddd:y.i18n.dayNames[o+7],m:u+1,mm:m(u+1),mmm:y.i18n.monthNames[u],mmmm:y.i18n.monthNames[u+12],yy:String(M).slice(2),yyyy:M,h:l%12||12,hh:m(l%12||12),H:l,HH:m(l),M:T,MM:m(T),s:h,ss:m(h),l:m(c,3),L:m(c>99?Math.round(c/10):c),t:12>l?"a":"p",tt:12>l?"am":"pm",T:12>l?"A":"P",TT:12>l?"AM":"PM",Z:r?"UTC":(String(d).match(e)||[""]).pop().replace(a,""),o:(g>0?"-":"+")+m(100*Math.floor(Math.abs(g)/60)+Math.abs(g)%60,4),S:["th","st","nd","rd"][i%10>3?0:(i%100-i%10!=10)*i%10]};return n.replace(t,function(t){return t in S?S[t]:t.slice(1,t.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"},dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},Date.prototype.format=function(t,e){return dateFormat(this,t,e)}; | |
| function getInfoDevice(){ | |
| var info = ""; | |
| if (typeof navigator.userAgent != "undefined") { info = info + navigator.userAgent;} | |
| if (typeof navigator.vendor != "vendor") {info = info + "|" + navigator.vendor;} | |
| if (typeof navigator.appCodeName != "undefined") {info = info + "|" + navigator.appCodeName;} | |
| if (typeof navigator.platform != "undefined") {info = info + "|" + navigator.platform;} | |
| return info; | |
| } | |
| //setting Form | |
| var typePage = "C3COD"; | |
| var landingPage = "valentine2017"; | |
| //default val From | |
| var checkClickSubmit = true; | |
| var dateNow = new Date(); | |
| var strDate = dateNow.format("yyyy-mm-dd HH:MM"); | |
| var link_thankyou = 'http://thankyou.wefit.vn'; | |
| var full_url = window.location.href; | |
| var filterEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; | |
| var filterPhone = /^\+?\d{1,3}?[- .]?\(?(?:\d{2,3})\)?[- .]?\d\d\d[- .]?\d\d\d$/g; | |
| jW(document).ready(function($) { | |
| "use strict"; | |
| $.getParamByUrl = function(name) { | |
| var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); | |
| if (results == null) { | |
| return null; | |
| } else { | |
| return results[1] || 0; | |
| } | |
| } | |
| $(".contact_form").on('submit', function(e) { | |
| e.preventDefault(); | |
| if (checkClickSubmit) { | |
| strDate = dateNow.format("yyyy-mm-dd HH:MM"); | |
| var lp = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname; | |
| $(this).find('.utm_source').val($.getParamByUrl('utm_source')); | |
| $(this).find('.utm_medium').val($.getParamByUrl('utm_medium')); | |
| $(this).find('.utm_campaign').val($.getParamByUrl('utm_campaign')); | |
| $(this).find('.utm_full_url').val(full_url); | |
| var city = $(this).find('.city').val(); | |
| var period = $(this).find('.period').val(); | |
| var dataFrom = { | |
| "contact": { | |
| "utm_source": $.getParamByUrl('utm_source'), | |
| "utm_medium": $.getParamByUrl('utm_medium'), | |
| "utm_campaign": $.getParamByUrl('utm_campaign'), | |
| "utm_full_url": full_url, | |
| "phone": $(this).find('.phone').val(), | |
| "date": strDate.toString(), | |
| "InfoDevice": getInfoDevice(), | |
| "lp": lp, | |
| "city": city | |
| } | |
| }; | |
| if ($(this).find('.phone').val().length > 5) { | |
| $.ajax({ | |
| type: "POST", | |
| data: dataFrom['contact'], | |
| cache: false, | |
| url: "https://script.google.com/macros/s/AKfycbwJTGdouPvhcCdE-eH8ChvMHHwkjezSS3tJhzzNl7ub899cRp0/dev", | |
| success: function(data) { | |
| if (data.result == 'success') { | |
| var now_Date = new Date(); | |
| var hours_now = now_Date.getUTCHours() + 7; | |
| var mgs_alert = "WeFit sẽ gọi ngay cho bạn"; | |
| if(hours_now >= 8 && hours_now <= 20){ | |
| mgs_alert = "WeFit sẽ gọi ngay cho bạn"; | |
| }else{ | |
| mgs_alert = "Giờ cũng đã muộn rồi, sáng mai WeFit sẽ gọi lại ngay cho bạn" | |
| } | |
| checkClickSubmit = true; | |
| swal({ | |
| title:"Cám ơn bạn!", | |
| text:mgs_alert, | |
| type: "success", | |
| allowOutsideClick:true, | |
| showConfirmButton:false | |
| }) | |
| }else{ | |
| checkClickSubmit = true; | |
| } | |
| } | |
| }); | |
| checkClickSubmit = false; | |
| }else{ | |
| checkClickSubmit = true; | |
| } | |
| } | |
| }) | |
| }); | |
| </script> | |
| <!-- Bước 3 | |
| Chọn form tương ứng để chèn vào page | |
| --> | |
| <!-- Form Ha Noi --> | |
| <form id="contact_form" method="post" class="pix_form contact_form" pix-confirm="hidden_pix_4"> | |
| <div class="result"></div> | |
| <h3 class="form_title">Bạn muốn nghe tư vấn ngay? <br /> | |
| WeFit sẽ gọi ngay cho bạn</h3> | |
| <input type="hidden" name="send" value="Y"> | |
| <input type="hidden" name="ok" value="no"> | |
| <input type="hidden" class="bx-input utm_source" name="utm_source" value="" /> | |
| <input type="hidden" class="bx-input utm_medium" name="utm_medium" value="" /> | |
| <input type="hidden" class="bx-input utm_campaign" name="utm_campaign" value="" /> | |
| <input type="hidden" class="bx-input utm_full_url" name="utm_full_url" value="" /> | |
| <input type="hidden" class="bx-input city" name="city" value="HN" /> | |
| <div class="form_box"> | |
| <input type="text" name="phone" placeholder="Nhập số điện thoại" class="form_phone_number phone"> | |
| <button type="submit" class="submit_btn"> | |
| GỌI NGAY | |
| </button> | |
| <div> | |
| </form> | |
| <!-- Form Sai Gon--> | |
| <form id="contact_form" method="post" class="pix_form contact_form" pix-confirm="hidden_pix_4"> | |
| <div class="result"></div> | |
| <h3 class="form_title">Bạn muốn nghe tư vấn ngay? <br /> | |
| WeFit sẽ gọi ngay cho bạn</h3> | |
| <input type="hidden" name="send" value="Y"> | |
| <input type="hidden" name="ok" value="no"> | |
| <input type="hidden" class="bx-input utm_source" name="utm_source" value="" /> | |
| <input type="hidden" class="bx-input utm_medium" name="utm_medium" value="" /> | |
| <input type="hidden" class="bx-input utm_campaign" name="utm_campaign" value="" /> | |
| <input type="hidden" class="bx-input utm_full_url" name="utm_full_url" value="" /> | |
| <input type="hidden" class="bx-input city" name="city" value="SaiGon" /> | |
| <div class="form_box"> | |
| <input type="text" name="phone" placeholder="Nhập số điện thoại" class="form_phone_number phone"> | |
| <button type="submit" class="submit_btn"> | |
| GỌI NGAY | |
| </button> | |
| <div> | |
| </form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment