nearest.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Pokemon By Color</title>
  6. <script src="https://www.unpkg.com/jquery@3.6.0/dist/jquery.min.js"></script>
  7. <script src="https://unpkg.com/colorspaces@0.1.5/colorspaces.js"></script>
  8. <script src="database.js"></script>
  9. <script src="nearest.js"></script>
  10. <script lang="javascript">window.onload = () => { onUpdate(); }</script>
  11. <style>
  12. body {
  13. width: 100vw;
  14. }
  15. .container {
  16. width: 100%;
  17. display: flex;
  18. flex-flow: row nowrap;
  19. justify-content: space-between;
  20. align-items: flex-start;
  21. }
  22. .panel {
  23. width: 100%;
  24. flex: 1;
  25. display: flex;
  26. flex-flow: column nowrap;
  27. justify-content: flex-start;
  28. align-items: flex-start;
  29. }
  30. .padded {
  31. padding-left: 16px;
  32. padding-right: 16px;
  33. }
  34. .margined {
  35. margin-left: 8px;
  36. margin-right: 8px;
  37. }
  38. #left-panel {
  39. min-width: 400px;
  40. max-width: 500px;
  41. }
  42. .bycolor {
  43. flex: 2;
  44. border-left: 4px solid #222;
  45. }
  46. .bycolor_l1 {
  47. justify-content: flex-start;
  48. align-items: flex-end;
  49. }
  50. .bycolor_l2 {
  51. padding-top: 16px;
  52. justify-content: flex-start;
  53. }
  54. .control {
  55. height: 32px;
  56. align-items: flex-end;
  57. }
  58. </style>
  59. </head>
  60. <body>
  61. <noscript>Requires javascript</noscript>
  62. <div class="container">
  63. <div id="left-panel" class="padded panel">
  64. <div>
  65. Minimizing:
  66. <span id="x-term">X(P)</span>
  67. <span> -</span>
  68. <span id="c-value">2</span>
  69. <span id="q-vec">q</span>
  70. <span> · </span>
  71. <span id="y-vec">Y(P)</span>
  72. </div>
  73. <form class="panel" onsubmit="onUpdate()" action="#">
  74. <div class="container control">
  75. <label for="include-x">Include X:</label>
  76. <input type="checkbox" checked oninput="onUpdate()" id="include-x">
  77. </div>
  78. <div class="container control">
  79. <label for="norm-q-y">Normalize q and Y:</label>
  80. <input type="checkbox" oninput="onUpdate()" id="norm-q-y">
  81. </div>
  82. <div class="container control">
  83. <label for="close-coeff">Closeness coefficient: <span id="close-coeff-display">2</span></label>
  84. <input type="range" min="0" max="10" value="2" step="0.1" oninput="onUpdate()" id="close-coeff">
  85. </div>
  86. <div class="container control">
  87. <div>Color Space: <span id="color-space">CIELUV</span></div>
  88. <button id="space-toggle" onclick="onToggleSpace()">Swap to RGB</button>
  89. </div>
  90. </form>
  91. </div>
  92. <div class="padded panel bycolor">
  93. <div>
  94. Search By Color - click random, or enter six digit hex code (optional #) and press enter
  95. </div>
  96. <form class="panel" onsubmit="onUpdate()" action="#">
  97. <div class="container bycolor_l1">
  98. <button class="padded" type="button" onclick="onRandomColor()">Random color</button>
  99. <input class="margined" size="7" maxlength="7" id="color-input" onchange="onUpdate()" value="#ffffff" />
  100. <img src="https://img.pokemondb.net/sprites/sword-shield/icon/bulbasaur.png" />
  101. </div>
  102. <div class="container bycolor_l2">
  103. <label for="num-poke" style="min-width: 200px;">Number to find: <span id="num-poke-display">10</span></label>
  104. <input type="range" min="1" max="100" value="10" oninput="onUpdate()" id="num-poke">
  105. </div>
  106. </form>
  107. <ul id="best-list"></ul>
  108. </div>
  109. </div>
  110. </body>
  111. </html>