index.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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="styles.css" />
  7. <script src="https://unpkg.com/fuse.js@6.5.3/dist/fuse.min.js"></script>
  8. <script src="database.js"></script>
  9. <script src="main.js" defer></script>
  10. </head>
  11. <body>
  12. <noscript>Requires javascript</noscript>
  13. <template id="metric-select-template">
  14. <!-- Form is named by script, contains all fields to use event bubbling -->
  15. <form
  16. action="javascript:void(0)"
  17. autocomplete="off"
  18. class="metric-fields | flex col small-gap"
  19. >
  20. <output hidden name="metric"></output>
  21. <label>
  22. <input type="radio" name="metricKind" value="compare" />
  23. <div class="toggle-label | center pill-shape highlight-border">Comparison</div>
  24. </label>
  25. <label>
  26. <input type="radio" name="metricKind" value="stat" />
  27. <div class="toggle-label | center pill-shape highlight-border">Statistics</div>
  28. </label>
  29. <select class="pill-shape highlight-border" name="compare" disabled>
  30. <option value="alpha">Geometric Difference (α)</option>
  31. <option value="psi">RMS Distance (Ψ)</option>
  32. <option value="omega">Mean Cosine Difference (Ω)</option>
  33. <option value="delta">Euclidean Distance (δ)</option>
  34. <option value="theta">Angular Difference (θ)</option>
  35. <option value="deltaL">Lightness Difference (ΔL)</option>
  36. <option value="deltaC">Chroma Difference (ΔC)</option>
  37. <option value="deltaH">Hue Difference (Δh)</option>
  38. </select>
  39. <select class="pill-shape highlight-border" name="stat" disabled>
  40. <option value="beta">Visual Importance (β)</option>
  41. <option value="size">Size (N)</option>
  42. <option value="chroma">Mean Chroma (C̅)</option>
  43. <option value="variance">Variance (σ²)</option>
  44. </select>
  45. </form>
  46. </template>
  47. <template id="pkmn-data-template">
  48. <div class="full-grid-row">μ&nbsp;=&nbsp;(<span bind-to="centroid"></span>)</div>
  49. <div class="full-grid-row">τ&nbsp;=&nbsp;(<span bind-to="tilt"></span>)</div>
  50. <div>σ²&nbsp;=&nbsp;<span bind-to="variance"></span></div>
  51. <div>σ&nbsp;=&nbsp;<span bind-to="stddev"></span></div>
  52. <div>C̅&nbsp;=&nbsp;<span bind-to="chroma"></span></div>
  53. <div>h̅&nbsp;=&nbsp;<span bind-to="hue"></span>°</div>
  54. <div>α&nbsp;=&nbsp;<span bind-to="alpha"></span></div>
  55. <div>β&nbsp;=&nbsp;<span bind-to="beta"></span></div>
  56. <div>δ&nbsp;=&nbsp;<span bind-to="delta"></span></div>
  57. <div>Ψ&nbsp;=&nbsp;<span bind-to="psi"></span></div>
  58. <div>θ&nbsp;=&nbsp;<span bind-to="theta"></span>°</div>
  59. <div>Ω&nbsp;=&nbsp;<span bind-to="omega"></span></div>
  60. <div>N&nbsp;=&nbsp;<span bind-to="size"></span></div>
  61. <div>ΔL&nbsp;=&nbsp;<span bind-to="deltaL"></span></div>
  62. <div>ΔC&nbsp;=&nbsp;<span bind-to="deltaC"></span></div>
  63. <div>Δh&nbsp;=&nbsp;<span bind-to="deltaH"></span>°</div>
  64. </template>
  65. <template id="pkmn-tile-template">
  66. <div class="pkmn-tile | flex col no-gap">
  67. <div class="ellipsis emphasis" bind-to="name"></div>
  68. <div class="pkmn-info | highlight-border flex even">
  69. <div class="flex col small-gap">
  70. <a bind-to="link" href=""><img bind-to="image" /></a>
  71. <div class="center" bind-to="score"></div>
  72. <button bind-to="totalBtn" class="pkmn-total | color-select"></button>
  73. <div class="total-info | grid small-gap" bind-to="totalData"></div>
  74. </div>
  75. <div class="cluster-buttons | flex col">
  76. <button bind-to="cls1Btn" class="color-select" hidden></button>
  77. <div class="cluster-info | grid small-gap" bind-to="cls1Data"></div>
  78. <button bind-to="cls2Btn" class="color-select" hidden></button>
  79. <div class="cluster-info | grid small-gap" bind-to="cls2Data"></div>
  80. <button bind-to="cls3Btn" class="color-select" hidden></button>
  81. <div class="cluster-info | grid small-gap" bind-to="cls3Data"></div>
  82. <button bind-to="cls4Btn" class="color-select" hidden></button>
  83. <div class="cluster-info | grid small-gap" bind-to="cls4Data"></div>
  84. </div>
  85. </div>
  86. </div>
  87. </template>
  88. <!-- Contains target color controls -->
  89. <form
  90. id="targetColorForm"
  91. hidden
  92. action="javascript:void(0)"
  93. autocomplete="off"
  94. ></form>
  95. <!-- Contains cluster fn controls + final objective fn controls -->
  96. <form
  97. id="colorCalculateForm"
  98. hidden
  99. action="javascript:void(0)"
  100. autocomplete="off"
  101. ></form>
  102. <!-- Contains final sort order control -->
  103. <form id="colorSortForm" hidden action="javascript:void(0)" autocomplete="off"></form>
  104. <!-- Contains display control (number of results) -->
  105. <form
  106. id="colorDisplayForm"
  107. hidden
  108. action="javascript:void(0)"
  109. autocomplete="off"
  110. ></form>
  111. <!-- Contains filter control (form filters, etc.) -->
  112. <form id="filterControl" hidden action="javascript:void(0)" autocomplete="off"></form>
  113. <!-- Contains name search controls -->
  114. <form
  115. id="nameSearchForm"
  116. hidden
  117. action="javascript:void(0)"
  118. autocomplete="off"
  119. ></form>
  120. <div class="section flow small-flow-space">
  121. <div class="color-inputs | flex col small-gap">
  122. <label class="emphasis center" for="colorInputText">Target Color</label>
  123. <div class="flex small-gap">
  124. <input
  125. form="targetColorForm"
  126. class="pill-shape highlight-border"
  127. name="colorText"
  128. type="text"
  129. pattern="#?[0-9a-fA-F]{0,6}"
  130. maxlength="7"
  131. placeholder="#000000"
  132. />
  133. <input form="targetColorForm" name="colorPicker" type="color" />
  134. </div>
  135. <button type="button" form="targetColorForm" name="randomColor">
  136. Random Color
  137. </button>
  138. <div class="center">
  139. <label>
  140. <div class="emphasis">
  141. Results:&nbsp;<output form="colorDisplayForm" name="output">6</output>
  142. </div>
  143. <input
  144. form="colorDisplayForm"
  145. name="resultsToDisplay"
  146. type="range"
  147. min="1"
  148. max="100"
  149. value="6"
  150. />
  151. </label>
  152. </div>
  153. <label class="center">
  154. <input form="filterControl" type="checkbox" name="nostart" hidden checked />
  155. <span class="toggle-label | pill-shape highlight-border">
  156. Hide Non-Start Forms
  157. </span>
  158. </label>
  159. <label class="center">
  160. <input form="filterControl" type="checkbox" name="regional" hidden />
  161. <span class="toggle-label | pill-shape highlight-border">
  162. Hide Regional Forms
  163. </span>
  164. </label>
  165. </div>
  166. <hr />
  167. <div class="emphasis center">Ranking Function</div>
  168. <div id="sort-metric-mount"></div>
  169. <!-- Main Sort Function -->
  170. <div class="fn-control | flex col no-gap">
  171. <div class="fn-minmax | center flex small-gap">
  172. <label>
  173. <input
  174. form="colorSortForm"
  175. type="radio"
  176. name="sortOrder"
  177. value="min"
  178. checked
  179. />
  180. <span class="toggle-label | pill-shape highlight-border">Minimizing</span>
  181. </label>
  182. <label>
  183. <input form="colorSortForm" type="radio" name="sortOrder" value="max" />
  184. <span class="toggle-label | pill-shape highlight-border">Maximizing</span>
  185. </label>
  186. </div>
  187. <div class="fn-body | flex">
  188. <label>
  189. <input
  190. form="colorCalculateForm"
  191. type="checkbox"
  192. name="sortUseWholeImage"
  193. checked
  194. />
  195. <span class="toggle-label | pill-shape highlight-border">
  196. <output form="colorCalculateForm" name="sortMetricSymbolP"></output>(I)
  197. </span>
  198. </label>
  199. <label>
  200. <input
  201. form="colorCalculateForm"
  202. type="checkbox"
  203. name="sortUseBestCluster"
  204. checked
  205. />
  206. <span class="toggle-label | pill-shape highlight-border">
  207. <output form="colorCalculateForm" name="sortMetricSymbolB"></output>(B)
  208. </span>
  209. </label>
  210. <div class="fn-fraction | flex col no-gap">
  211. <label>
  212. <input
  213. form="colorCalculateForm"
  214. type="checkbox"
  215. name="sortUseClusterSize"
  216. />
  217. <span class="toggle-label | pill-shape highlight-border">|B|</span>
  218. </label>
  219. <label>
  220. <input
  221. form="colorCalculateForm"
  222. type="checkbox"
  223. name="sortUseInvClusterSize"
  224. checked
  225. />
  226. <span class="toggle-label | pill-shape highlight-border">|B|</span>
  227. </label>
  228. </div>
  229. <div class="fn-fraction | flex col no-gap">
  230. <label>
  231. <input
  232. form="colorCalculateForm"
  233. type="checkbox"
  234. name="sortUseTotalSize"
  235. checked
  236. />
  237. <span class="toggle-label | pill-shape highlight-border">|I|</span>
  238. </label>
  239. <label>
  240. <input
  241. form="colorCalculateForm"
  242. type="checkbox"
  243. name="sortUseInvTotalSize"
  244. />
  245. <span class="toggle-label | pill-shape highlight-border">|I|</span>
  246. </label>
  247. </div>
  248. </div>
  249. </div>
  250. <hr />
  251. <div id="cls-title" class="emphasis center">Cluster Ranking</div>
  252. <div id="cls-metric-mount"></div>
  253. <!-- Cluster Sort Function -->
  254. <div id="cls-fn" class="fn-control | flex col no-gap">
  255. <div class="fn-minmax | center flex small-gap">
  256. <label>
  257. <input
  258. form="colorCalculateForm"
  259. type="radio"
  260. name="clusterSortOrder"
  261. value="min"
  262. />
  263. <span class="toggle-label | pill-shape highlight-border">Minimizing</span>
  264. </label>
  265. <label>
  266. <input
  267. form="colorCalculateForm"
  268. type="radio"
  269. name="clusterSortOrder"
  270. value="max"
  271. checked
  272. />
  273. <span class="toggle-label | pill-shape highlight-border">Maximizing</span>
  274. </label>
  275. </div>
  276. <div class="fn-body | flex">
  277. <span class="toggle-label | pill-shape highlight-border">
  278. <output form="colorCalculateForm" name="clusterMetricSymbol"></output>(K)
  279. </span>
  280. <div class="fn-fraction | flex col no-gap">
  281. <label>
  282. <input
  283. form="colorCalculateForm"
  284. type="checkbox"
  285. name="clusterUseClusterSize"
  286. />
  287. <span class="toggle-label | pill-shape highlight-border">|K|</span>
  288. </label>
  289. <label>
  290. <input
  291. form="colorCalculateForm"
  292. type="checkbox"
  293. name="clusterUseInvClusterSize"
  294. />
  295. <span class="toggle-label | pill-shape highlight-border">|K|</span>
  296. </label>
  297. </div>
  298. <div class="fn-fraction | flex col no-gap">
  299. <label>
  300. <input
  301. form="colorCalculateForm"
  302. type="checkbox"
  303. name="clusterUseTotalSize"
  304. />
  305. <span class="toggle-label | pill-shape highlight-border">|I|</span>
  306. </label>
  307. <label>
  308. <input
  309. form="colorCalculateForm"
  310. type="checkbox"
  311. name="clusterUseInvTotalSize"
  312. />
  313. <span class="toggle-label | pill-shape highlight-border">|I|</span>
  314. </label>
  315. </div>
  316. </div>
  317. </div>
  318. <hr />
  319. <div class="flex col small-gap">
  320. <div class="emphasis center">Name Search</div>
  321. <input
  322. form="nameSearchForm"
  323. class="pill-shape highlight-border"
  324. type="text"
  325. autocomplete="off"
  326. name="input"
  327. />
  328. <button form="nameSearchForm" type="button" name="random">Random Pokemon</button>
  329. <button form="nameSearchForm" type="button" name="clear">Clear</button>
  330. </div>
  331. </div>
  332. <main class="section flow">
  333. <div class="emphasis">By Color</div>
  334. <div id="color-results" class="flex wrap"></div>
  335. <hr />
  336. <div class="emphasis">By Name</div>
  337. <div id="name-results" class="flex wrap"></div>
  338. </main>
  339. <div class="section flow">
  340. <div class="emphasis center">Previous Colors</div>
  341. <div id="prevColors"></div>
  342. </div>
  343. </body>
  344. </html>