DinoDevs / GladiatusCrazyAddon

This was "A browser addon for the Gladiatus browser game."
https://gladiatus.dinodevs.com
GNU General Public License v3.0
41 stars 32 forks source link

Highlight auction items based on preference of keywords #182

Open mehmetkaradeniz opened 4 years ago

mehmetkaradeniz commented 4 years ago

The idea is adding a toggle checkbox on auction. If it's checked, items are highlighted based on description that matches the keyword..

Example scenario: 1) User saves keywords preferences on settings. (e.g "Lucius", "Delicacy"). 2) User visits auction and checks the checkbox 3) System highlight items (e.g red border around item html element)

I have some sample code that does the job. It can be improved.

var itemHighlightKeywords = new Array("Lucius", "Delicacy"); // read from settings

function highlightItems() {
    let items = jQuery(".auction_item_div .ui-draggable");
    for (let i = 0; i < items.length; i++) {
        let itemProps = jQuery(items[i]).data().tooltip[0];
        for (let j = 0; j < itemProps.length; j++) {

            for (let k = 0; k < itemHighlightKeywords.length; k++) {
                let prop = itemProps[j][0].toString().toLowerCase();
                let keyword = itemHighlightKeywords[k].toLowerCase();
                if (prop.contains(keyword)) {
                    jQuery(items[i]).closest(".section-header").css("border", "red solid 4px");
                    break;
                }
            }
        }
    }
}

It looks like this: image

FrutyX commented 2 years ago

What if you applied the merchant item search on this? In theory, it could work, if you can read the item names, but if it works in merchants shops...