Added debug menu option and started tidying up 'window' handling
This commit is contained in:
parent
d97b78fafb
commit
0108d1b49c
@ -522,10 +522,11 @@ window.chat.chooseAnchor = function(t) {
|
||||
chat.needMoreMessages();
|
||||
}
|
||||
|
||||
window.chat.choose = function(name) {
|
||||
$('#chat, #chatinput, #updatestatus').show();
|
||||
window.chat.show = function(name) {
|
||||
if (!window.isSmartphone) $('#updatestatus').show();
|
||||
$('#chat, #chatinput').show();
|
||||
$('#map').css('visibility', 'hidden');
|
||||
|
||||
|
||||
var t = $('<a>'+name+'</a>');
|
||||
window.chat.chooseAnchor(t);
|
||||
}
|
||||
|
@ -48,16 +48,23 @@ window.debug.console = function() {
|
||||
$('#debugconsole').text();
|
||||
}
|
||||
|
||||
window.debug.console.create = function() {
|
||||
if($('#debugconsole').length) return;
|
||||
$('#chatcontrols').append('<a>debug</a>');
|
||||
$('#chatcontrols a:last').click(function() {
|
||||
window.debug.console.show = function() {
|
||||
$('#scrollwrapper, #updatestatus').hide();
|
||||
// not displaying the map causes bugs in Leaflet
|
||||
$('#map').css('visibility', 'hidden');
|
||||
$('#chat, #chatinput').show();
|
||||
window.debug.console.create();
|
||||
$('#chatinput mark').css('cssText', 'color: #bbb !important').text('debug:');
|
||||
$('#chat > div').hide();
|
||||
$('#debugconsole').show();
|
||||
$('#chatcontrols .active').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
}
|
||||
|
||||
window.debug.console.create = function() {
|
||||
if($('#debugconsole').length) return;
|
||||
$('#chatcontrols').append('<a>debug</a>');
|
||||
$('#chatcontrols a:last').click(window.debug.console.show);
|
||||
$('#chat').append('<div style="display: none" id="debugconsole"><table></table></div>');
|
||||
}
|
||||
|
||||
|
@ -34,14 +34,6 @@ window.runOnSmartphonesBeforeBoot = function() {
|
||||
+ '</style>');
|
||||
}
|
||||
|
||||
// this also matches the expand button, but it is hidden via CSS
|
||||
$('#chatcontrols a').click(function() {
|
||||
$('#scrollwrapper, #updatestatus').hide();
|
||||
// not displaying the map causes bugs in Leaflet
|
||||
$('#map').css('visibility', 'hidden');
|
||||
$('#chat, #chatinput').show();
|
||||
});
|
||||
|
||||
window.smartphone.mapButton = $('<a>map</a>').click(function() {
|
||||
$('#chat, #chatinput, #scrollwrapper').hide();
|
||||
$('#map').css('visibility', 'visible');
|
||||
|
30
code/window_management.js
Normal file
30
code/window_management.js
Normal file
@ -0,0 +1,30 @@
|
||||
// created to start cleaning up "window" interaction
|
||||
//
|
||||
window.show = function(id) {
|
||||
switch(id) {
|
||||
case 'full':
|
||||
window.chat.show('full');
|
||||
break;
|
||||
case 'compact':
|
||||
window.chat.show('compact');
|
||||
break;
|
||||
case 'public':
|
||||
window.chat.show('public');
|
||||
break;
|
||||
case 'faction':
|
||||
window.chat.show('faction');
|
||||
break;
|
||||
case 'debug':
|
||||
window.debug.console.show();
|
||||
break;
|
||||
case 'map':
|
||||
window.smartphone.mapButton.click();
|
||||
break;
|
||||
case 'info':
|
||||
window.smartphone.sideButton.click();
|
||||
break;
|
||||
default:
|
||||
window.smartphone.mapButton.Click();
|
||||
break;
|
||||
}
|
||||
}
|
BIN
mobile/res/drawable-hdpi/alerts_and_states_warning.png
Normal file
BIN
mobile/res/drawable-hdpi/alerts_and_states_warning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-mdpi/alerts_and_states_warning.png
Normal file
BIN
mobile/res/drawable-mdpi/alerts_and_states_warning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-xhdpi/action_settings.png
Normal file
BIN
mobile/res/drawable-xhdpi/action_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-xhdpi/alerts_and_states_warning.png
Normal file
BIN
mobile/res/drawable-xhdpi/alerts_and_states_warning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -90,10 +90,11 @@
|
||||
android:title="@string/cache_clear">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_exit"
|
||||
android:orderInCategory="200"
|
||||
android:id="@+id/menu_debug"
|
||||
android:icon="@drawable/alerts_and_states_warning"
|
||||
android:orderInCategory="190"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/menu_exit">
|
||||
android:title="@string/menu_debug">
|
||||
</item>
|
||||
</menu>
|
||||
</item>
|
||||
|
@ -53,5 +53,5 @@
|
||||
<string name="menu_public">Public</string>
|
||||
<string name="menu_faction">Faction</string>
|
||||
<string name="menu_info">Info</string>
|
||||
<string name="menu_exit">Exit</string>
|
||||
<string name="menu_debug">Debug</string>
|
||||
</resources>
|
@ -239,11 +239,11 @@ public class IITC_Mobile extends Activity {
|
||||
// Handle item selection
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
iitc_view.loadUrl("javascript: window.smartphone.mapButton.click();");
|
||||
iitc_view.loadUrl("javascript: window.show('map');");
|
||||
actionBar.setTitle(getString(R.string.menu_map));
|
||||
return true;
|
||||
case R.id.menu_map:
|
||||
iitc_view.loadUrl("javascript: window.smartphone.mapButton.click();");
|
||||
iitc_view.loadUrl("javascript: window.show('map');");
|
||||
actionBar.setTitle(getString(R.string.menu_map));
|
||||
return true;
|
||||
case R.id.reload_button:
|
||||
@ -281,7 +281,7 @@ public class IITC_Mobile extends Activity {
|
||||
return true;
|
||||
// get the users current location and focus it on map
|
||||
case R.id.locate:
|
||||
iitc_view.loadUrl("javascript: window.smartphone.mapButton.click();");
|
||||
iitc_view.loadUrl("javascript: window.show('map');");
|
||||
iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});");
|
||||
actionBar.setTitle(getString(R.string.menu_map));
|
||||
return true;
|
||||
@ -292,27 +292,28 @@ public class IITC_Mobile extends Activity {
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.menu_info:
|
||||
iitc_view.loadUrl("javascript: window.smartphone.sideButton.click();");
|
||||
iitc_view.loadUrl("javascript: window.show('info');");
|
||||
actionBar.setTitle(getString(R.string.menu_info));
|
||||
return true;
|
||||
case R.id.menu_full:
|
||||
iitc_view.loadUrl("javascript: window.chat.choose('full');");
|
||||
iitc_view.loadUrl("javascript: window.show('full');");
|
||||
actionBar.setTitle(getString(R.string.menu_full));
|
||||
return true;
|
||||
case R.id.menu_compact:
|
||||
iitc_view.loadUrl("javascript: window.chat.choose('compact');");
|
||||
iitc_view.loadUrl("javascript: window.show('compact');");
|
||||
actionBar.setTitle(getString(R.string.menu_compact));
|
||||
return true;
|
||||
case R.id.menu_public:
|
||||
iitc_view.loadUrl("javascript: window.chat.choose('public');");
|
||||
iitc_view.loadUrl("javascript: window.show('public');");
|
||||
actionBar.setTitle(getString(R.string.menu_public));
|
||||
return true;
|
||||
case R.id.menu_faction:
|
||||
iitc_view.loadUrl("javascript: window.chat.choose('faction');");
|
||||
iitc_view.loadUrl("javascript: window.show('faction');");
|
||||
actionBar.setTitle(getString(R.string.menu_faction));
|
||||
return true;
|
||||
case R.id.menu_exit:
|
||||
super.onBackPressed();
|
||||
case R.id.menu_debug:
|
||||
iitc_view.loadUrl("javascript: window.show('debug')");
|
||||
actionBar.setTitle(getString(R.string.menu_debug));
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
Loading…
x
Reference in New Issue
Block a user