renix1

girl watcher badoo

Apr 20th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class People {
  2.     constructor () {
  3.         let stored = JSON.parse(localStorage.getItem('people'));
  4.         stored = typeof stored === 'object' ? true : this.init();
  5.     }
  6.  
  7.     init () {
  8.         let empty = [];
  9.         localStorage.setItem('people', JSON.stringify(empty));
  10.     }
  11.  
  12.     load () {
  13.         return JSON.parse(localStorage.getItem('people'));
  14.     }
  15.  
  16.     save (person) {
  17.         let stored = this.load();
  18.         stored.unshift(person);
  19.         localStorage.setItem('people', JSON.stringify(stored));
  20.     }
  21.  
  22.     view () {
  23.         console.table(this.load());
  24.     }
  25. }
  26.  
  27. class Profile {
  28.     constructor() {
  29.         const elementDescription = document.querySelector('.profile-section__txt-line') === null ? document.createElement("p.profile-section__txt-line") : document.querySelector('.profile-section__txt-line');
  30.         const number = elementDescription.innerHTML === null ? '' : elementDescription.innerHTML.match(/\d+/g);
  31.         this.description = elementDescription === null ? '' : elementDescription.innerHTML;
  32.         this.number = number === null ? false : parseInt(number.join(''));
  33.         this.words_not_allowed = [''];
  34.     }
  35.  
  36.     rateProfile () {
  37.         if (this.checkDescription() === true) {
  38.             let person = new People();
  39.             person.save(this);
  40.             this.accept();
  41.             return true;
  42.         } else {
  43.             this.reject();
  44.             return false;
  45.         }
  46.     }
  47.  
  48.     checkDescription() {
  49.         const description = this.description;
  50.         const result = this.words_not_allowed.map(word => description.includes(word) ? true : false );
  51.         return result.includes(true) ? false : true;
  52.     }
  53.  
  54.     accept() {
  55.         document.querySelector('.profile-action--yes').click();
  56.     }
  57.  
  58.     reject() {
  59.         document.querySelector('.profile-action--no').click();
  60.     }
  61. }
  62.  
  63. class Bot {
  64.     constructor () {
  65.         this.enabled = false;
  66.         this.operation = null;
  67.     }
  68.  
  69.     checkMatch () {
  70.         const profile = new Profile();
  71.         profile.rateProfile();
  72.     }
  73.  
  74.     toggle () {
  75.         if (this.enabled === false) {
  76.             this.operation = setInterval(this.checkMatch, 250);
  77.             this.enabled = true;
  78.         } else {
  79.             const people = new People();
  80.             const stored = people.load();
  81.             clearInterval(this.operation);
  82.             this.enabled = false;
  83.             alert(`Demos ${stored.length} like no total.`);
  84.         }
  85.     }
  86. }
  87.  
  88. const bot = new Bot();
  89.  
  90. document.body.addEventListener('mousedown', function (e) {
  91.     if (e.which === 2) {
  92.         e.preventDefault();
  93.         bot.toggle();
  94.     }
  95. });
Add Comment
Please, Sign In to add comment