您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
On the region map it allows you to zoom out further
// ==UserScript== // @name C&C Tiberium Alliances Zoom (SKY) // @description On the region map it allows you to zoom out further // @namespace https://prodgame*.alliances.commandandconquer.com/*/index.aspx* // @include https://prodgame*.alliances.commandandconquer.com/*/index.aspx* // @version Mar 11 2013 // @author Panavia, fix SKY // ==/UserScript== (function (){ var tazoom_main = function() { function initialize() { console.log("Zoom Loaded"); var zoomMin = 2.0; // Larger number means able to zoom in closer. var zoomMax = 0.1; // Smaller number means able to zoom out further. var zoomInc = 0.08; // Larger number for faster zooming, Smaller number for slower zooming. webfrontend.gui.BackgroundArea.prototype.onHotKeyPress = function(be) { if(!this.active || be.getTarget() != this.mapContainer) return; var bh = be.getKeyIdentifier(); var bf = ClientLib.Vis.VisMain.GetInstance(); switch(bh) { case "+": var bg = bf.get_Region().get_ZoomFactor() + zoomInc; bf.get_Region().set_ZoomFactor(Math.min(zoomMin, Math.max(zoomMax, bg))); break; case "-": var bg = bf.get_Region().get_ZoomFactor() - zoomInc; bf.get_Region().set_ZoomFactor(Math.min(zoomMin, Math.max(zoomMax, bg))); break; } this.closeCityInfo(); this.closeCityList(); } var backgroundArea = qx.core.Init.getApplication().getBackgroundArea(); qx.bom.Element.removeListener(backgroundArea.mapContainer, "mousewheel", backgroundArea._onMouseWheel, backgroundArea); qx.bom.Element.removeListener(backgroundArea.mapBlocker, "mousewheel", backgroundArea._onMouseWheel, backgroundArea); webfrontend.gui.BackgroundArea.prototype._onMouseWheel = function(e) { if(this.activeSceneView == null) return; var bz = e.getWheelDelta(); var by = this.activeSceneView.get_ZoomFactor(); by += bz > 0 ? -zoomInc : zoomInc; by = Math.min(zoomMin, Math.max(zoomMax, by)); this.activeSceneView.set_ZoomFactor(by); e.stop(); } qx.bom.Element.addListener(backgroundArea.mapContainer, "mousewheel", backgroundArea._onMouseWheel, backgroundArea); qx.bom.Element.addListener(backgroundArea.mapBlocker, "mousewheel", backgroundArea._onMouseWheel, backgroundArea); } function tazoom_checkIfLoaded() { try { if (typeof qx != 'undefined') { a = qx.core.Init.getApplication(); // application mb = qx.core.Init.getApplication().getMenuBar(); if (a && mb) { initialize(); } else window.setTimeout(tazoom_checkIfLoaded, 1000); } else { window.setTimeout(tazoom_checkIfLoaded, 1000); } } catch (e) { if (typeof console != 'undefined') console.log(e); else if (window.opera) opera.postError(e); else GM_log(e); } } if (/commandandconquer\.com/i.test(document.domain)) { window.setTimeout(tazoom_checkIfLoaded, 1000); } } // injecting, because there seem to be problems when creating game interface with unsafeWindow var tazoomScript = document.createElement("script"); tazoomScript.innerHTML = "(" + tazoom_main.toString() + ")();"; tazoomScript.type = "text/javascript"; if (/commandandconquer\.com/i.test(document.domain)) { document.getElementsByTagName("head")[0].appendChild(tazoomScript); } })();