nearest.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Pokemon By Color</title>
  6. <link rel="stylesheet" href="nearest.css">
  7. <script src="https://unpkg.com/d3-color@3.0.1/dist/d3-color.min.js"></script>
  8. <script src="https://unpkg.com/d3-cam02@0.1.5/build/d3-cam02.min.js"></script>
  9. <script src="https://unpkg.com/fuse.js@6.5.3/dist/fuse.min.js"></script>
  10. <script src="https://unpkg.com/texzilla@1.0.2/TeXZilla.js"></script>
  11. <script src="database.js"></script>
  12. <script src="nearest.js"></script>
  13. <script src="database-v2.js"></script>
  14. <script src="metrics.js"></script>
  15. <script src="convert.js"></script>
  16. <script lang="javascript">window.onload = () => { onPageLoad(); }</script>
  17. </head>
  18. <body>
  19. <noscript>Requires javascript</noscript>
  20. <div class="container start-justified">
  21. <form id="controls" onsubmit="event.preventDefault()">
  22. <img style="grid-area: bulb; justify-self: center;" src="https://img.pokemondb.net/sprites/sword-shield/icon/bulbasaur.png" />
  23. <input style="grid-area: inpt;" maxlength="7" id="color-input" oninput="onColorChanged()" />
  24. <button style="grid-area: rand;" type="button" onclick="onRandomColor()">
  25. Random Color
  26. </button>
  27. <label for="num-poke" style="grid-area: liml" class="center-text">
  28. Search limit: <span id="num-poke-display">10</span>
  29. </label>
  30. <input
  31. id="num-poke" style="grid-area: limt;"
  32. type="range" min="1" max="100" value="10"
  33. oninput="onLimitChanged(true)" onchange="onLimitChanged()"
  34. >
  35. <div style="grid-area: qvec; justify-self: start;">
  36. <div id="q-vec-jab"></div>
  37. <div id="q-vec-rgb"></div>
  38. </div>
  39. <span id="obj-fn" style="grid-area: objf;"></span>
  40. <div class="panel" style="grid-area: metr; padding-top: 4px;">
  41. <label for="metric" style="text-align: center;">
  42. Scoring Metric:
  43. </label>
  44. <select type="checkbox" onchange="onMetricChanged()" id="metric">
  45. <option selected>RMS Deviation (σ)</option>
  46. <option>Mean Angle (θ)</option>
  47. <option>Mean Distance (δ)</option>
  48. <option>Hue Angle (ϕ)</option>
  49. <option>Max Inertia (I)</option>
  50. <option>Chebyshev</option>
  51. <option>Custom Metric</option>
  52. </select>
  53. </div>
  54. <div class="panel" style="grid-area: clst;">
  55. <label for="image-mean" class="center-text">
  56. Cluster:
  57. </label>
  58. <select type="checkbox" onchange="onClusterChoiceChanged()" id="image-summary">
  59. <option selected>All Pixels</option>
  60. <option>Biggest (M)</option>
  61. <option>Smallest (m)</option>
  62. <option>Best (α)</option>
  63. <option>Worst (ω)</option>
  64. </select>
  65. </div>
  66. <div id="cluster-mean-warning" class="center-text hide" style="grid-area: warn;">
  67. Warning: Inertia term ignores clusters - consider another metric
  68. </div>
  69. <div style="grid-area: scal; align-self: end; padding-bottom: 2px;" class="hide">
  70. <label for="scale-by-cluster-size">
  71. Scale measure by cluster size:
  72. </label>
  73. <input type="checkbox" checked oninput="onScaleByClusterChanged()" id="scale-by-cluster-size">
  74. </div>
  75. <input type="checkbox" id="reveal-definitions" role="button">
  76. <label
  77. id="reveal-def-label" for="reveal-definitions"
  78. style="grid-area: togg;"
  79. >
  80. <div id="reveal-def-show">Show Definitions ►</div>
  81. <div id="reveal-def-hide">Hide Definitions ▼</div>
  82. </label>
  83. <div style="grid-area: defs; align-self: start; padding-left: 1em;">
  84. <div class="definitions" id="main-definition"></div>
  85. </div>
  86. <div style="grid-area: clsd; align-self: start;">
  87. <div class="definitions" id="cluster-definition"></div>
  88. </div>
  89. <div class="hideable_control hideable_control--hidden" style="grid-area: iner;">
  90. <input type="checkbox" checked oninput="onCustomControlsChanged()" id="include-x">
  91. <label for="include-x">Include Inertia</label>
  92. </div>
  93. <div class="hideable_control hideable_control--hidden" style="grid-area: norm;">
  94. <input type="checkbox" oninput="onCustomControlsChanged()" id="norm-q-y">
  95. <label for="norm-q-y">Normalize q and μ</label>
  96. </div>
  97. <div
  98. class="hideable_control hideable_control--hidden"
  99. style="grid-area: coef; flex-direction: column;"
  100. >
  101. <label for="close-coeff" class="center-text">
  102. Alignment: <span id="close-coeff-display">2</span>
  103. </label>
  104. <input
  105. type="range" min="0" max="10" value="2" step="0.1"
  106. oninput="onCustomControlsChanged(true)"
  107. onchange="onCustomControlsChanged()"
  108. id="close-coeff"
  109. >
  110. </div>
  111. <div style="grid-area: btns; display: inline-flex; flex-flow: row nowrap; justify-content: space-between;">
  112. <button class="padded" type="button" onclick="onRandomPokemon()">
  113. Random
  114. </button>
  115. <button id="search-space-button" type="button" onclick="onSearchSpaceChanged()">
  116. <span id="search-space-display">RGB</span>
  117. </button>
  118. </div>
  119. <input type="checkbox" checked class="show-list" role="button" id="search-list-toggle">
  120. <label style="grid-area: srch;" for="search-list-toggle" class="title">
  121. <div class="show-list-lbl-show">Search By Pokemon ►</div>
  122. <div class="show-list-lbl-hide">Search By Pokemon ▼</div>
  123. </label>
  124. <input style="grid-area: name;" id="pokemon-name" size="15" oninput="onSearchChanged()">
  125. <ul id="search-list" style="grid-area: rslt;" class="pkmn-list"></ul>
  126. </form>
  127. <div class="panel rpanel">
  128. <div>
  129. <input type="checkbox" checked class="show-list" role="button" id="jab-list-toggle">
  130. <label for="jab-list-toggle" class="title">
  131. <div class="show-list-lbl-show">CIECAM02 Uniform Color Space (Jab) ►</div>
  132. <div class="show-list-lbl-hide">CIECAM02 Uniform Color Space (Jab) ▼</div>
  133. </label>
  134. <ul id="best-list-jab" class="pkmn-list"></ul>
  135. </div>
  136. <div>
  137. <input type="checkbox" class="show-list" role="button" id="rgb-list-toggle">
  138. <label for="rgb-list-toggle" class="title">
  139. <div class="show-list-lbl-show">sRGB Color Space ►</div>
  140. <div class="show-list-lbl-hide">sRGB Color Space ▼</div>
  141. </label>
  142. <ul id="best-list-rgb" class="pkmn-list"></ul>
  143. </div>
  144. </div>
  145. </div>
  146. </body>
  147. </html>