Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- /*
- The code has to work only from Adoric campaigns together with the relevant HTML elements that exist as an invisible form.
- The self variable is also available only from the Adoric environment and has dynamic data with relevant selector for the campaign.
- */
- (function() {
- var form = document.querySelector('.' + self.identifier + ' FORM');
- function sendAdoricForm() {
- var number = '0' + window.localStorage.getItem('isWeakLogin');
- if (number == '0' || number.length !== 10) return false;
- var allAdoricPhonesSubmited = window.sessionStorage.getItem('allAdoricPhonesSubmited');
- if (allAdoricPhonesSubmited) {
- allAdoricPhonesSubmited = allAdoricPhonesSubmited.split(',');
- } else {
- allAdoricPhonesSubmited = [];
- }
- if (allAdoricPhonesSubmited.includes(number)) {
- return false;
- } else {
- allAdoricPhonesSubmited.push(number);
- window.sessionStorage.setItem('allAdoricPhonesSubmited', allAdoricPhonesSubmited.toString());
- }
- console.log("SENDING LEAD", number, form);
- form.querySelector('INPUT[name="phone"]').value = number;
- form.querySelector('INPUT[name="submit"]').click();
- }
- form.addEventListener('submit', function() {
- console.log('Form submitted...');
- fbq('trackCustom', 'Adoric');
- });
- var i = 100;
- function waitForAcceptButtonAvailable() {
- var userPhone = window.localStorage.getItem('isWeakLogin');
- if (userPhone) {
- sendAdoricForm();
- } else if (i > 0) {
- i = i - 1;
- setTimeout(waitForAcceptButtonAvailable, 100);
- }
- }
- waitForAcceptButtonAvailable();
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement