1// Telefon numarası maskeleme - Cleave.js ile 2// Kullanım: <input data-phone-mask> 3// Görüntü: 0546 809 53 53 4// Gönderilen deÄer: 0546 809 53 53 â Backend PhoneHelper.FormatForLogo ile 05468095353'e çevirir 5document.addEventListener('DOMContentLoaded', function () { 6 document.querySelectorAll('[data-phone-mask]').forEach(function (input) { 7 if (typeof Cleave === 'undefined') return; 8 9 var cleaveInstance = new Cleave(input, { 10 blocks: [4, 3, 2, 2], 11 delimiter: ' ', 12 numericOnly: true 13 }); 14 15 // Cleave instance'ını element'e baÄla (dıÅarıdan eriÅim için) 16 input._cleaveInstance = cleaveInstance; 17 }); 18}); 19 20// Telefon mask'lı input'a deÄer set etmek için yardımcı fonksiyon 21// Kullanım: setPhoneValue("#Telefon", "05551234567") veya setPhoneValue("#Telefon", "+90 555 123 45 67") 22function setPhoneValue(selector, value) { 23 var input = document.querySelector(selector); 24 if (!input) return; 25 var digits = (value || '').replace(/\D/g, ''); 26 // Ãlke kodunu temizle, her zaman '0' ile baÅlayan 11 haneye normalize et 27 if (digits.startsWith('90') && digits.length === 12) { 28 digits = '0' + digits.substring(2); 29 } else if (digits.length === 10) { 30 digits = '0' + digits; 31 } 32 if (input._cleaveInstance) { 33 input._cleaveInstance.setRawValue(digits); 34 } else { 35 input.value = digits; 36 } 37}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.