Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Config
- var searchString = "Scandinavian Airlines";
- //[CODE]
- searchString.toLowerCase();
- //finds us the SearchField-Element
- var src = document.getElementsByClassName("search-global-typeahead__input")[0];
- //gives us the current Focussed element (e.g. the textCursor is blinking and active in a TextField)
- var focussed = document.activeElement;
- //Enter SrcString into SrcField
- src.value = searchString;
- //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)
- src.focus();
- // getting the Form-Element (searchField and button are inside there, but we can just submit() the Form)
- var srcFrm = document.getElementById("extended-nav-search");
- //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)
- var today = new Date();
- //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]
- if (today.getSeconds() % 2 == 0)
- {
- //submit the Form containing the searchField
- srcFrm.submit();
- //wait 400 milliseconds
- setTimeout(function(){
- // do nothing meanwhile
- }, 400);
- };
- //----------------------------------------------------------------------s9ruz---
- //CYRUSTASKS:
- //A)
- // from the current page, get the element of the button "PEOPLE" - in case you need to go there
- // click the button with e.g. peopleElement.click()
- //B)
- // 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?!
- // ) -> don't execute our first searchBox-script but execute the personScript
- // if you pressed Connect or if "Connect" isn't on that website -> close the Tab send (CTRL + W) to the window (google....)
- //C
- // i dunno how - but somehow you have to solve the following problem:
- // limit the number of tabs opened - otherwise it can open more and more people tabs
- // Hint: first script should only add new Tabs if count is < x
- // let it wait in a loop if maxCount is reached
- //EndAlert - signaling the script had no errors and reached the end
- alert("end");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement