-
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.
-
-
Steps:
-
-
1) Using the tampermonkey plugin, edit the 4chanX file, search for "ref = g.BOARD.config.board_flags;" and replace the for loop below
-
-
for (value in ref) {
-
textContent = ref[value];
-
addFlag(value, textContent);
-
}
-
-
-
with the following:
-
-
if(g.BOARD.config.board == 'mlp'){
-
let mlpOptions = [];
-
// loops through all the items in the map
-
for (value in ref) {
-
textContent = ref[value];
-
// only including anyone not in the blacklist
-
if(!inMLPExclude(textContent)){
-
mlpOptions.push({"key":value, "text":textContent});
-
}
-
}
-
// sorting the flag options and then adding them
-
let mlpFlags = mlpOptions.sort(sortMLP);
-
for(value of mlpFlags){
-
addFlag(value.key, value.text);
-
}
-
} else {
-
for (value in ref) {
-
textContent = ref[value];
-
addFlag(value, textContent);
-
}
-
}
-
-
2) Add the following to the bottom of the file:
-
-
-
function inMLPExclude(name){
-
// add the names of whoever you don't want in here
-
// example: const excludeNames = ["Adagio Dazzle"];
-
const excludeNames = [];
-
-
return excludeNames.includes(name);
-
}
-
-
function sortMLP(a, b){
-
// add or remove whoever you want to the top of the list, they'll appear in the order of the array below
-
const m6_order = ['Applejack', 'Fluttershy', 'Pinkie Pie', 'Rainbow Dash', 'Rarity', 'Twilight Sparkle'];
-
-
let aHasM6 = m6_order.includes(a.text);
-
let bHasM6 = m6_order.includes(b.text);
-
-
if(a.innerHTML == "None") {
-
return -1;
-
}
-
if(b.innerHTML == "None") {
-
return 1;
-
}
-
if(aHasM6 && bHasM6){
-
return m6_order.indexOf(a.text) - m6_order.indexOf(b.text);
-
}
-
-
if(aHasM6 && !bHasM6){
-
return -1;
-
}
-
-
if(!aHasM6 && bHasM6){
-
return 1;
-
}
-
-
return a.text.localeCompare(b.text);
-
}
-
-
3) save file and reload page
277 2.36 KB 76
Temp Modification for 4chanX quick reply flags on /mlp/
By silvertearCreated: 2021-07-16 21:31:33
Updated: 2021-05-07 19:27:10
Expiry: Never
by silvertear
by silvertear
by silvertear
by silvertear
by silvertear