Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. //Config
  3. var searchString = "Scandinavian Airlines";
  4.  
  5.  
  6. //[CODE]
  7.  
  8.  
  9. searchString.toLowerCase();
  10.  
  11. //finds us the SearchField-Element
  12. var src =  document.getElementsByClassName("search-global-typeahead__input")[0];
  13.  
  14. //gives us the current Focussed element (e.g. the textCursor is blinking and active in a TextField)
  15. var focussed = document.activeElement;
  16.  
  17.  
  18.  
  19. //Enter SrcString into SrcField
  20. src.value = searchString;
  21.  
  22. //Give the field Focus afterwards so linkedin thinks we aren't bots (cause focus usually only happens when you click at something, or when the page is loaded it is given intentionally to e.g. SearchFields on many sites - in this case it isn't)
  23. src.focus();
  24.  
  25.  
  26. // getting the Form-Element (searchField and button are inside there, but we can just submit() the Form)
  27. var srcFrm = document.getElementById("extended-nav-search");
  28.  
  29. //Todays time -> as object (usually is an unsigned long value giving the CPU-ticks since 1.1.1970 at 00:00:00 o'clock -- Unixtime)
  30. var today = new Date();
  31.  
  32. //only if the secondcounter of current time is even we will submit our javascript [blocks multiple reloads of the script - everytime it opens the page - and that is what it does when you use the searchform]
  33. if (today.getSeconds() % 2 == 0)
  34. {
  35.     //submit the Form containing the searchField
  36.     srcFrm.submit();
  37.    
  38.     //wait 400 milliseconds
  39.     setTimeout(function(){
  40.     // do nothing meanwhile
  41.     }, 400);
  42. };
  43.  
  44. //----------------------------------------------------------------------s9ruz---
  45. //CYRUSTASKS:
  46.  
  47. //A)
  48. // from the current page, get the element of the button "PEOPLE" - in case you need to go there
  49. // click the button with e.g. peopleElement.click()
  50.  
  51. //B)
  52. //  if you already have the people - then just make JS open a new tab and click on 'connect' if present (you do this by altering the script - IF you are on a Person's homepage (what elements are just there?!
  53. //  ) -> don't execute our first searchBox-script but execute the personScript
  54. //  if you pressed Connect or if "Connect" isn't on that website -> close the Tab send  (CTRL + W) to the window (google....)
  55.  
  56. //C
  57. // i dunno how - but somehow you have to solve the following problem:
  58. // limit the number of tabs opened - otherwise it can open more and more people tabs
  59. // Hint: first script should only add new Tabs if count is < x
  60. //       let it wait in a loop if maxCount is reached
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. //EndAlert - signaling the script had no errors and reached the end
  68. alert("end");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement