Hide Challenge Helper

Hide Challenge Helper Description (specificallyfor Kas)

  1. // ==UserScript==
  2. // @name Hide Challenge Helper
  3. // @description Hide Challenge Helper Description (specificallyfor Kas)
  4. // @include https://prodgame*.alliances.commandandconquer.com/*/index.aspx*
  5. // @version 1.0b
  6. // @author homerlsd
  7. // @namespace https://gf.qytechs.cn/users/36070
  8. // ==/UserScript==
  9. (function () {
  10. var HideChallengeHelper_mainFunction = function () {
  11. console.log("HideChallengeHelper loaded");
  12.  
  13. function CreateFVPTweak() {
  14. var HideChallengeHelper = {};
  15. qx.Class.define("HideChallengeHelper.main", {
  16. type : "singleton",
  17. extend : qx.core.Object,
  18. members : {
  19. buttons : {
  20. btnShowChallenge : null,
  21. btnHideChallenge : null
  22. },
  23. initialize : function () {
  24. try {
  25. var app = qx.core.Init.getApplication();
  26. var playArea = qx.core.Init.getApplication().getUIItem(ClientLib.Data.Missions.PATH.OVL_PLAYAREA);
  27. // Event Handlers
  28. phe.cnc.Util.attachNetEvent(ClientLib.Vis.VisMain.GetInstance(), "ViewModeChange", ClientLib.Vis.ViewModeChange, this, this.viewChangeHandler);
  29.  
  30. this.buttons.btnShowChallenge = new qx.ui.form.Button("Show Challenge");
  31. this.buttons.btnShowChallenge.set({
  32. width : 70,
  33. height : 20,
  34. appearance : "button-text-small",
  35. toolTipText : "Show Challenge"
  36. });
  37. this.buttons.btnShowChallenge.addListener("click", this.ShowChallenge, this);
  38.  
  39. // Hide Current Button
  40. this.buttons.btnHideChallenge = new qx.ui.form.Button("Hide Challenge");
  41. this.buttons.btnHideChallenge.set({
  42. width : 70,
  43. appearance : "button-text-small",
  44. toolTipText : "Hide Challenge"
  45. });
  46. this.buttons.btnHideChallenge.addListener("click", this.HideChallenge, this);
  47.  
  48. app.getDesktop().add(this.buttons.btnShowChallenge, {
  49. right : 150,
  50. bottom : 143,
  51. });
  52. app.getDesktop().add(this.buttons.btnHideChallenge, {
  53. right : 108,
  54. bottom : 143,
  55. });
  56.  
  57. } catch (e) {
  58. console.log(e);
  59. }
  60. },
  61. getElementByXpath : function (path) {
  62. return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  63. },
  64. hideChallenge : function() {
  65. var jopa = getElementByXpath('/html/body/div[3]/div[1]/div[1]/div/div[2]/div[2]')
  66. jopa.style = 'display:none';
  67. },
  68. showChallenge : function() {
  69. var jopa = getElementByXpath('/html/body/div[3]/div[1]/div[1]/div/div[2]/div[2]')
  70. jopa.style = 'display:block';
  71. },
  72. getTimestamp : function () {
  73. return Math.round(new Date().getTime() / 1000);
  74. }
  75. }
  76. });
  77. }
  78.  
  79. var HideChallengeHelper_timeout = 0; // 10 seconds
  80.  
  81. function HideChallengeHelper_checkIfLoaded() {
  82. try {
  83. if (typeof qx !== 'undefined') {
  84. var a = qx.core.Init.getApplication(); // application
  85. var mb = qx.core.Init.getApplication().getMenuBar();
  86. if (a && mb && typeof PerforceChangelist !== 'undefined') {
  87. if (HideChallengeHelper_timeout > 10 || typeof CCTAWrapper_IsInstalled !== 'undefined') {
  88. CreateFVPTweak();
  89. window.HideChallengeHelper.main.getInstance().initialize();
  90. } else {
  91. HideChallengeHelper_timeout++;
  92. window.setTimeout(HideChallengeHelper_checkIfLoaded, 1000);
  93. }
  94. } else
  95. window.setTimeout(HideChallengeHelper_checkIfLoaded, 1000);
  96. } else {
  97. window.setTimeout(HideChallengeHelper_checkIfLoaded, 1000);
  98. }
  99. } catch (e) {
  100. if (typeof console !== 'undefined')
  101. console.log(e);
  102. else if (window.opera)
  103. opera.postError(e);
  104. else
  105. GM_log(e);
  106. }
  107. }
  108.  
  109. if (/commandandconquer\.com/i.test(document.domain)) {
  110. window.setTimeout(HideChallengeHelper_checkIfLoaded, 1000);
  111. }
  112.  
  113. };
  114. // injecting, because there seem to be problems when creating game interface with unsafeWindow
  115. var HideChallengeHelperScript = document.createElement("script");
  116. var txt = HideChallengeHelper_mainFunction.toString();
  117. HideChallengeHelperScript.innerHTML = "(" + txt + ")();";
  118. HideChallengeHelperScript.type = "text/javascript";
  119. if (/commandandconquer\.com/i.test(document.domain))
  120. document.getElementsByTagName("head")[0].appendChild(HideChallengeHelperScript);
  121. })();

QingJ © 2025

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