AWA 神器装备计时器

显示一个按钮来检查神器锁的剩余时间。

  1. // ==UserScript==
  2. // @name AWA Artifact Equip Timer
  3. // @name:ja AWA アーティファクト装備タイマー
  4. // @name:zh-CN AWA 神器装备计时器
  5. // @name:zh-TW AWA 神器裝備計時器
  6. // @license CC-BY-NC-SA-4.0
  7. // @namespace https://twitch.tv/kikka1225
  8. // @version 0.1
  9. // @description Display a button to check the artifact locks' remaining time.
  10. // @description:ja アーティファクトロックの残り時間を確認するためのボタンを表示します。
  11. // @description:zh-CN 显示一个按钮来检查神器锁的剩余时间。
  12. // @description:zh-TW 顯示一個按鈕來檢查神器鎖的剩餘時間。
  13. // @author Megumin & Misha
  14. // @match *://*.alienwarearena.com/member/*/artifacts
  15. // @icon https://www.google.com/s2/favicons?sz=64&domain=alienwarearena.com
  16. // @grant none
  17. // @run-at document-end
  18. // @supportURL https://github.com/Mishasama/UserScript/issues
  19. // @homepageURL https://github.com/Mishasama/UserScript/raw/master/Misha's%20US/AWA%20Artifact%20Equip%20Timer/
  20. // @contributionURL https://ko-fi.com/mishasama
  21. // @contributionAmount 1¥
  22. // @compatible chrome
  23. // @compatible edge
  24. // ==/UserScript==
  25.  
  26. (function() {
  27. 'use strict';
  28.  
  29. // ボタンの作成とスタイリング
  30. var button = document.createElement('button');
  31. button.textContent = '⏰';
  32. button.style.position = 'fixed';
  33. button.style.top = '655px';
  34. button.style.left = '50%'; // 水平方向中央揃え
  35. button.style.transform = 'translateX(-55%)'; // ボタンの水平位置の調整
  36. button.style.zIndex = '9999'; // ボタンが一番上にあることを確認する
  37.  
  38. // クリックイベントを追加して元のスクリプトを実行する
  39. button.onclick = function() {alert(Object.values(artifactsData.userActiveArtifacts).reduce((acc, cur) => acc + ((24 - Math.floor((new Date() - Date.parse(cur.equippedAt.date + ' UTC'))/3600000)) >= 0).toString().replace('true', '⏰ ' + ((new Date() - Date.parse(cur.equippedAt.date + ' UTC')) % (1000 * 60 * 60) / (1000 * 60) < 1).toString().replace('true','24').replace('false',((23 - Math.floor((new Date() - Date.parse(cur.equippedAt.date + ' UTC')) / (1000 * 60 * 60))).toString().length < 2).toString().replace('true','0' + (23 - Math.floor((new Date() - Date.parse(cur.equippedAt.date + ' UTC')) / (1000 * 60 * 60)))).replace('false',(23 - Math.floor((new Date() - Date.parse(cur.equippedAt.date + ' UTC')) / (1000 * 60 * 60)))))+ ':' + (((60 - Math.floor((new Date() - Date.parse(cur.equippedAt.date + ' UTC')) % (1000 * 60 * 60) / (1000 * 60))) % 60).toString().length < 2).toString().replace('true','0' + ((60 - Math.floor((new Date() - Date.parse(cur.equippedAt.date + ' UTC')) % (1000 * 60 * 60) / (1000 * 60))) == '60').toString().replace('true','0').replace('false',(60 - Math.floor((new Date() - Date.parse(cur.equippedAt.date + ' UTC')) % (1000 * 60 * 60) / (1000 * 60))) % 60)).replace('false',((60 - Math.floor((new Date() - Date.parse(cur.equippedAt.date + ' UTC')) % (1000 * 60 * 60) / (1000 * 60))) % 60)) + ' remaining\n') .replace('false', '✅ Artifact Replaceable!\n'), ""))};
  40.  
  41. // ページにボタンを追加する
  42. document.body.appendChild(button);
  43. })();