NikolayBezay

GolanTelecom savePhoneNumber.

Aug 3rd, 2021 (edited)
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.06 KB | None | 0 0
  1. <script>
  2.     (function() {
  3.         function checkPhoneInput() {
  4.             var phoneNumberInp1 = document.querySelector('#phoneNumberCtrl');
  5.             if (phoneNumberInp1 && !window.phoneNumberInpExist) {
  6.                window.phoneNumberInpExist = true;
  7.                 observer.disconnect();
  8.                 phoneNumberInp1.addEventListener('input', function() {
  9.                     window.localStorage.setItem('ADORIC_userPhone', phoneNumberInp1.value);
  10.                 });
  11.             }
  12.         }
  13.         var targetNode = document.querySelector('body');
  14.         var config = {
  15.             attributes: true,
  16.             childList: true,
  17.             subtree: true
  18.         };
  19.         var callback = function(mutationsList, observer) {
  20.             for (var i=0; i < mutationsList.length; i++) {
  21.                if (mutationsList[i].type === 'childList') {
  22.                    checkPhoneInput();
  23.                }
  24.            }
  25.        };
  26.        var observer = new MutationObserver(callback);
  27.        observer.observe(targetNode, config);
  28.    })();
  29. </script>
Add Comment
Please, Sign In to add comment