TEXT   352   0
   125 1.32 KB    46

Quick user script to sort flags to the top

By silvertear
Created: 2021-07-16 21:31:33
Updated: 2021-05-01 18:03:40
Expiry: Never

  1. // ==UserScript==
  2. // @name Sort M6 first
  3. // @version 0.1
  4. // @description try to take over the world!
  5. // @author >(You)
  6. // @grant none
  7. // ==/UserScript==
  8.  
  9. (function() {
  10. 'use strict';
  11.  
  12. const m6_order = ['Applejack', 'Fluttershy', 'Pinkie Pie', 'Rainbow Dash', 'Rarity', 'Twilight Sparkle'];
  13. // Your code here...
  14. for (const ele of document.querySelectorAll('.flagSelector')) {
  15. let childlist = [...ele.children];
  16. childlist.sort( (a, b) => {
  17. let aHasM6 = m6_order.includes(a.innerHTML);
  18. let bHasM6 = m6_order.includes(b.innerHTML);
  19.  
  20. if(a.innerHTML == "None") {
  21. return -1;
  22. }
  23. if(b.innerHTML == "None") {
  24. return 1;
  25. }
  26. if(aHasM6 && bHasM6){
  27. return m6_order.indexOf(a.innerHTML) - m6_order.indexOf(b.innerHTML);
  28. }
  29.  
  30. if(aHasM6 && !bHasM6){
  31. return -1;
  32. }
  33.  
  34. if(!aHasM6 && bHasM6){
  35. return 1;
  36. }
  37.  
  38. return a.innerHTML.localeCompare(b.innerHTML);
  39. });
  40.  
  41. ele.replaceChildren(...childlist);
  42. ele.value = '0';
  43. }
  44. })();

[RGRE] RD's Dare by SadNonny

by silvertear

[RGRE] Villanon by AponymousAuthor

by silvertear

Applejack Season (NSFW clop) - by Operafag

by silvertear

[RGRE] How Villanon Stole Hearth's Warming by AponymousAuthor

by silvertear

[AiE] Burning Questions by MINDWAVE

by silvertear