HV Hide Infinite Items

Hide items with infinite supply on the "All" tab of the Item Shop

  1. // ==UserScript==
  2. // @name HV Hide Infinite Items
  3. // @description Hide items with infinite supply on the "All" tab of the Item Shop
  4. // @include http://hentaiverse.org/?s=Bazaar&ss=is*
  5. // @version 0.0.1.20160315155031
  6. // @namespace https://greasyfork.org/users/2233
  7. // ==/UserScript==
  8.  
  9. /*** Settings ***/
  10. if(typeof wlist == 'undefined') {
  11. var wlist = [ // Infinite items on the list are NOT hidden. Edit it to suit your own needs.
  12. /Soul Fragment/i,
  13. ]
  14. }
  15.  
  16. if(typeof blist == 'undefined') {
  17. var blist = [ // Finite items on the list are hidden. Edit it to suit your own needs.
  18. /Last Elixir/i,
  19. /Infusion/i,
  20. /Scroll of (Swiftness|Shadows|Absorption|Life|(the Gods))/i,
  21. /(Low|Mid)-Grade/i,
  22. /High-Grade (Metals|Leather)/i,
  23. /Binding.*(Focus|Friendship|Elementalist|Heaven-sent|Demon-fiend|Curse-weaver|Earth-walker|Surtr|Niflheim|Mjolnir|Freyr|Heimdall|Fenrir|Stone-skin|Deflection|Fire-eater|Frost-born|Thunder-child|Wind-waker|Thrice-blessed|Spirit-ward)/i,
  24. /Voidseeker|Aether|Featherweight/i,
  25. /Figurine/i,
  26. ]
  27. }
  28.  
  29. /*** End of Settings ***/
  30.  
  31. var wnd = window
  32. var doc = wnd.document
  33. var loc = location
  34. var href = loc.href
  35.  
  36. var $ = function(e, css) { if(!css) { css=e; e=doc }; return e.querySelector(css) }
  37. var $$ = function(e, css) { if(!css) { css=e; e=doc }; return e.querySelectorAll(css) }
  38.  
  39. if(/&ss=is&?/.test(href)) {
  40. if(/&filter=all/.test(href) || (!/&filter=/.test(href))) {
  41. var shop_pane = $('#shop_pane')
  42. var items = $$(shop_pane, '.idp')
  43. //var items = $$(shop_pane, '*[id]')
  44. var supplies = $$(shop_pane, '.ii')
  45. for(var i=0, len=items.length; i<len; i++) {
  46. (function(){
  47. if(isNaN(parseInt(supplies[i].textContent))) { // Items with infinite stock
  48. var hidden = true
  49. for(var j=0, len2=wlist.length; j<len2; j++) {
  50. if(wlist[j].test(items[i].textContent)) { hidden = false; break }
  51. }
  52. if(hidden) { items[i].parentNode.parentNode.style.display = 'none' }
  53. }
  54. else { // Items with finite stock
  55. var hidden = false
  56. for(var j=0, len2=blist.length; j<len2; j++) {
  57. if(blist[j].test(items[i].textContent)) { hidden = true; break }
  58. }
  59. if(hidden) { items[i].parentNode.parentNode.style.display = 'none' }
  60. }
  61. })()
  62. }
  63. }
  64. }