TEXT   338   0
   277 2.36 KB    76

Temp Modification for 4chanX quick reply flags on /mlp/

By silvertear
Created: 2021-07-16 21:31:33
Updated: 2021-05-07 19:27:10
Expiry: Never

  1. 1.
    So, this modification for the 4chanX script will allow people to filter out options and sort whatever person they want to the top. Also a quick reminder that this is just a temporary thing and isn't officially within 4chanx.
  2. 2.
     
  3. 3.
    Steps:
  4. 4.
     
  5. 5.
    1) Using the tampermonkey plugin, edit the 4chanX file, search for "ref = g.BOARD.config.board_flags;" and replace the for loop below
  6. 6.
     
  7. 7.
    for (value in ref) {
  8. 8.
    textContent = ref[value];
  9. 9.
    addFlag(value, textContent);
  10. 10.
    }
  11. 11.
     
  12. 12.
     
  13. 13.
    with the following:
  14. 14.
     
  15. 15.
    if(g.BOARD.config.board == 'mlp'){
  16. 16.
    let mlpOptions = [];
  17. 17.
    // loops through all the items in the map
  18. 18.
    for (value in ref) {
  19. 19.
    textContent = ref[value];
  20. 20.
    // only including anyone not in the blacklist
  21. 21.
    if(!inMLPExclude(textContent)){
  22. 22.
    mlpOptions.push({"key":value, "text":textContent});
  23. 23.
    }
  24. 24.
    }
  25. 25.
    // sorting the flag options and then adding them
  26. 26.
    let mlpFlags = mlpOptions.sort(sortMLP);
  27. 27.
    for(value of mlpFlags){
  28. 28.
    addFlag(value.key, value.text);
  29. 29.
    }
  30. 30.
    } else {
  31. 31.
    for (value in ref) {
  32. 32.
    textContent = ref[value];
  33. 33.
    addFlag(value, textContent);
  34. 34.
    }
  35. 35.
    }
  36. 36.
     
  37. 37.
    2) Add the following to the bottom of the file:
  38. 38.
     
  39. 39.
     
  40. 40.
    function inMLPExclude(name){
  41. 41.
    // add the names of whoever you don't want in here
  42. 42.
    // example: const excludeNames = ["Adagio Dazzle"];
  43. 43.
    const excludeNames = [];
  44. 44.
     
  45. 45.
    return excludeNames.includes(name);
  46. 46.
    }
  47. 47.
     
  48. 48.
    function sortMLP(a, b){
  49. 49.
    // add or remove whoever you want to the top of the list, they'll appear in the order of the array below
  50. 50.
    const m6_order = ['Applejack', 'Fluttershy', 'Pinkie Pie', 'Rainbow Dash', 'Rarity', 'Twilight Sparkle'];
  51. 51.
     
  52. 52.
    let aHasM6 = m6_order.includes(a.text);
  53. 53.
    let bHasM6 = m6_order.includes(b.text);
  54. 54.
     
  55. 55.
    if(a.innerHTML == "None") {
  56. 56.
    return -1;
  57. 57.
    }
  58. 58.
    if(b.innerHTML == "None") {
  59. 59.
    return 1;
  60. 60.
    }
  61. 61.
    if(aHasM6 && bHasM6){
  62. 62.
    return m6_order.indexOf(a.text) - m6_order.indexOf(b.text);
  63. 63.
    }
  64. 64.
     
  65. 65.
    if(aHasM6 && !bHasM6){
  66. 66.
    return -1;
  67. 67.
    }
  68. 68.
     
  69. 69.
    if(!aHasM6 && bHasM6){
  70. 70.
    return 1;
  71. 71.
    }
  72. 72.
     
  73. 73.
    return a.text.localeCompare(b.text);
  74. 74.
    }
  75. 75.
     
  76. 76.
    3) save file and reload page

[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