AlkanFan

Untitled

May 8th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. // ==UserScript==
  2. // @name mmmturkeybacon Logged Out Alert
  3. // @author mmmturkeybacon
  4. // @description Alerts you if you've been logged out of mturk.
  5. // Your dashboard page must remain open in a tab
  6. // for this script to work.
  7. // @namespace http://userscripts.org/users/523367
  8. // @match https://www.mturk.com/mturk/dashboard
  9. // @require http://code.jquery.com/jquery-latest.min.js
  10. // @downloadURL http://userscripts.org/scripts/source/467053.user.js
  11. // @updateURL http://userscripts.org/scripts/source/467053.meta.js
  12. // @version 1.0
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. var load_busy = false;
  17.  
  18. // 61 is prime so it's less likely to cause a conflict with page monitor
  19. // because it's not a multiple of common delays
  20. var waitforit = 61; // seconds delay between logged in check
  21.  
  22. function check_logged_in()
  23. {
  24. if (load_busy == false)
  25. {
  26. load_busy = true;
  27. $.ajax({
  28. url: 'https://www.mturk.com/mturk/dashboard',
  29. type: 'GET',
  30. success: function()
  31. {
  32. load_busy = false;
  33. setTimeout(check_logged_in, waitforit*1000);
  34. },
  35. error: function()
  36. {
  37. load_busy = false;
  38. alert('Are you signed in?');
  39. setTimeout(check_logged_in, waitforit*1000);
  40. }
  41. });
  42. }
  43. else
  44. {
  45. setTimeout(check_logged_in, 1000);
  46. }
  47. }
  48.  
  49. check_logged_in();
Advertisement
Add Comment
Please, Sign In to add comment