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