Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 0.84 KB | None | 0 0
  1. // ==UserScript==
  2. // @name         Lista znajomych - grupowanie po statusach online
  3. // @namespace    http://hermitowski.org/
  4. // @version      42
  5. // @description  Przesuwa graczy ze statusem online na początek listy
  6. // @author       Hermitowski
  7. // @include      https://pl*.plemiona.pl/game.php?*screen=buddies
  8. // ==/UserScript==
  9.  
  10. (function() {
  11.   let rows = $('.content-border').find('.vis')[1].rows;
  12.   let switching = true;
  13.  
  14.   while (switching) {
  15.     switching = false;
  16.     let i = rows.length - 2;
  17.     for (; i >= 0; i--) {
  18.       let x = rows[i + 0].cells[2].children[0].getAttribute('title');
  19.       let y = rows[i + 1].cells[2].children[0].getAttribute('title');
  20.       if (y == 'online' && x == 'offline') { switching = true; break; }
  21.     }
  22.     if (switching) {
  23.       rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
  24.     }
  25.   }
  26.  
  27. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement