LoU Tweak

By AmpliDude Last update Nov 14, 2012 — Installed 549,885 times.

Suggestion: City Nav

in
Subscribe to Suggestion: City Nav 2 posts, 2 voices



yiourkas User
FirefoxX11

First of all, nice work etc etc...

To cut to the point:

City Navigator:
On context menu, display a box with buttons, one for every city. clicking the button, goes to the city and hides the box.

Here is a working version of this idea (it just looks ugly so far)

	var CityNavFunction = function() {
		var a = qx.core.Init.getApplication();
		var p = webfrontend.data.Player.getInstance();
alert("Loeaded...");
		var displayCityNav = function(e) {
    alert(e);			
		    var key = e.getKeyIdentifier();
		    if (key == "`") {
		    	
		        var cityNav = new webfrontend.gui.OverlayWidget();
		        cityNav.clientArea.setLayout(new qx.ui.layout.VBox());
		        cityNav.setTitle("City Nav");
		        a.setUserData("cityNav", cityNav);

		        var citiesSelect = a.getCityBarWidget().citiesSelect;

		        var i = 0;
		        for (var c in p.cities) {

		            var button = new qx.ui.form.Button(p.getCity(c).name);
		            button.addListener(
		                "click", 
		                (function(_it) {
					        return function() {
					            var newSelection = citiesSelect.getSelectables()[_it];
					            citiesSelect.setSelection([newSelection]);
					            a.switchOverlay(null);
					        };
				        })(i), false
			        );
			
		            cityNav.clientArea._add(button);
		            ++i;
		        }
		        a.switchOverlay(cityNav);
		    }
		};
		a.mainContainer.addListener("keypress", displayCityNav, false);
	};

 
TiffMaelite User
FirefoxWindows

Seems a great idea, but how/where was/is it supposed to be inserted in the current version of LoUTweak script???