Added debug menu option and started tidying up 'window' handling
This commit is contained in:
parent
d97b78fafb
commit
0108d1b49c
@ -522,8 +522,9 @@ window.chat.chooseAnchor = function(t) {
|
|||||||
chat.needMoreMessages();
|
chat.needMoreMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.chat.choose = function(name) {
|
window.chat.show = function(name) {
|
||||||
$('#chat, #chatinput, #updatestatus').show();
|
if (!window.isSmartphone) $('#updatestatus').show();
|
||||||
|
$('#chat, #chatinput').show();
|
||||||
$('#map').css('visibility', 'hidden');
|
$('#map').css('visibility', 'hidden');
|
||||||
|
|
||||||
var t = $('<a>'+name+'</a>');
|
var t = $('<a>'+name+'</a>');
|
||||||
|
@ -48,16 +48,23 @@ window.debug.console = function() {
|
|||||||
$('#debugconsole').text();
|
$('#debugconsole').text();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.debug.console.create = function() {
|
window.debug.console.show = function() {
|
||||||
if($('#debugconsole').length) return;
|
$('#scrollwrapper, #updatestatus').hide();
|
||||||
$('#chatcontrols').append('<a>debug</a>');
|
// not displaying the map causes bugs in Leaflet
|
||||||
$('#chatcontrols a:last').click(function() {
|
$('#map').css('visibility', 'hidden');
|
||||||
|
$('#chat, #chatinput').show();
|
||||||
|
window.debug.console.create();
|
||||||
$('#chatinput mark').css('cssText', 'color: #bbb !important').text('debug:');
|
$('#chatinput mark').css('cssText', 'color: #bbb !important').text('debug:');
|
||||||
$('#chat > div').hide();
|
$('#chat > div').hide();
|
||||||
$('#debugconsole').show();
|
$('#debugconsole').show();
|
||||||
$('#chatcontrols .active').removeClass('active');
|
$('#chatcontrols .active').removeClass('active');
|
||||||
$(this).addClass('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>');
|
$('#chat').append('<div style="display: none" id="debugconsole"><table></table></div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,14 +34,6 @@ window.runOnSmartphonesBeforeBoot = function() {
|
|||||||
+ '</style>');
|
+ '</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() {
|
window.smartphone.mapButton = $('<a>map</a>').click(function() {
|
||||||
$('#chat, #chatinput, #scrollwrapper').hide();
|
$('#chat, #chatinput, #scrollwrapper').hide();
|
||||||
$('#map').css('visibility', 'visible');
|
$('#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">
|
android:title="@string/cache_clear">
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_exit"
|
android:id="@+id/menu_debug"
|
||||||
android:orderInCategory="200"
|
android:icon="@drawable/alerts_and_states_warning"
|
||||||
|
android:orderInCategory="190"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/menu_exit">
|
android:title="@string/menu_debug">
|
||||||
</item>
|
</item>
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
|
@ -53,5 +53,5 @@
|
|||||||
<string name="menu_public">Public</string>
|
<string name="menu_public">Public</string>
|
||||||
<string name="menu_faction">Faction</string>
|
<string name="menu_faction">Faction</string>
|
||||||
<string name="menu_info">Info</string>
|
<string name="menu_info">Info</string>
|
||||||
<string name="menu_exit">Exit</string>
|
<string name="menu_debug">Debug</string>
|
||||||
</resources>
|
</resources>
|
@ -239,11 +239,11 @@ public class IITC_Mobile extends Activity {
|
|||||||
// Handle item selection
|
// Handle item selection
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home:
|
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));
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_map:
|
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));
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
return true;
|
return true;
|
||||||
case R.id.reload_button:
|
case R.id.reload_button:
|
||||||
@ -281,7 +281,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
return true;
|
return true;
|
||||||
// get the users current location and focus it on map
|
// get the users current location and focus it on map
|
||||||
case R.id.locate:
|
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});");
|
iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});");
|
||||||
actionBar.setTitle(getString(R.string.menu_map));
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
return true;
|
return true;
|
||||||
@ -292,27 +292,28 @@ public class IITC_Mobile extends Activity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_info:
|
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));
|
actionBar.setTitle(getString(R.string.menu_info));
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_full:
|
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));
|
actionBar.setTitle(getString(R.string.menu_full));
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_compact:
|
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));
|
actionBar.setTitle(getString(R.string.menu_compact));
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_public:
|
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));
|
actionBar.setTitle(getString(R.string.menu_public));
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_faction:
|
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));
|
actionBar.setTitle(getString(R.string.menu_faction));
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_exit:
|
case R.id.menu_debug:
|
||||||
super.onBackPressed();
|
iitc_view.loadUrl("javascript: window.show('debug')");
|
||||||
|
actionBar.setTitle(getString(R.string.menu_debug));
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user