Change EA Sim GUI Elements positions

Get back the disable unit button to old position.

当前为 2016-01-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Change EA Sim GUI Elements positions
  3. // @description Get back the disable unit button to old position.
  4. // @author VisiG
  5. // @version 0.3
  6. // @namespace https://prodgame*.alliances.commandandconquer.com/*/index.aspx*
  7. // @include https://prodgame*.alliances.commandandconquer.com/*/index.aspx*
  8. // ==/UserScript==
  9.  
  10. (function () {
  11. var EASimGUIChanger_main = function () {
  12. function EASimGUIChanger_checkIfLoaded() {
  13. if (PerforceChangelist >= 443425) { // patch 16.1
  14. try {
  15. if (typeof qx !== 'undefined' && typeof qx.core !== 'undefined' && typeof qx.core.Init !== 'undefined') {
  16. try {
  17. app = qx.core.Init.getApplication();
  18. rightGUIBar = app.getRightBar();
  19. ArmySetupAttackBar = app.getArmySetupAttackBar();
  20. rightAttackBar = ArmySetupAttackBar.getChildren()[2].getChildren()[1].getChildren()[8];
  21. EASimAttackBar = ArmySetupAttackBar.getChildren()[0].getChildren()[1];
  22. unitDisableButton = EASimAttackBar.getChildren()[8]; // enable disable button
  23. playButton = ArmySetupAttackBar.getChildren()[2].getChildren()[1].getChildren()[8].getChildren()[1];
  24. if(rightGUIBar === null || rightAttackBar === null || unitDisableButton === null || playButton === null)
  25. {
  26. window.setTimeout(EASimGUIChanger_checkIfLoaded, 1000);
  27. }
  28. else
  29. {
  30. //rightGUIBar.removeAt(3); // removes the ea stats bar
  31. rightAttackBar.removeAt(1);
  32. //ArmySetupAttackBar.getChildren()[2].getChildren()[1].getChildren()[8].getChildren()[1]; // play button
  33. rightAttackBar.addAt(unitDisableButton, 1);
  34. EASimAttackBar.addAt(playButton, 8);
  35. }
  36. } catch (e) {
  37. window.setTimeout(EASimGUIChanger_checkIfLoaded, 1000);
  38. }
  39. } else {
  40. window.setTimeout(EASimGUIChanger_checkIfLoaded, 1000);
  41. }
  42. } catch (e) {
  43. console.log("EASimGUIChanger_checkIfLoaded: ", e);
  44. }
  45. }
  46. }
  47.  
  48. if (/commandandconquer\.com/i.test(document.domain)) {
  49. window.setTimeout(EASimGUIChanger_checkIfLoaded, 1000);
  50. }
  51. }
  52. try {
  53. var script = document.createElement("script");
  54. script.innerHTML = "(" + EASimGUIChanger_main.toString() + ")();";
  55. script.type = "text/javascript";
  56. document.getElementsByTagName("head")[0].appendChild(script);
  57. } catch (e) {
  58. console.log("EASimGUIChanger: init error: ", e);
  59. }
  60. })();