Lioden Improvements

Adds various improvements to the game Lioden.

  1. // Generated by CoffeeScript 1.9.3
  2.  
  3. /* UserScript options {{{1
  4. See http://wiki.greasespot.net/Metadata_Block for more info.
  5.  
  6. // ==UserScript==
  7. // @name Lioden Improvements
  8. // @description Adds various improvements to the game Lioden.
  9. // @namespace ahto
  10. // @version 0.1
  11. // @include http://*.lioden.com/*
  12. // @include http://lioden.com/*
  13. // @require https://greasyfork.org/scripts/10922-ahto-library/code/Ahto%20Library.js?version=75750
  14. // @grant none
  15. // ==/UserScript==
  16. */
  17. var MAX_PRICE_MAX;
  18.  
  19. MAX_PRICE_MAX = '9999999999';
  20.  
  21.  
  22. /*
  23. * Search branches {{{1
  24. if urlMatches new RegExp '/search_branches\\.php', 'i'
  25. prices = findMatches('input[name=maxprice]', 1, 1).parent()
  26. pricesDecor = findMatches('input[name=maxprice2]', 1, 1).parent()
  27.  
  28. for [parent, inputBaseName] in [[prices, 'maxprice'], [pricesDecor, 'maxprice2']]
  29. * Remove SB and GB text.
  30. * TODO: Doesn't work.
  31. parent.filter(-> this.nodeType == 3).remove()
  32.  
  33. * inputBaseName is just an overly complicated way of saying that the
  34. * input's names are either going to start with maxprice or maxprice2.
  35. sb = parent.children "input[type=text][name=#{inputBaseName}]"
  36. gb = parent.children "input[type=text][name=#{inputBaseName}c]"
  37.  
  38. sbLink = sb.after "<a href='javascript:void(0)'> SB</a>"
  39. gbLink = gb.after "<a href='javascript:void(0)'> GB</a>"
  40.  
  41. makeHandler = (us, them) -> ->
  42. * TODO: Never called.
  43. console.log "Handler called on:", us, "them:", them
  44. if us.val().length
  45. us.val ''
  46. else
  47. us.val MAX_PRICE_MAX
  48. them.val ''
  49.  
  50. sbLink.click makeHandler sb, gb
  51. gbLink.click makeHandler gb, sb
  52. */