javascript - bookmarklet: click for random specified links from a host domain -


tl; Dr: A bookmark that opens in a new tab: Thanks for the random link (specified multiple Html-classes) with the specified domain and the code that works with the current login.

Brief version of Bushara code:

  Javascript: (var% 20 site = domain.com function () {window.location.host == Site Without (Window. Open (document.links [Math.floor (document.querySelectorAll ("a.class1, a.class2")]. Href, '_blank')}} (); // Beautified with: http: // Jsbeautifier.org  





For whom it may be a concern: I searched It is for a while and even the switching services are considered, but though some come or are similar to my special request, E also does not fully represent the request.

  1. Execute the script on this particular domain even when a page asked from the domain is not currently open. To obtain information or data, login authentication is required, then read or work with the existing session.

  2. Get from a specific domain host, one from all the links to that d Random link

  3. result one Open in a new tab.

  4. / ol>

    With this kind of similarity, the result has become something like this:

      // bookmarklet javascript: // mismatched function + wrapped code before execution (// function global variable for quick replacement Var% 20 site = domain.com function () {// script execution window .location.host == Set domain for site // open new tab for zero (window.open (document.links // random link [Math.floor // with special sections (elements found with CSS selectors) ( Document.querySelectorAll ("a.class1, a.class2"))] // end Random query. Href, '_ blank' // end page-open) // end link-open) // end "void"} // end function definition / execute (); // (tried) check with Made: //http://www.javascriptlint.com/online_lint.php  

    Finally, I have obtained the most basic CSS knowledge, if it demands that in this request Anyone has headset, palming or otherwise in gtfo mode. It's just so sad that apparently "Warning: I do not have any tags for it-ed this stuff" though in StackExchange , I still do and what improvements and modifications to a depth like the answers explain.

    Currently, thanks for your time and effort.

Theoretically, the following code should do you:

  window .addEventListener ('load', function () {var query = 'a.class1 [href], a.class2 [href]'; var candidates = document.querySelectorAll (query); var choice = math.flur (math.ndendam () * Candidates. Lamps); Window. Open (candidates. Item (choice) .hff, 'randtab';}, true); Window.location.href = 'http://domain.com';  

But that's not the case, because the possibility of maintaining event listeners on a page may be misbehavior and protects you against such abuse. Instead, you manually load the domain of your choice and then click on a simple bookmarklet with the following code:

  var query = 'a.class1 [href], a.class2 [Href] '; Var candidate = document.query selectorAll (queries); Var likes = Math.flur (math.rendum (* * Candidates. Lamps); Window.open (candidates.options (like) .href, 'randomtab');  

You can wrap up in javascript: (function () { ... }) (); and minify like before, but it already works if you just summarize it and slip in the front only javascript: .

I understand your situation of posting a full start and "DIY" code, but I'm still not explaining step-by-step, why this code works and not yours . The first version of the code above can be understood to begin, and the list of issues with the code in question is too long to discuss them all. You will be better off studying more JavaScript; Tutorial is a good resource.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -