Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.53 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Pinterest 2.0
  3. // @author Eisenpower
  4. // @version 1
  5. // @include https://sofia*.pinadmin.com/*
  6. // @include https://api.pinterest.com/*
  7. // @require https://code.jquery.com/jquery-latest.min.js
  8. // @namespace http://tampermonkey.net/
  9. // @description Fixed some stuff
  10. // ==/UserScript==
  11.  
  12.  
  13. $(document).ready(function(){
  14. var pin_interval = setInterval(function(){ pin_check(); }, 250);
  15. var hide_instructions = setInterval(function(){ instructions_check(); }, 250);
  16. var color_change = setInterval(function(){color_changer();}, 250);
  17.  
  18.  
  19. function instructions_check(){
  20. if ( $('h5:contains(Press ? to see some handy shortcuts used to navigate the assignment)').length ){
  21.  
  22. document.querySelector(`h3[class="panel-title"]`).click();
  23. clearInterval(hide_instructions);
  24. }
  25. }
  26.  
  27.  
  28. function color_changer(){
  29. if ( $('a:contains(Task 18/20)').length || $('a:contains(Task 8/10)').length ){
  30. document.getElementsByClassName('panel-body')[1].style.backgroundColor = "yellow";
  31. document.getElementsByClassName('page-header')[0].style.backgroundColor = "yellow";
  32. }
  33. else if ( $('a:contains(Task 19/20)').length || $('a:contains(Task 9/10)').length ){
  34. document.getElementsByClassName('panel-body')[1].style.backgroundColor = "orange";
  35. document.getElementsByClassName('page-header')[0].style.backgroundColor = "orange";
  36. }
  37. else if ( $('a:contains(Task 20/20)').length || $('a:contains(Task 10/10)').length ){
  38. document.getElementsByClassName('panel-body')[1].style.backgroundColor = "Crimson";
  39. document.getElementsByClassName('page-header')[0].style.backgroundColor = "Crimson";
  40. }
  41. }
  42.  
  43. function pin_check () {
  44. if ( $('h4:contains(No Tasks Available)').length ) {
  45. // Refresh if No Tasks
  46. window.location.reload();
  47. }
  48. else if ( $('h4:contains(Loading)').length ) {
  49. return;
  50. }
  51. else if ( $('h4:contains(Slow Down!)').length ) {
  52. // Refresh if Slow Down Message
  53. setTimeout(function() {
  54. window.location.reload();
  55. }, 1000*10);
  56. }
  57.  
  58. else if ( $('h1:contains(Thanks for your help)').length ) {
  59. // Clicks Reload Button
  60. setInterval(hide_instructions);
  61. setTimeout(function() {
  62. $('button.btn.btn-default').click();
  63. }, 250);
  64. }
  65.  
  66. }
  67.  
  68.  
  69. $(document).keypress(function(event){
  70. if (String.fromCharCode(event.which) == 1){
  71. // 1: Clicks 1st Radio and Advances
  72. $('input[type=radio]')[0].click();
  73. $('button.btn.btn-lg.btn-primary').click();
  74. } else if (String.fromCharCode(event.which) == 2){
  75. // 2: Clicks 2nd Radio and Advances
  76. $('input[type=radio]')[1].click();
  77. $('button.btn.btn-lg.btn-primary').click();
  78. } else if (String.fromCharCode(event.which) == 3){
  79. // 3: Clicks 3rd Radio and Advances
  80. $('input[type=radio]')[2].click();
  81. $('button.btn.btn-lg.btn-primary').click();
  82. } else if (String.fromCharCode(event.which) == 4){
  83. // 4: Clicks 4th Radio and Advances
  84. $('input[type=radio]')[3].click();
  85. $('button.btn.btn-lg.btn-primary').click();
  86. }else if (String.fromCharCode(event.which) == 5){
  87. // 5: Clicks 5th Radio and Advances
  88. $('input[type=radio]')[4].click();
  89. $('button.btn.btn-lg.btn-primary').click();
  90. }else if (String.fromCharCode(event.which) == 6){
  91. // 6: Clicks 6th Radio and Advances
  92. $('input[type=radio]')[5].click();
  93. $('button.btn.btn-lg.btn-primary').click();
  94. }else if (String.fromCharCode(event.which) == 7){
  95. // 7: Clicks 7th Radio and Advances
  96. $('input[type=radio]')[6].click();
  97. $('button.btn.btn-lg.btn-primary').click();
  98. }else if (String.fromCharCode(event.which) == 8){
  99. // 8: Clicks 8th Radio and Advances
  100. $('input[type=radio]')[7].click();
  101. $('button.btn.btn-lg.btn-primary').click();
  102. }else if (String.fromCharCode(event.which) == 9){
  103. // 9: Clicks 9th Radio and Advances
  104. $('input[type=radio]')[8].click();
  105. $('button.btn.btn-lg.btn-primary').click();
  106. // ` or Del will go back one pin
  107. }else if (event.keyCode === 110 || event.keyCode === 192){
  108. }
  109.  
  110. });
  111. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement