Keyboard support for http://game.hg0355.com/game/xpg/

Use 'D' 'F' 'J' 'K' to beat the apples

安裝腳本?
作者推薦腳本

您可能也會喜歡 game.hg0355.com hack

安裝腳本
  1. /* eslint-disable no-multi-spaces */
  2.  
  3. // ==UserScript==
  4. // @name Keyboard support for http://game.hg0355.com/game/xpg/
  5. // @name:zh-CN 键盘暴打小苹果
  6. // @namespace SP_XPG_WITH_KEYBOARD
  7. // @version 0.2
  8. // @description Use 'D' 'F' 'J' 'K' to beat the apples
  9. // @description:zh-CN 使用'D' 'F' 'J' 'K'四个键位暴打小苹果
  10. // @author PY-DNG
  11. // @license MIT
  12. // @match http*://game.hg0355.com/game/xpg/
  13. // @icon https://api.iowen.cn/favicon/get.php?url=http://game.hg0355.com/game/xpg/
  14. // @grant none
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. (function main() {
  21. if (typeof (GameLayerBG) != 'object') {
  22. setTimeout(main, 100);
  23. return false;
  24. }
  25.  
  26. // Backup sharetext
  27. window.oshareText = window.shareText;
  28. const gameStart = window.gameStart;
  29. window.gameStart = function() {
  30. window.shareText = window.oshareText;
  31. return gameStart();
  32. }
  33.  
  34. document.addEventListener('keydown', function(e) {
  35. const key = e.key.toLowerCase();
  36. if (key === 'enter') {closeWelcomeLayer();}
  37. if (!['d', 'f', 'j', 'k'].includes(key)) {return false;}
  38.  
  39. // Get block
  40. let number = 0;
  41. switch(key) {
  42. case 'd':
  43. number = _gameBBListIndex * 4 + 4;
  44. break;
  45. case 'f':
  46. number = _gameBBListIndex * 4 + 5;
  47. break;
  48. case 'j':
  49. number = _gameBBListIndex * 4 + 6;
  50. break;
  51. case 'k':
  52. number = _gameBBListIndex * 4 + 7;
  53. break;
  54. }
  55. const id = '#GameLayer{A}-{B}'.replace('{A}', Math.floor(number / 40) % 2 === 0 ? '1' : '2').replace('{B}', (number % 40).toString());
  56. const tar = document.querySelector(id);
  57.  
  58. // Create event
  59. const evtOptions = {
  60. clientX: Math.round((touchArea[0] + touchArea[1]) / 2),
  61. clientY: Math.round((touchArea[0] + touchArea[1]) / 2),
  62. target: tar
  63. }
  64.  
  65. // Dispatch event
  66. GameLayerBG.onmousedown(evtOptions);
  67.  
  68. // Using keyboard, then display keyboard text in final page
  69. window.shareText = _shareText;
  70. });
  71.  
  72. function _shareText(score) {
  73. cookie('score2', score, 100);
  74. if (score <= 49) return '呵呵!我吃掉了' + score + '个小苹果!<br/>亲,还得加油哦!<br/><span style="font-size:0.5em">(电脑端键盘操作)</span>';
  75. if (score <= 99) return '酷!我吃掉了' + score + '个小苹果!<br/>亲,不错哦!<br/><span style="font-size:0.5em">(电脑端键盘操作)</span>';
  76. if (score <= 149) return '帅呆了!我吃掉了' + score + '个小苹果!<br/>亲,爱死你了!<br/><span style="font-size:0.5em">(电脑端键盘操作)</span>';
  77. if (score <= 199) return '太牛了!我吃掉了' + score + '个小苹果!<br/>亲,奥巴马和金正恩都惊呆了!<br/><span style="font-size:0.5em">(电脑端键盘操作)</span>';
  78. if (score >= 200) return '【年度科幻片】您在20秒内恰了' + score + '个小苹果!<br/><span style="font-size:0.2em"><del>您入门了</del></span><br/><span style="font-size:0.5em">(电脑端键盘操作)</span>';
  79. }
  80. }) ();
  81. })();

QingJ © 2025

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