Advertisement
Guest User

Untitled

a guest
Jan 18th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         VFL Open All
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        http://vfl.ru/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.     function openAll() {
  14.         list.childNodes.forEach((node, index, coll) => {
  15.             setTimeout(() => {
  16.             if (node.wholeText == "\n") return;
  17.             if (node.tagName == "LI") {
  18.                 const href = node.childNodes[0].href;
  19.                 window.open(href,'_blank');
  20.             }}, index * 250)
  21.         });
  22.     }
  23.     let list = document.querySelectorAll("ul")[1];
  24.     let button = document.createElement("button");
  25.     button.innerHTML = "Открыть";
  26.     button.onclick = openAll;
  27.     list.insertBefore(button, list.firstChild)
  28.     // Your code here...
  29. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement