Hikari_Field入库检测

Hikari_Field入库游戏检测

目前为 2021-12-11 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name:zh-CN Hikari_Field入库检测
  3. // @name Hikari_Field_Helper
  4. // @namespace https://blog.chrxw.com
  5. // @supportURL https://blog.chrxw.com/scripts.html
  6. // @contributionURL https://afdian.net/@chr233
  7. // @version 1.0
  8. // @description Hikari_Field入库游戏检测
  9. // @description:zh-CN Hikari_Field入库游戏检测
  10. // @author Chr_
  11. // @include https://keylol.com/*
  12. // @include https://store.hikarifield.co.jp/libraries
  13. // @license AGPL-3.0
  14. // @icon https://blog.chrxw.com/favicon.ico
  15. // @grant GM_xmlhttpRequest
  16. // @grant GM_setValue
  17. // @grant GM_getValue
  18. // @grant GM_registerMenuCommand
  19. // ==/UserScript==
  20.  
  21.  
  22. (() => {
  23. 'use strict';
  24.  
  25. const Data = { //商城关键词: 游戏名, AppID, 状态(1: 已发售, 0: 未发售, -1: 被ban)
  26. //已发售
  27. 'parquet': ['PARQUET', 1662840, 1],
  28. 'riddle_joker': ['Riddle Joker', 1277930, 1],
  29. 'kinkoi': ['金辉恋曲四重奏', 1277940, 1],
  30. 'aokana': ['苍之彼方的四重奏', 1044620, 1],
  31. 'aokana_extra1': ['苍之彼方的四重奏 EXTRA1', 1340130, 1],
  32. 'sakura_no_mori2': ['樱之杜†净梦者2', 983150, 1],
  33. 'natsunoiro': ['追忆夏色年华', 1161190, 1],
  34. 'alias_carnival': ['爱丽娅的明日盛典', 1094530, 1],
  35. 'sakura_no_mori': ['樱之杜†净梦者', 749520, 1],
  36. 'tsukikage': ['月影魅像-解放之羽-', 1069230, 1],
  37. 'hello_lady_nd': ['淑女同萌!-New Division-', 1025070, 1],
  38. 'relief': ['Re:LieF 〜献给亲爱的你〜', 1518770, 1],
  39. 'monobeno_happy_end': ['茂伸奇谈-Happy End-', 831660, 1],
  40. 'maitetsu_lastrun': ['爱上火车-Last Run!!-', 1434480, 1],
  41. 'tryment_alpha': ['TrymenT -献给渴望改变的你- AlphA篇', 1183260, 1],
  42. 'senren_banka': ['千恋*万花', 1144400, 1],
  43. 'maitetsu_pure_station': ['爱上火车-Pure Station-', 880950, 1],
  44. 'hello_lady': ['淑女同萌!', 783120, 1],
  45. 'monobeno': ['茂伸奇谈-Monobeno-', 758090, 1],
  46. 'tayutama2': ['游魂2-you\'re the only one-', 552280, 1],
  47. //已下架
  48. 'happiness2': ['Happiness!2 樱花盛典', 1253470, -1],
  49. 'magical_charming': ['魔卡魅恋!Magical Charming!', 625760, -1],
  50. // 'magical_charming2': ['魔卡魅恋 零之编年史', 1216240, -1], //暂无HF商店链接
  51. 'hello_lady_se': ['淑女同萌!-Superior Entelecheia-', 1286460, -1],
  52. 'monobeno_asmr': ['妖异乡愁谭', 1264680, -1],
  53. 'honoguraki': ['来自昏暗的时间尽头', 1603740, -1],
  54. //未发售
  55. 'sekachu': ['在世界与世界的正中央', 1829650, 0],
  56. }
  57.  
  58. const HFSHOP = 'https://store.hikarifield.co.jp/shop/';
  59. const HFLIBARY = 'https://store.hikarifield.co.jp/libraries';
  60.  
  61. for (let key in Data) {
  62. console.log(`${Data[key][0]}: '${key}'`);
  63. }
  64.  
  65. const host = window.location.host;
  66. setInterval
  67. if (host === 'store.hikarifield.co.jp') {//更新库存
  68. const myGames = document.querySelectorAll('.game-cover>a');
  69.  
  70. const ownedGames = [625760]; //魔卡魅恋(免费)
  71.  
  72. for (const ele of myGames) {
  73. const key = ele.href?.replace(HFSHOP, '');
  74. if (key !== undefined) {
  75. let [gameName, appID, _] = Data[key] ?? [null, null, null];
  76. if (appID !== null) {
  77. ownedGames.push(appID);
  78. console.log(`已拥有 ${gameName} ${appID}`);
  79. }
  80. } else {
  81. console.log(`${ele.href} 无效`);
  82. }
  83. }
  84. GM_setValue('ownedGames', ownedGames);
  85. swal({
  86. position: 'top-end',
  87. title: '导入游戏列表成功',
  88. button: false,
  89. timer: 1000
  90. });
  91.  
  92. } else { //其乐
  93. const ownedGames = new Set(GM_getValue('ownedGames') ?? []);
  94. if (ownedGames.size === 0) {
  95. if (confirm('是否导入游戏列表?')) {
  96. window.open(HFLIBARY);
  97. } else {
  98. showError('【可以在油猴菜单中进行同步】');
  99. GM_setValue('ownedGames', [0]);
  100. }
  101. }
  102.  
  103. const steamLinks = document.querySelectorAll('a[href^="http://store.steampowered.com/"],a[href^="https://store.steampowered.com/"],a[href^="https://steamdb.info/app/"]');
  104. const HFLinks = document.querySelectorAll('a[href^="https://store.hikarifield.co.jp/shop/"]');
  105.  
  106. const grubAppid = RegExp(/app\/(\d+)\/?/);
  107.  
  108. for (const ele of steamLinks) {
  109. const href = ele.href;
  110. if (href !== undefined) {
  111. const appID = parseInt(grubAppid.exec(href)?.[1] ?? 0);
  112. if (appID > 0) {
  113. if (ownedGames.has(appID)) {
  114. ele.classList.add('steam-info-link');
  115. ele.classList.add('steam-info-own');
  116. }
  117. }
  118. }
  119. }
  120.  
  121. for (const ele of HFLinks) {
  122. const key = ele.href?.replace(HFSHOP, '');
  123. if (key !== undefined) {
  124. let [gameName, appID, _] = Data[key] ?? [null, null, null];
  125. if (appID !== null) {
  126. if (ownedGames.has(appID)) {
  127. ele.classList.add('steam-info-link');
  128. ele.classList.add('steam-info-own');
  129. }
  130. }
  131. } else {
  132. console.log(ele);
  133. }
  134. }
  135. }
  136.  
  137. GM_registerMenuCommand('导入Hikari Field游戏', () => {
  138. window.open(HFLIBARY);
  139. })
  140.  
  141. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址