Replies: 2 comments 1 reply
-
If think I could add a function that is called if there were no results, so the function can broaden the search. {
steam: {
host: ['store.steampowered.com'],
condition: () => document.querySelector('*[itemprop=name]'),
products: [{
condition: Always,
type: 'pcgame',
data: () => document.querySelector('*[itemprop=name]').textContent,
broaden: function(lastProductData) {
// Remove brackets from search term
return removeBrackets(lastProductData)
}
}]
}
} |
Beta Was this translation helpful? Give feedback.
-
I have added it on a global level: Metacritic-userscript/Show_metacritic_ratings.user.js Lines 320 to 346 in 9ec60d5 For now the global function only applies to 'pcgame' and it can do the things that you suggested. It goes through three steps, and tries to search after each step. I thought that might be better than removing everything at once. I also added the product specific way as described before. So it is possible to overwrite the global function in the product with I have not really tested it yet, that's why I have not increased the version number. If you want to test it, you have to manually install it from the github file. |
Beta Was this translation helpful? Give feedback.
-
Hello! I think it would be nice to implement this feature:
If script doesn't find the product by name it takes from product.data, it try to "guess" it that way:
And try to search for a product with a new name. What do you think?
Beta Was this translation helpful? Give feedback.
All reactions