nearest.html 7.3 KB

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