Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. var autoVisitMatches = function(){
  2. var list = jQuery('.match_card:not(.visited)');
  3. if (list.length > 0) {
  4. var match = jQuery(list[0]);
  5. var link = match.find('.image_link');
  6. var username = link[0].pathname.split('/profile/')[1];
  7.  
  8. // Move to that person to watch the progress
  9. jQuery('html,body').animate({
  10. scrollTop: match.offset().top-80
  11. });
  12.  
  13. // Mark matches I have already looked at.
  14. match.addClass('visited').css('border', '5px solid yellow');
  15.  
  16. if (username.toLowerCase().indexOf("couple") > -1 ||
  17. username.toLowerCase().indexOf("c0uple") > -1 ||
  18. username.toLowerCase().indexOf("kouple") > -1) {
  19. // Skip if banned words in user name
  20. console.log(username+' looks to be a couple, skipping');
  21. match.addClass('visited').css('border', '5px solid red');
  22. match.parent()
  23. .find('.under_card')
  24. .css('border', '5px solid #ccd0d9')
  25. .css('opacity', '100');
  26. window.autoVisitRunning = false;
  27. return;
  28. } else if (match.find('.contact_bar').length > 0) {
  29. // Skip if already messaged
  30. console.log(username+' already contacted, skipping');
  31. match.addClass('visited').css('border', '5px solid #ccd0d9');
  32. } else if (match.find('.rating_liked').length > 0) {
  33. // Skip as we like that one already
  34. console.log(username+' already contacted, skipping');
  35. match.addClass('visited').css('border', '5px solid #ccd0d9');
  36. }
  37. else {
  38. // Open profile and close it after it loads
  39. console.log('Loading profile of '+username);
  40. var popup = window.open(link.attr('href'), '', 'width=,height=');
  41. popup.addEventListener('load', function(){
  42. match.addClass('visited').css('border', '5px solid green');
  43. popup.close();
  44. });
  45. }
  46.  
  47. window.autoVisitTimer = setTimeout(autoVisitMatches, 2000);
  48. } else {
  49. console.log('Visiting matches complete');
  50. }
  51. };
  52. window.autoVisitRunning = true;
  53. window.autoVisitTimer = setTimeout(autoVisitMatches, 50);
  54.  
  55. // Click on the background to stop/start auto visit
  56. jQuery('#main_content').click(function() {
  57. if (window.autoVisitRunning == true) {
  58. console.log('Stop Auto Visit');
  59. delete window.autoVisitRunning;
  60. clearTimeout(window.autoVisitTimer);
  61. setTimeout(function() {
  62. window.autoVisitRunning = false;
  63. }, 3000);
  64. } else if (window.autoVisitRunning == false) {
  65. window.autoVisitRunning = true;
  66. console.log('Restart Auto Visit');
  67. window.autoVisitTimer = setTimeout(autoVisitMatches, 50);
  68. }
  69. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement