mooket

银河奶牛历史价格 show history market data for milkywayidle

当前为 2025-04-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name mooket
  3. // @namespace http://tampermonkey.net/
  4. // @version 20250404.52925
  5. // @description 银河奶牛历史价格 show history market data for milkywayidle
  6. // @author IOMisaka
  7. // @match https://www.milkywayidle.com/*
  8. // @match https://test.milkywayidle.com/*
  9. // @connect mooket.qi-e.top
  10. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  11. // @grant none
  12. // @require https://cdn.jsdelivr.net/npm/chart.js@4.4.8/dist/chart.umd.min.js
  13. // @license MIT
  14. // ==/UserScript==
  15.  
  16.  
  17. (function () {
  18. 'use strict';
  19.  
  20. let itemNamesCN = {
  21. '/items/coin': '金币',
  22. '/items/task_token': '任务代币',
  23. '/items/chimerical_token': '奇幻代币',
  24. '/items/sinister_token': '阴森代币',
  25. '/items/enchanted_token': '秘法代币',
  26. '/items/cowbell': '牛铃',
  27. '/items/bag_of_10_cowbells': '牛铃袋 (10个)',
  28. '/items/purples_gift': '小紫牛的礼物',
  29. '/items/small_meteorite_cache': '小陨石舱',
  30. '/items/medium_meteorite_cache': '中陨石舱',
  31. '/items/large_meteorite_cache': '大陨石舱',
  32. '/items/small_artisans_crate': '小工匠匣',
  33. '/items/medium_artisans_crate': '中工匠匣',
  34. '/items/large_artisans_crate': '大工匠匣',
  35. '/items/small_treasure_chest': '小宝箱',
  36. '/items/medium_treasure_chest': '中宝箱',
  37. '/items/large_treasure_chest': '大宝箱',
  38. '/items/chimerical_chest': '奇幻宝箱',
  39. '/items/sinister_chest': '阴森宝箱',
  40. '/items/enchanted_chest': '秘法宝箱',
  41. '/items/blue_key_fragment': '蓝色钥匙碎片',
  42. '/items/green_key_fragment': '绿色钥匙碎片',
  43. '/items/purple_key_fragment': '紫色钥匙碎片',
  44. '/items/white_key_fragment': '白色钥匙碎片',
  45. '/items/orange_key_fragment': '橙色钥匙碎片',
  46. '/items/brown_key_fragment': '棕色钥匙碎片',
  47. '/items/stone_key_fragment': '石头钥匙碎片',
  48. '/items/dark_key_fragment': '黑暗钥匙碎片',
  49. '/items/burning_key_fragment': '燃烧钥匙碎片',
  50. '/items/chimerical_entry_key': '奇幻钥匙',
  51. '/items/chimerical_chest_key': '奇幻宝箱钥匙',
  52. '/items/sinister_entry_key': '阴森钥匙',
  53. '/items/sinister_chest_key': '阴森宝箱钥匙',
  54. '/items/enchanted_entry_key': '秘法钥匙',
  55. '/items/enchanted_chest_key': '秘法宝箱钥匙',
  56. '/items/donut': '甜甜圈',
  57. '/items/blueberry_donut': '蓝莓甜甜圈',
  58. '/items/blackberry_donut': '黑莓甜甜圈',
  59. '/items/strawberry_donut': '草莓甜甜圈',
  60. '/items/mooberry_donut': '哞莓甜甜圈',
  61. '/items/marsberry_donut': '火星莓甜甜圈',
  62. '/items/spaceberry_donut': '太空莓甜甜圈',
  63. '/items/cupcake': '纸杯蛋糕',
  64. '/items/blueberry_cake': '蓝莓蛋糕',
  65. '/items/blackberry_cake': '黑莓蛋糕',
  66. '/items/strawberry_cake': '草莓蛋糕',
  67. '/items/mooberry_cake': '哞莓蛋糕',
  68. '/items/marsberry_cake': '火星莓蛋糕',
  69. '/items/spaceberry_cake': '太空莓蛋糕',
  70. '/items/gummy': '软糖',
  71. '/items/apple_gummy': '苹果软糖',
  72. '/items/orange_gummy': '橙子软糖',
  73. '/items/plum_gummy': '李子软糖',
  74. '/items/peach_gummy': '桃子软糖',
  75. '/items/dragon_fruit_gummy': '火龙果软糖',
  76. '/items/star_fruit_gummy': '杨桃软糖',
  77. '/items/yogurt': '酸奶',
  78. '/items/apple_yogurt': '苹果酸奶',
  79. '/items/orange_yogurt': '橙子酸奶',
  80. '/items/plum_yogurt': '李子酸奶',
  81. '/items/peach_yogurt': '桃子酸奶',
  82. '/items/dragon_fruit_yogurt': '火龙果酸奶',
  83. '/items/star_fruit_yogurt': '杨桃酸奶',
  84. '/items/milking_tea': '挤奶茶',
  85. '/items/foraging_tea': '采摘茶',
  86. '/items/woodcutting_tea': '伐木茶',
  87. '/items/cooking_tea': '烹饪茶',
  88. '/items/brewing_tea': '冲泡茶',
  89. '/items/alchemy_tea': '炼金茶',
  90. '/items/enhancing_tea': '强化茶',
  91. '/items/cheesesmithing_tea': '奶酪锻造茶',
  92. '/items/crafting_tea': '制作茶',
  93. '/items/tailoring_tea': '缝纫茶',
  94. '/items/super_milking_tea': '超级挤奶茶',
  95. '/items/super_foraging_tea': '超级采摘茶',
  96. '/items/super_woodcutting_tea': '超级伐木茶',
  97. '/items/super_cooking_tea': '超级烹饪茶',
  98. '/items/super_brewing_tea': '超级冲泡茶',
  99. '/items/super_alchemy_tea': '超级炼金茶',
  100. '/items/super_enhancing_tea': '超级强化茶',
  101. '/items/super_cheesesmithing_tea': '超级奶酪锻造茶',
  102. '/items/super_crafting_tea': '超级制作茶',
  103. '/items/super_tailoring_tea': '超级缝纫茶',
  104. '/items/ultra_milking_tea': '究极挤奶茶',
  105. '/items/ultra_foraging_tea': '究极采摘茶',
  106. '/items/ultra_woodcutting_tea': '究极伐木茶',
  107. '/items/ultra_cooking_tea': '究极烹饪茶',
  108. '/items/ultra_brewing_tea': '究极冲泡茶',
  109. '/items/ultra_alchemy_tea': '究极炼金茶',
  110. '/items/ultra_enhancing_tea': '究极强化茶',
  111. '/items/ultra_cheesesmithing_tea': '究极奶酪锻造茶',
  112. '/items/ultra_crafting_tea': '究极制作茶',
  113. '/items/ultra_tailoring_tea': '究极缝纫茶',
  114. '/items/gathering_tea': '采集茶',
  115. '/items/gourmet_tea': '美食茶',
  116. '/items/wisdom_tea': '经验茶',
  117. '/items/processing_tea': '加工茶',
  118. '/items/efficiency_tea': '效率茶',
  119. '/items/artisan_tea': '工匠茶',
  120. '/items/catalytic_tea': '催化茶',
  121. '/items/blessed_tea': '福气茶',
  122. '/items/stamina_coffee': '耐力咖啡',
  123. '/items/intelligence_coffee': '智力咖啡',
  124. '/items/defense_coffee': '防御咖啡',
  125. '/items/attack_coffee': '攻击咖啡',
  126. '/items/power_coffee': '力量咖啡',
  127. '/items/ranged_coffee': '远程咖啡',
  128. '/items/magic_coffee': '魔法咖啡',
  129. '/items/super_stamina_coffee': '超级耐力咖啡',
  130. '/items/super_intelligence_coffee': '超级智力咖啡',
  131. '/items/super_defense_coffee': '超级防御咖啡',
  132. '/items/super_attack_coffee': '超级攻击咖啡',
  133. '/items/super_power_coffee': '超级力量咖啡',
  134. '/items/super_ranged_coffee': '超级远程咖啡',
  135. '/items/super_magic_coffee': '超级魔法咖啡',
  136. '/items/ultra_stamina_coffee': '究极耐力咖啡',
  137. '/items/ultra_intelligence_coffee': '究极智力咖啡',
  138. '/items/ultra_defense_coffee': '究极防御咖啡',
  139. '/items/ultra_attack_coffee': '究极攻击咖啡',
  140. '/items/ultra_power_coffee': '究极力量咖啡',
  141. '/items/ultra_ranged_coffee': '究极远程咖啡',
  142. '/items/ultra_magic_coffee': '究极魔法咖啡',
  143. '/items/wisdom_coffee': '经验咖啡',
  144. '/items/lucky_coffee': '幸运咖啡',
  145. '/items/swiftness_coffee': '迅捷咖啡',
  146. '/items/channeling_coffee': '吟唱咖啡',
  147. '/items/critical_coffee': '暴击咖啡',
  148. '/items/poke': '破胆之刺',
  149. '/items/impale': '透骨之刺',
  150. '/items/puncture': '破甲之刺',
  151. '/items/penetrating_strike': '贯心之刺',
  152. '/items/scratch': '爪影斩',
  153. '/items/cleave': '分裂斩',
  154. '/items/maim': '血刃斩',
  155. '/items/crippling_slash': '致残斩',
  156. '/items/smack': '重碾',
  157. '/items/sweep': '重扫',
  158. '/items/stunning_blow': '重锤',
  159. '/items/quick_shot': '快速射击',
  160. '/items/aqua_arrow': '流水箭',
  161. '/items/flame_arrow': '烈焰箭',
  162. '/items/rain_of_arrows': '箭雨',
  163. '/items/silencing_shot': '沉默之箭',
  164. '/items/steady_shot': '稳定射击',
  165. '/items/pestilent_shot': '疫病射击',
  166. '/items/penetrating_shot': '贯穿射击',
  167. '/items/water_strike': '流水冲击',
  168. '/items/ice_spear': '冰枪术',
  169. '/items/frost_surge': '冰霜爆裂',
  170. '/items/mana_spring': '法力喷泉',
  171. '/items/entangle': '缠绕',
  172. '/items/toxic_pollen': '剧毒粉尘',
  173. '/items/natures_veil': '自然菌幕',
  174. '/items/fireball': '火球',
  175. '/items/flame_blast': '熔岩爆裂',
  176. '/items/firestorm': '火焰风暴',
  177. '/items/smoke_burst': '烟爆灭影',
  178. '/items/minor_heal': '初级自愈术',
  179. '/items/heal': '自愈术',
  180. '/items/quick_aid': '快速治疗术',
  181. '/items/rejuvenate': '群体治疗术',
  182. '/items/taunt': '嘲讽',
  183. '/items/provoke': '挑衅',
  184. '/items/toughness': '坚韧',
  185. '/items/elusiveness': '闪避',
  186. '/items/precision': '精确',
  187. '/items/berserk': '狂暴',
  188. '/items/elemental_affinity': '元素增幅',
  189. '/items/frenzy': '狂速',
  190. '/items/spike_shell': '尖刺防护',
  191. '/items/arcane_reflection': '奥术反射',
  192. '/items/vampirism': '吸血',
  193. '/items/revive': '复活',
  194. '/items/insanity': '疯狂',
  195. '/items/invincible': '无敌',
  196. '/items/fierce_aura': '物理光环',
  197. '/items/aqua_aura': '流水光环',
  198. '/items/sylvan_aura': '自然光环',
  199. '/items/flame_aura': '火焰光环',
  200. '/items/speed_aura': '速度光环',
  201. '/items/critical_aura': '暴击光环',
  202. '/items/gobo_stabber': '哥布林长剑',
  203. '/items/gobo_slasher': '哥布林关刀',
  204. '/items/gobo_smasher': '哥布林狼牙棒',
  205. '/items/spiked_bulwark': '尖刺盾',
  206. '/items/werewolf_slasher': '狼人关刀',
  207. '/items/griffin_bulwark': '狮鹫重盾',
  208. '/items/gobo_shooter': '哥布林弹弓',
  209. '/items/vampiric_bow': '吸血弓',
  210. '/items/cursed_bow': '咒怨之弓',
  211. '/items/gobo_boomstick': '哥布林火棍',
  212. '/items/cheese_bulwark': '奶酪重盾',
  213. '/items/verdant_bulwark': '翠绿重盾',
  214. '/items/azure_bulwark': '蔚蓝重盾',
  215. '/items/burble_bulwark': '深紫重盾',
  216. '/items/crimson_bulwark': '绛红重盾',
  217. '/items/rainbow_bulwark': '彩虹重盾',
  218. '/items/holy_bulwark': '神圣重盾',
  219. '/items/wooden_bow': '木弓',
  220. '/items/birch_bow': '桦木弓',
  221. '/items/cedar_bow': '雪松弓',
  222. '/items/purpleheart_bow': '紫心弓',
  223. '/items/ginkgo_bow': '银杏弓',
  224. '/items/redwood_bow': '红杉弓',
  225. '/items/arcane_bow': '神秘弓',
  226. '/items/stalactite_spear': '石钟长枪',
  227. '/items/granite_bludgeon': '花岗岩大棒',
  228. '/items/regal_sword': '君王之剑',
  229. '/items/chaotic_flail': '混沌连枷',
  230. '/items/soul_hunter_crossbow': '灵魂猎手弩',
  231. '/items/sundering_crossbow': '裂空之弩',
  232. '/items/frost_staff': '冰霜法杖',
  233. '/items/infernal_battlestaff': '炼狱法杖',
  234. '/items/jackalope_staff': '鹿角兔之杖',
  235. '/items/cheese_sword': '奶酪剑',
  236. '/items/verdant_sword': '翠绿剑',
  237. '/items/azure_sword': '蔚蓝剑',
  238. '/items/burble_sword': '深紫剑',
  239. '/items/crimson_sword': '绛红剑',
  240. '/items/rainbow_sword': '彩虹剑',
  241. '/items/holy_sword': '神圣剑',
  242. '/items/cheese_spear': '奶酪长枪',
  243. '/items/verdant_spear': '翠绿长枪',
  244. '/items/azure_spear': '蔚蓝长枪',
  245. '/items/burble_spear': '深紫长枪',
  246. '/items/crimson_spear': '绛红长枪',
  247. '/items/rainbow_spear': '彩虹长枪',
  248. '/items/holy_spear': '神圣长枪',
  249. '/items/cheese_mace': '奶酪钉头锤',
  250. '/items/verdant_mace': '翠绿钉头锤',
  251. '/items/azure_mace': '蔚蓝钉头锤',
  252. '/items/burble_mace': '深紫钉头锤',
  253. '/items/crimson_mace': '绛红钉头锤',
  254. '/items/rainbow_mace': '彩虹钉头锤',
  255. '/items/holy_mace': '神圣钉头锤',
  256. '/items/wooden_crossbow': '木弩',
  257. '/items/birch_crossbow': '桦木弩',
  258. '/items/cedar_crossbow': '雪松弩',
  259. '/items/purpleheart_crossbow': '紫心弩',
  260. '/items/ginkgo_crossbow': '银杏弩',
  261. '/items/redwood_crossbow': '红杉弩',
  262. '/items/arcane_crossbow': '神秘弩',
  263. '/items/wooden_water_staff': '木制水法杖',
  264. '/items/birch_water_staff': '桦木水法杖',
  265. '/items/cedar_water_staff': '雪松水法杖',
  266. '/items/purpleheart_water_staff': '紫心水法杖',
  267. '/items/ginkgo_water_staff': '银杏水法杖',
  268. '/items/redwood_water_staff': '红杉水法杖',
  269. '/items/arcane_water_staff': '神秘水法杖',
  270. '/items/wooden_nature_staff': '木制自然法杖',
  271. '/items/birch_nature_staff': '桦木自然法杖',
  272. '/items/cedar_nature_staff': '雪松自然法杖',
  273. '/items/purpleheart_nature_staff': '紫心自然法杖',
  274. '/items/ginkgo_nature_staff': '银杏自然法杖',
  275. '/items/redwood_nature_staff': '红杉自然法杖',
  276. '/items/arcane_nature_staff': '神秘自然法杖',
  277. '/items/wooden_fire_staff': '木火法杖',
  278. '/items/birch_fire_staff': '桦木火法杖',
  279. '/items/cedar_fire_staff': '雪松火法杖',
  280. '/items/purpleheart_fire_staff': '紫心火法杖',
  281. '/items/ginkgo_fire_staff': '银杏火法杖',
  282. '/items/redwood_fire_staff': '红杉火法杖',
  283. '/items/arcane_fire_staff': '神秘火法杖',
  284. '/items/eye_watch': '掌上监工',
  285. '/items/snake_fang_dirk': '蛇牙短剑',
  286. '/items/vision_shield': '视觉盾',
  287. '/items/gobo_defender': '哥布林防御者',
  288. '/items/vampire_fang_dirk': '吸血鬼短剑',
  289. '/items/knights_aegis': '骑士盾',
  290. '/items/treant_shield': '树人盾',
  291. '/items/manticore_shield': '蝎狮盾',
  292. '/items/tome_of_healing': '治疗之书',
  293. '/items/tome_of_the_elements': '元素之书',
  294. '/items/watchful_relic': '警戒遗物',
  295. '/items/bishops_codex': '主教法典',
  296. '/items/cheese_buckler': '奶酪圆盾',
  297. '/items/verdant_buckler': '翠绿圆盾',
  298. '/items/azure_buckler': '蔚蓝圆盾',
  299. '/items/burble_buckler': '深紫圆盾',
  300. '/items/crimson_buckler': '绛红圆盾',
  301. '/items/rainbow_buckler': '彩虹圆盾',
  302. '/items/holy_buckler': '神圣圆盾',
  303. '/items/wooden_shield': '木盾',
  304. '/items/birch_shield': '桦木盾',
  305. '/items/cedar_shield': '雪松盾',
  306. '/items/purpleheart_shield': '紫心盾',
  307. '/items/ginkgo_shield': '银杏盾',
  308. '/items/redwood_shield': '红杉盾',
  309. '/items/arcane_shield': '神秘盾',
  310. '/items/sinister_cape': '阴森斗篷',
  311. '/items/chimerical_quiver': '奇幻箭袋',
  312. '/items/enchanted_cloak': '秘法披风',
  313. '/items/red_culinary_hat': '红色厨师帽',
  314. '/items/snail_shell_helmet': '蜗牛壳头盔',
  315. '/items/vision_helmet': '视觉头盔',
  316. '/items/fluffy_red_hat': '蓬松红帽子',
  317. '/items/acrobatic_hood': '杂技师兜帽',
  318. '/items/magicians_hat': '魔术师帽',
  319. '/items/cheese_helmet': '奶酪头盔',
  320. '/items/verdant_helmet': '翠绿头盔',
  321. '/items/azure_helmet': '蔚蓝头盔',
  322. '/items/burble_helmet': '深紫头盔',
  323. '/items/crimson_helmet': '绛红头盔',
  324. '/items/rainbow_helmet': '彩虹头盔',
  325. '/items/holy_helmet': '神圣头盔',
  326. '/items/rough_hood': '粗糙兜帽',
  327. '/items/reptile_hood': '爬行动物兜帽',
  328. '/items/gobo_hood': '哥布林兜帽',
  329. '/items/beast_hood': '野兽兜帽',
  330. '/items/umbral_hood': '暗影兜帽',
  331. '/items/cotton_hat': '棉帽',
  332. '/items/linen_hat': '亚麻帽',
  333. '/items/bamboo_hat': '竹帽',
  334. '/items/silk_hat': '丝帽',
  335. '/items/radiant_hat': '光辉帽',
  336. '/items/dairyhands_top': '挤奶工上衣',
  337. '/items/foragers_top': '采摘者上衣',
  338. '/items/lumberjacks_top': '伐木工上衣',
  339. '/items/cheesemakers_top': '奶酪师上衣',
  340. '/items/crafters_top': '工匠上衣',
  341. '/items/tailors_top': '裁缝上衣',
  342. '/items/chefs_top': '厨师上衣',
  343. '/items/brewers_top': '饮品师上衣',
  344. '/items/alchemists_top': '炼金师上衣',
  345. '/items/enhancers_top': '强化师上衣',
  346. '/items/gator_vest': '鳄鱼马甲',
  347. '/items/turtle_shell_body': '龟壳胸甲',
  348. '/items/colossus_plate_body': '巨像胸甲',
  349. '/items/demonic_plate_body': '恶魔胸甲',
  350. '/items/marine_tunic': '海洋皮衣',
  351. '/items/revenant_tunic': '亡灵皮衣',
  352. '/items/griffin_tunic': '狮鹫皮衣',
  353. '/items/icy_robe_top': '冰霜袍服',
  354. '/items/flaming_robe_top': '烈焰袍服',
  355. '/items/luna_robe_top': '月神袍服',
  356. '/items/royal_water_robe_top': '皇家水系袍服',
  357. '/items/royal_nature_robe_top': '皇家自然系袍服',
  358. '/items/royal_fire_robe_top': '皇家火系袍服',
  359. '/items/cheese_plate_body': '奶酪胸甲',
  360. '/items/verdant_plate_body': '翠绿胸甲',
  361. '/items/azure_plate_body': '蔚蓝胸甲',
  362. '/items/burble_plate_body': '深紫胸甲',
  363. '/items/crimson_plate_body': '绛红胸甲',
  364. '/items/rainbow_plate_body': '彩虹胸甲',
  365. '/items/holy_plate_body': '神圣胸甲',
  366. '/items/rough_tunic': '粗糙皮衣',
  367. '/items/reptile_tunic': '爬行动物皮衣',
  368. '/items/gobo_tunic': '哥布林皮衣',
  369. '/items/beast_tunic': '野兽皮衣',
  370. '/items/umbral_tunic': '暗影皮衣',
  371. '/items/cotton_robe_top': '棉布袍服',
  372. '/items/linen_robe_top': '亚麻袍服',
  373. '/items/bamboo_robe_top': '竹袍服',
  374. '/items/silk_robe_top': '丝绸袍服',
  375. '/items/radiant_robe_top': '光辉袍服',
  376. '/items/dairyhands_bottoms': '挤奶工下装',
  377. '/items/foragers_bottoms': '采摘者下装',
  378. '/items/lumberjacks_bottoms': '伐木工下装',
  379. '/items/cheesemakers_bottoms': '奶酪师下装',
  380. '/items/crafters_bottoms': '工匠下装',
  381. '/items/tailors_bottoms': '裁缝下装',
  382. '/items/chefs_bottoms': '厨师下装',
  383. '/items/brewers_bottoms': '饮品师下装',
  384. '/items/alchemists_bottoms': '炼金师下装',
  385. '/items/enhancers_bottoms': '强化师下装',
  386. '/items/turtle_shell_legs': '龟壳腿甲',
  387. '/items/colossus_plate_legs': '巨像腿甲',
  388. '/items/demonic_plate_legs': '恶魔腿甲',
  389. '/items/marine_chaps': '航海皮裤',
  390. '/items/revenant_chaps': '亡灵皮裤',
  391. '/items/griffin_chaps': '狮鹫皮裤',
  392. '/items/icy_robe_bottoms': '冰霜袍裙',
  393. '/items/flaming_robe_bottoms': '烈焰袍裙',
  394. '/items/luna_robe_bottoms': '月神袍裙',
  395. '/items/royal_water_robe_bottoms': '皇家水系袍裙',
  396. '/items/royal_nature_robe_bottoms': '皇家自然系袍裙',
  397. '/items/royal_fire_robe_bottoms': '皇家火系袍裙',
  398. '/items/cheese_plate_legs': '奶酪腿甲',
  399. '/items/verdant_plate_legs': '翠绿腿甲',
  400. '/items/azure_plate_legs': '蔚蓝腿甲',
  401. '/items/burble_plate_legs': '深紫腿甲',
  402. '/items/crimson_plate_legs': '绛红腿甲',
  403. '/items/rainbow_plate_legs': '彩虹腿甲',
  404. '/items/holy_plate_legs': '神圣腿甲',
  405. '/items/rough_chaps': '粗糙皮裤',
  406. '/items/reptile_chaps': '爬行动物皮裤',
  407. '/items/gobo_chaps': '哥布林皮裤',
  408. '/items/beast_chaps': '野兽皮裤',
  409. '/items/umbral_chaps': '暗影皮裤',
  410. '/items/cotton_robe_bottoms': '棉袍裙',
  411. '/items/linen_robe_bottoms': '亚麻袍裙',
  412. '/items/bamboo_robe_bottoms': '竹袍裙',
  413. '/items/silk_robe_bottoms': '丝绸袍裙',
  414. '/items/radiant_robe_bottoms': '光辉袍裙',
  415. '/items/enchanted_gloves': '附魔手套',
  416. '/items/pincer_gloves': '蟹钳手套',
  417. '/items/panda_gloves': '熊猫手套',
  418. '/items/magnetic_gloves': '磁力手套',
  419. '/items/dodocamel_gauntlets': '渡渡驼护手',
  420. '/items/sighted_bracers': '瞄准护腕',
  421. '/items/chrono_gloves': '时空手套',
  422. '/items/cheese_gauntlets': '奶酪护手',
  423. '/items/verdant_gauntlets': '翠绿护手',
  424. '/items/azure_gauntlets': '蔚蓝护手',
  425. '/items/burble_gauntlets': '深紫护手',
  426. '/items/crimson_gauntlets': '绛红护手',
  427. '/items/rainbow_gauntlets': '彩虹护手',
  428. '/items/holy_gauntlets': '神圣护手',
  429. '/items/rough_bracers': '粗糙护腕',
  430. '/items/reptile_bracers': '爬行动物护腕',
  431. '/items/gobo_bracers': '哥布林护腕',
  432. '/items/beast_bracers': '野兽护腕',
  433. '/items/umbral_bracers': '暗影护腕',
  434. '/items/cotton_gloves': '棉手套',
  435. '/items/linen_gloves': '亚麻手套',
  436. '/items/bamboo_gloves': '竹手套',
  437. '/items/silk_gloves': '丝手套',
  438. '/items/radiant_gloves': '光辉手套',
  439. '/items/collectors_boots': '收藏家靴',
  440. '/items/shoebill_shoes': '鲸头鹳鞋',
  441. '/items/black_bear_shoes': '黑熊鞋',
  442. '/items/grizzly_bear_shoes': '棕熊鞋',
  443. '/items/polar_bear_shoes': '北极熊鞋',
  444. '/items/centaur_boots': '半人马靴',
  445. '/items/sorcerer_boots': '巫师靴',
  446. '/items/cheese_boots': '奶酪靴',
  447. '/items/verdant_boots': '翠绿靴',
  448. '/items/azure_boots': '蔚蓝靴',
  449. '/items/burble_boots': '深紫靴',
  450. '/items/crimson_boots': '绛红靴',
  451. '/items/rainbow_boots': '彩虹靴',
  452. '/items/holy_boots': '神圣靴',
  453. '/items/rough_boots': '粗糙靴',
  454. '/items/reptile_boots': '爬行动物靴',
  455. '/items/gobo_boots': '哥布林靴',
  456. '/items/beast_boots': '野兽靴',
  457. '/items/umbral_boots': '暗影靴',
  458. '/items/cotton_boots': '棉靴',
  459. '/items/linen_boots': '亚麻靴',
  460. '/items/bamboo_boots': '竹靴',
  461. '/items/silk_boots': '丝靴',
  462. '/items/radiant_boots': '光辉靴',
  463. '/items/small_pouch': '小袋子',
  464. '/items/medium_pouch': '中袋子',
  465. '/items/large_pouch': '大袋子',
  466. '/items/giant_pouch': '巨大袋子',
  467. '/items/gluttonous_pouch': '贪食之袋',
  468. '/items/guzzling_pouch': '暴饮之囊',
  469. '/items/necklace_of_efficiency': '效率项链',
  470. '/items/fighter_necklace': '战士项链',
  471. '/items/ranger_necklace': '射手项链',
  472. '/items/wizard_necklace': '巫师项链',
  473. '/items/necklace_of_wisdom': '经验项链',
  474. '/items/necklace_of_speed': '速度项链',
  475. '/items/philosophers_necklace': '贤者项链',
  476. '/items/earrings_of_gathering': '采集耳环',
  477. '/items/earrings_of_essence_find': '精华发现耳环',
  478. '/items/earrings_of_armor': '护甲耳环',
  479. '/items/earrings_of_regeneration': '恢复耳环',
  480. '/items/earrings_of_resistance': '抗性耳环',
  481. '/items/earrings_of_rare_find': '稀有发现耳环',
  482. '/items/earrings_of_critical_strike': '暴击耳环',
  483. '/items/philosophers_earrings': '贤者耳环',
  484. '/items/ring_of_gathering': '采集戒指',
  485. '/items/ring_of_essence_find': '精华发现戒指',
  486. '/items/ring_of_armor': '护甲戒指',
  487. '/items/ring_of_regeneration': '恢复戒指',
  488. '/items/ring_of_resistance': '抗性戒指',
  489. '/items/ring_of_rare_find': '稀有发现戒指',
  490. '/items/ring_of_critical_strike': '暴击戒指',
  491. '/items/philosophers_ring': '贤者戒指',
  492. '/items/basic_task_badge': '基础任务徽章',
  493. '/items/advanced_task_badge': '高级任务徽章',
  494. '/items/expert_task_badge': '专家任务徽章',
  495. '/items/celestial_brush': '星空刷子',
  496. '/items/cheese_brush': '奶酪刷子',
  497. '/items/verdant_brush': '翠绿刷子',
  498. '/items/azure_brush': '蔚蓝刷子',
  499. '/items/burble_brush': '深紫刷子',
  500. '/items/crimson_brush': '绛红刷子',
  501. '/items/rainbow_brush': '彩虹刷子',
  502. '/items/holy_brush': '神圣刷子',
  503. '/items/celestial_shears': '星空剪刀',
  504. '/items/cheese_shears': '奶酪剪刀',
  505. '/items/verdant_shears': '翠绿剪刀',
  506. '/items/azure_shears': '蔚蓝剪刀',
  507. '/items/burble_shears': '深紫剪刀',
  508. '/items/crimson_shears': '绛红剪刀',
  509. '/items/rainbow_shears': '彩虹剪刀',
  510. '/items/holy_shears': '神圣剪刀',
  511. '/items/celestial_hatchet': '星空斧头',
  512. '/items/cheese_hatchet': '奶酪斧头',
  513. '/items/verdant_hatchet': '翠绿斧头',
  514. '/items/azure_hatchet': '蔚蓝斧头',
  515. '/items/burble_hatchet': '深紫斧头',
  516. '/items/crimson_hatchet': '绛红斧头',
  517. '/items/rainbow_hatchet': '彩虹斧头',
  518. '/items/holy_hatchet': '神圣斧头',
  519. '/items/celestial_hammer': '星空锤子',
  520. '/items/cheese_hammer': '奶酪锤子',
  521. '/items/verdant_hammer': '翠绿锤子',
  522. '/items/azure_hammer': '蔚蓝锤子',
  523. '/items/burble_hammer': '深紫锤子',
  524. '/items/crimson_hammer': '绛红锤子',
  525. '/items/rainbow_hammer': '彩虹锤子',
  526. '/items/holy_hammer': '神圣锤子',
  527. '/items/celestial_chisel': '星空凿子',
  528. '/items/cheese_chisel': '奶酪凿子',
  529. '/items/verdant_chisel': '翠绿凿子',
  530. '/items/azure_chisel': '蔚蓝凿子',
  531. '/items/burble_chisel': '深紫凿子',
  532. '/items/crimson_chisel': '绛红凿子',
  533. '/items/rainbow_chisel': '彩虹凿子',
  534. '/items/holy_chisel': '神圣凿子',
  535. '/items/celestial_needle': '星空针',
  536. '/items/cheese_needle': '奶酪针',
  537. '/items/verdant_needle': '翠绿针',
  538. '/items/azure_needle': '蔚蓝针',
  539. '/items/burble_needle': '深紫针',
  540. '/items/crimson_needle': '绛红针',
  541. '/items/rainbow_needle': '彩虹针',
  542. '/items/holy_needle': '神圣针',
  543. '/items/celestial_spatula': '星空锅铲',
  544. '/items/cheese_spatula': '奶酪锅铲',
  545. '/items/verdant_spatula': '翠绿锅铲',
  546. '/items/azure_spatula': '蔚蓝锅铲',
  547. '/items/burble_spatula': '深紫锅铲',
  548. '/items/crimson_spatula': '绛红锅铲',
  549. '/items/rainbow_spatula': '彩虹锅铲',
  550. '/items/holy_spatula': '神圣锅铲',
  551. '/items/celestial_pot': '星空壶',
  552. '/items/cheese_pot': '奶酪壶',
  553. '/items/verdant_pot': '翠绿壶',
  554. '/items/azure_pot': '蔚蓝壶',
  555. '/items/burble_pot': '深紫壶',
  556. '/items/crimson_pot': '绛红壶',
  557. '/items/rainbow_pot': '彩虹壶',
  558. '/items/holy_pot': '神圣壶',
  559. '/items/celestial_alembic': '星空蒸馏器',
  560. '/items/cheese_alembic': '奶酪蒸馏器',
  561. '/items/verdant_alembic': '翠绿蒸馏器',
  562. '/items/azure_alembic': '蔚蓝蒸馏器',
  563. '/items/burble_alembic': '深紫蒸馏器',
  564. '/items/crimson_alembic': '绛红蒸馏器',
  565. '/items/rainbow_alembic': '彩虹蒸馏器',
  566. '/items/holy_alembic': '神圣蒸馏器',
  567. '/items/celestial_enhancer': '星空强化器',
  568. '/items/cheese_enhancer': '奶酪强化器',
  569. '/items/verdant_enhancer': '翠绿强化器',
  570. '/items/azure_enhancer': '蔚蓝强化器',
  571. '/items/burble_enhancer': '深紫强化器',
  572. '/items/crimson_enhancer': '绛红强化器',
  573. '/items/rainbow_enhancer': '彩虹强化器',
  574. '/items/holy_enhancer': '神圣强化器',
  575. '/items/milk': '牛奶',
  576. '/items/verdant_milk': '翠绿牛奶',
  577. '/items/azure_milk': '蔚蓝牛奶',
  578. '/items/burble_milk': '深紫牛奶',
  579. '/items/crimson_milk': '绛红牛奶',
  580. '/items/rainbow_milk': '彩虹牛奶',
  581. '/items/holy_milk': '神圣牛奶',
  582. '/items/cheese': '奶酪',
  583. '/items/verdant_cheese': '翠绿奶酪',
  584. '/items/azure_cheese': '蔚蓝奶酪',
  585. '/items/burble_cheese': '深紫奶酪',
  586. '/items/crimson_cheese': '绛红奶酪',
  587. '/items/rainbow_cheese': '彩虹奶酪',
  588. '/items/holy_cheese': '神圣奶酪',
  589. '/items/log': '原木',
  590. '/items/birch_log': '白桦原木',
  591. '/items/cedar_log': '雪松原木',
  592. '/items/purpleheart_log': '紫心原木',
  593. '/items/ginkgo_log': '银杏原木',
  594. '/items/redwood_log': '红杉原木',
  595. '/items/arcane_log': '神秘原木',
  596. '/items/lumber': '木板',
  597. '/items/birch_lumber': '白桦木板',
  598. '/items/cedar_lumber': '雪松木板',
  599. '/items/purpleheart_lumber': '紫心木板',
  600. '/items/ginkgo_lumber': '银杏木板',
  601. '/items/redwood_lumber': '红杉木板',
  602. '/items/arcane_lumber': '神秘木板',
  603. '/items/rough_hide': '粗糙兽皮',
  604. '/items/reptile_hide': '爬行动物皮',
  605. '/items/gobo_hide': '哥布林皮',
  606. '/items/beast_hide': '野兽皮',
  607. '/items/umbral_hide': '暗影皮',
  608. '/items/rough_leather': '粗糙皮革',
  609. '/items/reptile_leather': '爬行动物皮革',
  610. '/items/gobo_leather': '哥布林皮革',
  611. '/items/beast_leather': '野兽皮革',
  612. '/items/umbral_leather': '暗影皮革',
  613. '/items/cotton': '棉花',
  614. '/items/flax': '亚麻',
  615. '/items/bamboo_branch': '竹子',
  616. '/items/cocoon': '蚕茧',
  617. '/items/radiant_fiber': '光辉纤维',
  618. '/items/cotton_fabric': '棉花布料',
  619. '/items/linen_fabric': '亚麻布料',
  620. '/items/bamboo_fabric': '竹子布料',
  621. '/items/silk_fabric': '丝绸',
  622. '/items/radiant_fabric': '光辉布料',
  623. '/items/egg': '鸡蛋',
  624. '/items/wheat': '小麦',
  625. '/items/sugar': '糖',
  626. '/items/blueberry': '蓝莓',
  627. '/items/blackberry': '黑莓',
  628. '/items/strawberry': '草莓',
  629. '/items/mooberry': '哞梅',
  630. '/items/marsberry': '火星梅',
  631. '/items/spaceberry': '太空梅',
  632. '/items/apple': '苹果',
  633. '/items/orange': '橙子',
  634. '/items/plum': '李子',
  635. '/items/peach': '桃子',
  636. '/items/dragon_fruit': '火龙果',
  637. '/items/star_fruit': '杨桃',
  638. '/items/arabica_coffee_bean': '低级咖啡豆',
  639. '/items/robusta_coffee_bean': '中级咖啡豆',
  640. '/items/liberica_coffee_bean': '高级咖啡豆',
  641. '/items/excelsa_coffee_bean': '特级咖啡豆',
  642. '/items/fieriosa_coffee_bean': '火山咖啡豆',
  643. '/items/spacia_coffee_bean': '太空咖啡豆',
  644. '/items/green_tea_leaf': '绿茶叶',
  645. '/items/black_tea_leaf': '黑茶叶',
  646. '/items/burble_tea_leaf': '紫茶叶',
  647. '/items/moolong_tea_leaf': '哞龙茶叶',
  648. '/items/red_tea_leaf': '红茶叶',
  649. '/items/emp_tea_leaf': '虚空茶叶',
  650. '/items/catalyst_of_coinification': '点金催化剂',
  651. '/items/catalyst_of_decomposition': '分解催化剂',
  652. '/items/catalyst_of_transmutation': '转化催化剂',
  653. '/items/prime_catalyst': '至高催化剂',
  654. '/items/snake_fang': '蛇牙',
  655. '/items/shoebill_feather': '鲸头鹳羽毛',
  656. '/items/snail_shell': '蜗牛壳',
  657. '/items/crab_pincer': '蟹钳',
  658. '/items/turtle_shell': '乌龟壳',
  659. '/items/marine_scale': '海洋鳞片',
  660. '/items/treant_bark': '树皮',
  661. '/items/centaur_hoof': '半人马蹄',
  662. '/items/luna_wing': '月神翼',
  663. '/items/gobo_rag': '哥布林抹布',
  664. '/items/goggles': '护目镜',
  665. '/items/magnifying_glass': '放大镜',
  666. '/items/eye_of_the_watcher': '观察者之眼',
  667. '/items/icy_cloth': '冰霜织物',
  668. '/items/flaming_cloth': '烈焰织物',
  669. '/items/sorcerers_sole': '魔法师鞋底',
  670. '/items/chrono_sphere': '时空球',
  671. '/items/frost_sphere': '冰霜球',
  672. '/items/panda_fluff': '熊猫绒',
  673. '/items/black_bear_fluff': '黑熊绒',
  674. '/items/grizzly_bear_fluff': '棕熊绒',
  675. '/items/polar_bear_fluff': '北极熊绒',
  676. '/items/red_panda_fluff': '小熊猫绒',
  677. '/items/magnet': '磁铁',
  678. '/items/stalactite_shard': '钟乳石碎片',
  679. '/items/living_granite': '花岗岩',
  680. '/items/colossus_core': '巨像核心',
  681. '/items/vampire_fang': '吸血鬼之牙',
  682. '/items/werewolf_claw': '狼人之爪',
  683. '/items/revenant_anima': '亡者之魂',
  684. '/items/soul_fragment': '灵魂碎片',
  685. '/items/infernal_ember': '地狱余烬',
  686. '/items/demonic_core': '恶魔核心',
  687. '/items/griffin_leather': '狮鹫之皮',
  688. '/items/manticore_sting': '蝎狮之刺',
  689. '/items/jackalope_antler': '鹿角兔之角',
  690. '/items/dodocamel_plume': '渡渡驼之翎',
  691. '/items/griffin_talon': '狮鹫之爪',
  692. '/items/acrobats_ribbon': '杂技师彩带',
  693. '/items/magicians_cloth': '魔术师织物',
  694. '/items/chaotic_chain': '混沌锁链',
  695. '/items/cursed_ball': '诅咒之球',
  696. '/items/royal_cloth': '皇家织物',
  697. '/items/knights_ingot': '骑士之锭',
  698. '/items/bishops_scroll': '主教卷轴',
  699. '/items/regal_jewel': '君王宝石',
  700. '/items/sundering_jewel': '裂空宝石',
  701. '/items/butter_of_proficiency': '精通之油',
  702. '/items/thread_of_expertise': '专精之线',
  703. '/items/branch_of_insight': '洞察之枝',
  704. '/items/gluttonous_energy': '贪食能量',
  705. '/items/guzzling_energy': '暴饮能量',
  706. '/items/milking_essence': '挤奶精华',
  707. '/items/foraging_essence': '采摘精华',
  708. '/items/woodcutting_essence': '伐木精华',
  709. '/items/cheesesmithing_essence': '奶酪锻造精华',
  710. '/items/crafting_essence': '制作精华',
  711. '/items/tailoring_essence': '缝纫精华',
  712. '/items/cooking_essence': '烹饪精华',
  713. '/items/brewing_essence': '冲泡精华',
  714. '/items/alchemy_essence': '炼金精华',
  715. '/items/enhancing_essence': '强化精华',
  716. '/items/swamp_essence': '沼泽精华',
  717. '/items/aqua_essence': '海洋精华',
  718. '/items/jungle_essence': '丛林精华',
  719. '/items/gobo_essence': '哥布林精华',
  720. '/items/eyessence': '眼精华',
  721. '/items/sorcerer_essence': '法师精华',
  722. '/items/bear_essence': '熊熊精华',
  723. '/items/golem_essence': '魔像精华',
  724. '/items/twilight_essence': '暮光精华',
  725. '/items/abyssal_essence': '地狱精华',
  726. '/items/chimerical_essence': '奇幻精华',
  727. '/items/sinister_essence': '阴森精华',
  728. '/items/enchanted_essence': '秘法精华',
  729. '/items/task_crystal': '任务水晶',
  730. '/items/star_fragment': '星光碎片',
  731. '/items/pearl': '珍珠',
  732. '/items/amber': '琥珀',
  733. '/items/garnet': '石榴石',
  734. '/items/jade': '翡翠',
  735. '/items/amethyst': '紫水晶',
  736. '/items/moonstone': '月亮石',
  737. '/items/sunstone': '太阳石',
  738. '/items/philosophers_stone': '贤者之石',
  739. '/items/crushed_pearl': '珍珠碎片',
  740. '/items/crushed_amber': '琥珀碎片',
  741. '/items/crushed_garnet': '石榴石碎片',
  742. '/items/crushed_jade': '翡翠碎片',
  743. '/items/crushed_amethyst': '紫水晶碎片',
  744. '/items/crushed_moonstone': '月亮石碎片',
  745. '/items/crushed_sunstone': '太阳石碎片',
  746. '/items/crushed_philosophers_stone': '贤者之石碎片',
  747. '/items/shard_of_protection': '保护碎片',
  748. '/items/mirror_of_protection': '保护之镜'
  749. };
  750. let trade_history = {};
  751. if (localStorage.getItem("mooket_trade_history")) {
  752. trade_history = JSON.parse(localStorage.getItem("mooket_trade_history"));
  753. }
  754.  
  755.  
  756. let initData_itemDetailMap = null;
  757. if (localStorage.getItem("initClientData")) {
  758. const obj = JSON.parse(localStorage.getItem("initClientData"));
  759. initData_itemDetailMap = obj.itemDetailMap;
  760. }
  761. function hookWS() {
  762. const dataProperty = Object.getOwnPropertyDescriptor(MessageEvent.prototype, "data");
  763. const oriGet = dataProperty.get;
  764. dataProperty.get = hookedGet;
  765. Object.defineProperty(MessageEvent.prototype, "data", dataProperty);
  766.  
  767. function hookedGet() {
  768. const socket = this.currentTarget;
  769. if (!(socket instanceof WebSocket)) {
  770. return oriGet.call(this);
  771. }
  772. if (socket.url.indexOf("api.milkywayidle.com/ws") <= -1 && socket.url.indexOf("api-test.milkywayidle.com/ws") <= -1) {
  773. return oriGet.call(this);
  774. }
  775. const message = oriGet.call(this);
  776. Object.defineProperty(this, "data", { value: message }); // Anti-loop
  777. try { handleMessage(message); }
  778. catch (e) { console.log("handleMessage error:", e); }
  779. return message;
  780. }
  781. }
  782. function handleMessage(message) {
  783. let obj = JSON.parse(message);
  784. if (obj && obj.type === "init_client_data") {
  785. initData_itemDetailMap = obj.itemDetailMap;
  786. }
  787. else if (obj && obj.type === "market_item_order_books_updated") {
  788. requestItemPrice(obj.marketItemOrderBooks.itemHrid, cur_day);
  789. } else if (obj && obj.type === "market_listings_updated") {//挂单变动
  790. obj.endMarketListings.forEach(order => {
  791. if (order.filledQuantity == 0) return;//没有成交的订单不记录
  792. let key = order.itemHrid + "_" + order.enhancementLevel;
  793.  
  794. let tradeItem = trade_history[key] || {}
  795. if (order.isSell) {
  796. tradeItem.sell = order.price;
  797. } else {
  798. tradeItem.buy = order.price;
  799. }
  800. trade_history[key] = tradeItem;
  801. });
  802. localStorage.setItem("mooket_trade_history", JSON.stringify(trade_history));//保存挂单数据
  803.  
  804. }
  805. return message;
  806. }
  807.  
  808. hookWS();
  809.  
  810. let cur_day = 1;
  811. let curHridName = null;
  812. let curItemNameCN = null;
  813. let w = "500px";
  814. let h = "280px";
  815. let configStr = localStorage.getItem("mooket_config");
  816. let config = configStr ? JSON.parse(configStr) : { "dayIndex": 0, "visible": true, "filter": { "bid": true, "ask": true, "mean": true } };
  817. cur_day = config.day;//读取设置
  818.  
  819. window.onresize = function () {
  820. checkSize();
  821. };
  822. function checkSize() {
  823. if (window.innerWidth < window.innerHeight) {
  824. w = "250px";
  825. h = "400px";
  826. } else {
  827. w = "400px";
  828. h = "250px";
  829. }
  830. }
  831. checkSize();
  832. // 创建容器元素并设置样式和位置
  833. const container = document.createElement('div');
  834. container.style.border = "1px solid #ccc"; //边框样式
  835. container.style.backgroundColor = "#fff";
  836. container.style.position = "fixed";
  837. container.style.zIndex = 10000;
  838. container.style.top = "30px"; //距离顶部位置
  839. container.style.left = "20px"; //距离左侧位置
  840. container.style.width = w; //容器宽度
  841. container.style.height = h; //容器高度
  842. container.style.resize = "both";
  843. container.style.overflow = "auto";
  844. container.style.display = "flex";
  845. container.style.flexDirection = "column";
  846. container.style.flex = "1";
  847. container.style.minHeight = "33px";
  848. container.style.minWidth = "68px";
  849. container.style.cursor = "move";
  850. container.style.userSelect = "none";
  851.  
  852. let mouseDragging = false;
  853. let touchDragging = false;
  854. let offsetX, offsetY;
  855.  
  856. container.addEventListener("mousedown", function (e) {
  857. if(mouseDragging||touchDragging)return;
  858. const rect = container.getBoundingClientRect();
  859. if(e.clientX > rect.right - 10 || e.clientY > rect.bottom - 10) return;
  860. mouseDragging = true;
  861. offsetX = e.clientX - container.offsetLeft;
  862. offsetY = e.clientY - container.offsetTop;
  863. });
  864.  
  865. document.addEventListener("mousemove", function (e) {
  866. if (mouseDragging) {
  867. var newX = e.clientX - offsetX;
  868. var newY = e.clientY - offsetY;
  869. container.style.left = newX + "px";
  870. container.style.top = newY + "px";
  871. }
  872. });
  873.  
  874. document.addEventListener("mouseup", function () {
  875. mouseDragging = false;
  876. });
  877.  
  878. container.addEventListener("touchstart", function (e) {
  879. if(mouseDragging||touchDragging)return;
  880. const rect = container.getBoundingClientRect();
  881. let touch = e.touches[0];
  882. if(touch.clientX > rect.right - 10 || touch.clientY > rect.bottom - 10) return;
  883. touchDragging = true;
  884. offsetX = touch.clientX - container.offsetLeft;
  885. offsetY = touch.clientY - container.offsetTop;
  886. });
  887.  
  888. document.addEventListener("touchmove", function (e) {
  889. if (touchDragging) {
  890. let touch = e.touches[0];
  891. var newX = touch.clientX - offsetX;
  892. var newY = touch.clientY - offsetY;
  893. container.style.left = newX + "px";
  894. container.style.top = newY + "px";
  895. }
  896. });
  897.  
  898. document.addEventListener("touchend", function () {
  899. touchDragging = false;
  900. });
  901. document.body.appendChild(container);
  902.  
  903. const ctx = document.createElement('canvas');
  904. ctx.id = "myChart";
  905. container.appendChild(ctx);
  906.  
  907.  
  908.  
  909. // 创建下拉菜单并设置样式和位置
  910. let wrapper = document.createElement('div');
  911. wrapper.style.position = 'absolute';
  912. wrapper.style.top = '5px';
  913. wrapper.style.right = '16px';
  914. wrapper.style.fontSize = '14px';
  915.  
  916. //wrapper.style.backgroundColor = '#fff';
  917. wrapper.style.flexShrink = 0;
  918. container.appendChild(wrapper);
  919.  
  920. const days = [1, 3, 7, 14, 30, 180, 360];
  921. const dayTitle = ['1天', '3天', '1周', '2周', '1月', '半年', '一年'];
  922. cur_day = days[config.dayIndex];
  923.  
  924. let select = document.createElement('select');
  925. select.style.cursor = 'pointer';
  926. select.style.verticalAlign = 'middle';
  927. select.onchange = function () {
  928. cur_day = this.value;
  929. config.dayIndex = days.indexOf(parseInt(this.value));
  930. if (curHridName) requestItemPrice(curHridName, cur_day);
  931. save_config();
  932. };
  933.  
  934. for (let i = 0; i < days.length; i++) {
  935. let option = document.createElement('option');
  936. option.value = days[i];
  937. option.text = dayTitle[i];
  938. if (i === config.dayIndex) option.selected = true;
  939. select.appendChild(option);
  940. }
  941.  
  942. wrapper.appendChild(select);
  943.  
  944. // 创建一个容器元素并设置样式和位置
  945. const leftContainer = document.createElement('div');
  946. leftContainer.style.padding = '2px'
  947. leftContainer.style.display = 'flex';
  948. leftContainer.style.flexDirection = 'row';
  949. leftContainer.style.alignItems = 'center'
  950. container.appendChild(leftContainer);
  951.  
  952. //添加一个btn隐藏canvas和wrapper
  953. let btn_close = document.createElement('input');
  954. btn_close.type = 'button';
  955. btn_close.value = '📈隐藏';
  956. btn_close.style.margin = 0;
  957. btn_close.style.cursor = 'pointer';
  958.  
  959. leftContainer.appendChild(btn_close);
  960.  
  961.  
  962. //一个固定的文本显示买入卖出历史价格
  963. let price_info = document.createElement('div');
  964.  
  965. price_info.style.fontSize = '14px';
  966. price_info.title = "我的最近买/卖价格"
  967. price_info.style.width = "max-content";
  968. price_info.style.whiteSpace = "nowrap";
  969. price_info.style.lineHeight = '25px';
  970. price_info.style.display = 'none';
  971. price_info.style.marginLeft = '5px';
  972.  
  973. let buy_price = document.createElement('span');
  974. let sell_price = document.createElement('span');
  975. price_info.appendChild(buy_price);
  976. price_info.appendChild(sell_price);
  977. buy_price.style.color = 'red';
  978. sell_price.style.color = 'green';
  979.  
  980. leftContainer.appendChild(price_info);
  981.  
  982. let lastWidth;
  983. let lastHeight;
  984. btn_close.onclick = toggle;
  985. function toggle() {
  986. if (wrapper.style.display === 'none') {
  987. wrapper.style.display = ctx.style.display = 'block';
  988. container.style.resize = "both";
  989. btn_close.value = '📈隐藏';
  990. leftContainer.style.position = 'absolute'
  991. leftContainer.style.top = '1px';
  992. leftContainer.style.left = '1px';
  993. container.style.width = lastWidth;
  994. container.style.height = lastHeight;
  995. config.visible = true;
  996. save_config();
  997. } else {
  998. lastWidth = container.style.width;
  999. lastHeight = container.style.height;
  1000. wrapper.style.display = ctx.style.display = 'none';
  1001. container.style.resize = "none";
  1002. container.style.width = "auto";
  1003. container.style.height = "auto";
  1004.  
  1005.  
  1006. btn_close.value = '📈显示';
  1007. leftContainer.style.position = 'relative'
  1008. leftContainer.style.top = 0;
  1009. leftContainer.style.left = 0;
  1010.  
  1011. config.visible = false;
  1012. save_config();
  1013. }
  1014. };
  1015.  
  1016. let chart = new Chart(ctx, {
  1017. type: 'line',
  1018. data: {
  1019. labels: [],
  1020. datasets: [{
  1021. label: '市场',
  1022. data: [],
  1023. backgroundColor: 'rgba(255,99,132,0.2)',
  1024. borderColor: 'rgba(255,99,132,1)',
  1025. borderWidth: 1
  1026. }]
  1027. },
  1028. options: {
  1029. onClick: save_config,
  1030. responsive: true,
  1031. maintainAspectRatio: false,
  1032. pointRadius: 0,
  1033. pointHitRadius: 20,
  1034. scales: {
  1035. y: {
  1036. beginAtZero: false,
  1037. ticks: {
  1038. // 自定义刻度标签格式化
  1039. callback: showNumber
  1040. }
  1041. }
  1042. },
  1043. plugins: {
  1044. title: {
  1045. display: true,
  1046. text: "",
  1047. }
  1048. }
  1049. }
  1050. });
  1051.  
  1052. function requestItemPrice(itemHridName, day = 1) {
  1053. curHridName = itemHridName;
  1054. cur_day = day;
  1055. let itemNameEN = initData_itemDetailMap[itemHridName].name;
  1056. curItemNameCN = itemNamesCN[itemHridName];
  1057.  
  1058.  
  1059. let time = day * 3600 * 24;
  1060. fetch("https://mooket.qi-e.top/market", {
  1061. method: "POST",
  1062. headers: {
  1063. "Content-Type": "application/json",
  1064. },
  1065. body: JSON.stringify({
  1066. name: itemNameEN,
  1067. time: time
  1068. })
  1069. }).then(res => {
  1070. res.json().then(data => updateChart(data, cur_day));
  1071. })
  1072. }
  1073. function uploadItemPrice(marketItemOrderBooks, day = 1) {
  1074.  
  1075. }
  1076. function formatTime(timestamp, range) {
  1077. const date = new Date(timestamp * 1000);
  1078. const pad = n => n.toString().padStart(2, '0');
  1079.  
  1080. // 获取各时间组件
  1081. const hours = pad(date.getHours());
  1082. const minutes = pad(date.getMinutes());
  1083. const day = pad(date.getDate());
  1084. const month = pad(date.getMonth() + 1);
  1085. const shortYear = date.getFullYear().toString().slice(-2);
  1086.  
  1087. // 根据时间范围选择格式
  1088. switch (parseInt(range)) {
  1089. case 1: // 1天:只显示时间
  1090. return `${hours}:${minutes}`;
  1091.  
  1092. case 3: // 3天:日+时段
  1093. return `${hours}:${minutes}`;
  1094.  
  1095. case 7: // 7天:月/日 + 时段
  1096. return `${day}.${hours}`;
  1097. case 14: // 14天:月/日 + 时段
  1098. return `${day}.${hours}`;
  1099. case 30: // 30天:月/日
  1100. return `${month}/${day}`;
  1101.  
  1102. default: // 180天:年/月
  1103. return `${shortYear}/${month}`;
  1104. }
  1105. }
  1106.  
  1107. function showNumber(num) {
  1108. if (isNaN(num)) return num;
  1109. if (num === 0) return "0"; // 单独处理0的情况
  1110.  
  1111. const absNum = Math.abs(num);
  1112.  
  1113. //num保留一位小数
  1114. if (num < 1) return num.toFixed(2);
  1115.  
  1116. return absNum >= 1e10 ? `${(num / 1e9).toFixed(1)}B` :
  1117. absNum >= 1e7 ? `${(num / 1e6).toFixed(1)}M` :
  1118. absNum >= 1e4 ? `${Math.floor(num / 1e3)}K` :
  1119. `${Math.floor(num)}`;
  1120. }
  1121. //data={'bid':[{time:1,price:1}],'ask':[{time:1,price:1}]}
  1122. function updateChart(data, day) {
  1123. //过滤异常元素
  1124. for (let i = data.bid.length - 1; i >= 0; i--) {
  1125. if (data.bid[i].price < 0 || data.ask[i].price < 0) {
  1126. data.bid.splice(i, 1);
  1127. data.ask.splice(i, 1);
  1128. }
  1129. }
  1130. //timestamp转日期时间
  1131. //根据day输出不同的时间表示,<3天显示时分,<=7天显示日时,<=30天显示月日,>30天显示年月
  1132.  
  1133. //显示历史价格
  1134. let enhancementLevel = document.querySelector(".MarketplacePanel_infoContainer__2mCnh .Item_enhancementLevel__19g-e")?.textContent.replace("+", "") || "0";
  1135. let tradeName = curHridName + "_" + parseInt(enhancementLevel);
  1136. if (trade_history[tradeName]) {
  1137. let buy = trade_history[tradeName].buy || "无";
  1138. let sell = trade_history[tradeName].sell || "无";
  1139. price_info.style.display = "inline-block";
  1140. let levelStr = enhancementLevel > 0 ? "(+" + enhancementLevel + ")" : "";
  1141. price_info.innerHTML = `<span style="color:red">${showNumber(buy)}</span>/<span style="color:green">${showNumber(sell)}</span>${levelStr}`;
  1142. container.style.minWidth = price_info.clientWidth + 70 + "px";
  1143.  
  1144. } else {
  1145. price_info.style.display = "none";
  1146. container.style.minWidth = "68px";
  1147. }
  1148.  
  1149. let labels = data.bid.map(x => formatTime(x.time, day));
  1150.  
  1151. chart.data.labels = labels;
  1152.  
  1153. let sma = [];
  1154. let sma_size = 6;
  1155. let sma_window = [];
  1156. for (let i = 0; i < data.bid.length; i++) {
  1157. sma_window.push((data.bid[i].price + data.ask[i].price) / 2);
  1158. if (sma_window.length > sma_size) sma_window.shift();
  1159. sma.push(sma_window.reduce((a, b) => a + b, 0) / sma_window.length);
  1160. }
  1161. chart.options.plugins.title.text = curItemNameCN
  1162. chart.data.datasets = [
  1163. {
  1164. label: '买入',
  1165. data: data.bid.map(x => x.price),
  1166. borderColor: '#ff3300',
  1167. backgroundColor: '#ff3300',
  1168. borderWidth: 1.5
  1169. },
  1170. {
  1171. label: '卖出',
  1172. data: data.ask.map(x => x.price),
  1173. borderColor: '#00cc00',
  1174. backgroundColor: '#00cc00',
  1175. borderWidth: 1.5
  1176. },
  1177. {
  1178. label: '均线',
  1179. data: sma,
  1180. borderColor: '#ff9900',
  1181. borderWidth: 3,
  1182. tension: 0.5,
  1183. fill: true
  1184. }
  1185. ];
  1186. chart.setDatasetVisibility(0, config.filter.ask);
  1187. chart.setDatasetVisibility(1, config.filter.bid);
  1188. chart.setDatasetVisibility(2, config.filter.mean);
  1189.  
  1190. chart.update()
  1191. }
  1192. function save_config() {
  1193.  
  1194. if (chart && chart.data && chart.data.datasets && chart.data.datasets.length == 3) {
  1195. config.filter.ask = chart.getDatasetMeta(0).visible;
  1196. config.filter.bid = chart.getDatasetMeta(1).visible;
  1197. config.filter.mean = chart.getDatasetMeta(2).visible;
  1198. }
  1199. localStorage.setItem("mooket_config", JSON.stringify(config));
  1200. }
  1201. toggle();
  1202. })();