Merge branch 'navdrawer-api' of git://github.com/fkloft/ingress-intel-total-conversion into fkloft-navdrawer-api

This commit is contained in:
Philipp Schaefer 2013-12-04 09:46:45 +01:00
commit a9ecd268ac
15 changed files with 235 additions and 196 deletions

View File

@ -50,6 +50,10 @@
// iitcLoaded: called after IITC and all plugins loaded // iitcLoaded: called after IITC and all plugins loaded
// portalDetailLoaded: called when a request to load full portal detail // portalDetailLoaded: called when a request to load full portal detail
// completes. guid, success, details parameters // completes. guid, success, details parameters
// paneChanged called when the current pane has changed. On desktop,
// this only selects the current chat pane; on mobile, it
// also switches between map, info and other panes defined
// by plugins
window._hooks = {} window._hooks = {}
window.VALID_HOOKS = [ window.VALID_HOOKS = [
@ -60,7 +64,7 @@ window.VALID_HOOKS = [
'publicChatDataAvailable', 'factionChatDataAvailable', 'publicChatDataAvailable', 'factionChatDataAvailable',
'requestFinished', 'nicknameClicked', 'requestFinished', 'nicknameClicked',
'geoSearch', 'iitcLoaded', 'geoSearch', 'iitcLoaded',
'portalDetailLoaded']; 'portalDetailLoaded', 'paneChanged'];
window.runHooks = function(event, data) { window.runHooks = function(event, data) {
if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event); if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event);

View File

@ -3,6 +3,8 @@
window.show = function(id) { window.show = function(id) {
window.hideall(); window.hideall();
runHooks("paneChanged", id);
switch(id) { switch(id) {
case 'full': case 'full':
window.chat.show('full'); window.chat.show('full');
@ -27,9 +29,6 @@ window.show = function(id) {
case 'info': case 'info':
window.smartphone.sideButton.click(); window.smartphone.sideButton.click();
break; break;
default:
window.smartphone.mapButton.click();
break;
} }
if (typeof android !== 'undefined' && android && android.switchToPane) { if (typeof android !== 'undefined' && android && android.switchToPane) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -68,6 +68,12 @@
• tap and hold a portal for a second<br> • tap and hold a portal for a second<br>
• tap on the left half of the status bar]]> • tap on the left half of the status bar]]>
</string> </string>
<string name="notice_panes">
<![CDATA[Hint:<br><br>
Some plugins (e.g. portals list and bookmarks) now appear in the navigation drawer for quick access.<br>
They won\'t appear in the info pane any more.<br><br>
Swipe from the left edge of your screen (or click the app icon) to seem them.]]>
</string>
<string name="pref_ui_cat">UI</string> <string name="pref_ui_cat">UI</string>
<string name="pref_misc_cat">Misc</string> <string name="pref_misc_cat">Misc</string>

View File

@ -1,5 +1,4 @@
body { body {
background: #000;
color: #fff; color: #fff;
} }
@ -81,7 +80,7 @@ body {
} }
#sidebar, #chatcontrols, #chat, #chatinput { #sidebar, #chatcontrols, #chat, #chatinput {
background: #0B3351 !important; background: transparent !important;
} }
.leaflet-top .leaflet-control { .leaflet-top .leaflet-control {
@ -199,19 +198,18 @@ body {
padding: 5px; padding: 5px;
margin-top: 3px; margin-top: 3px;
margin-bottom: 3px; margin-bottom: 3px;
border: 2px outset #0e3d4e; border: 2px outset #20A8B1;
} }
#toolbox > a { #toolbox > a {
padding: 5px; padding: 5px;
margin-top: 3px; margin-top: 3px;
margin-bottom: 3px; margin-bottom: 3px;
border: 2px outset #0e3d4e; border: 2px outset #20A8B1;
} }
#portaldetails .close { #portaldetails .close {
padding: 4px; padding: 4px;
border: 1px outset #0e3d4e; border: 1px outset #20A8B1;
margin-top: 2px; margin-top: 2px;
background: #0e3d4e;
} }

View File

@ -13,8 +13,6 @@ import android.widget.Toast;
import com.cradle.iitc_mobile.IITC_NavigationHelper.Pane; import com.cradle.iitc_mobile.IITC_NavigationHelper.Pane;
import com.cradle.iitc_mobile.share.ShareActivity; import com.cradle.iitc_mobile.share.ShareActivity;
import java.util.Locale;
// provide communication between IITC script and android app // provide communication between IITC script and android app
public class IITC_JSInterface { public class IITC_JSInterface {
// context of main activity // context of main activity
@ -96,7 +94,7 @@ public class IITC_JSInterface {
public void run() { public void run() {
Pane pane; Pane pane;
try { try {
pane = Pane.valueOf(id.toUpperCase(Locale.getDefault())); pane = mIitc.getNavigationHelper().getPane(id);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
pane = Pane.MAP; pane = Pane.MAP;
} }
@ -170,4 +168,14 @@ public class IITC_JSInterface {
} }
}); });
} }
@JavascriptInterface
public void addPane(final String name, final String label, final String icon) {
mIitc.runOnUiThread(new Runnable() {
@Override
public void run() {
mIitc.getNavigationHelper().addPane(name, label, icon);
}
});
}
} }

View File

@ -12,7 +12,6 @@ import android.widget.ArrayAdapter;
import android.widget.CheckedTextView; import android.widget.CheckedTextView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;

View File

@ -35,7 +35,6 @@ import com.cradle.iitc_mobile.IITC_NavigationHelper.Pane;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.Locale;
import java.util.Stack; import java.util.Stack;
public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeListener, LocationListener { public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeListener, LocationListener {
@ -415,8 +414,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
} }
public void switchToPane(Pane pane) { public void switchToPane(Pane pane) {
String name = pane.name().toLowerCase(Locale.getDefault()); mIitcWebView.loadUrl("javascript: window.show('" + pane.name + "');");
mIitcWebView.loadUrl("javascript: window.show('" + name + "');");
} }
@Override @Override

View File

@ -34,71 +34,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
// Makes the icon/title clickable // Makes the icon/title clickable
// getActionBar().setHomeButtonEnabled(enabled); // getActionBar().setHomeButtonEnabled(enabled);
private class NavigationAdapter extends ArrayAdapter<Pane> {
public NavigationAdapter() {
super(mIitc, R.layout.list_item_selectable);
add(Pane.MAP);
add(Pane.INFO);
add(Pane.FULL);
add(Pane.COMPACT);
add(Pane.PUBLIC);
add(Pane.FACTION);
if (mPrefs.getBoolean("pref_advanced_menu", false)) {
add(Pane.DEBUG);
}
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView view = (TextView) super.getView(position, convertView, parent);
Pane item = getItem(position);
if (item == Pane.MAP) {
view.setText("Map");
} else {
view.setText(getPaneTitle(item));
}
int icon = 0;
switch (item) {
case MAP:
icon = R.drawable.ic_action_map;
break;
case INFO:
icon = R.drawable.ic_action_about;
break;
case FULL:
icon = R.drawable.ic_action_view_as_list;
break;
case COMPACT:
icon = R.drawable.ic_action_view_as_list_compact;
break;
case PUBLIC:
icon = R.drawable.ic_action_group;
break;
case FACTION:
icon = R.drawable.ic_action_cc_bcc;
break;
case DEBUG:
icon = R.drawable.ic_action_error;
break;
}
if (icon != 0) {
view.setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);
}
return view;
}
}
public static enum Pane {
COMPACT, DEBUG, FACTION, FULL, INFO, MAP, PUBLIC
}
public static final int NOTICE_DRAWERS = 1 << 0; public static final int NOTICE_DRAWERS = 1 << 0;
public static final int NOTICE_INFO = 1 << 1; public static final int NOTICE_INFO = 1 << 1;
public static final int NOTICE_PANES = 1 << 2;
// next one would be 1<<2; (this results in 1,2,4,8,...) // next one would be 1<<2; (this results in 1,2,4,8,...)
private final IITC_Mobile mIitc; private final IITC_Mobile mIitc;
@ -140,9 +78,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
} }
private void showNotice(final int which) { private void showNotice(final int which) {
if ((mPrefs.getInt("pref_messages", 0) & which) != 0) { if ((mPrefs.getInt("pref_messages", 0) & which) != 0) return;
return;
}
String text; String text;
switch (which) { switch (which) {
@ -152,6 +88,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
case NOTICE_INFO: case NOTICE_INFO:
text = mIitc.getText(R.string.notice_info).toString(); text = mIitc.getText(R.string.notice_info).toString();
break; break;
case NOTICE_PANES:
text = mIitc.getText(R.string.notice_panes).toString();
break;
default: default:
return; return;
} }
@ -185,10 +124,12 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
dialog.show(); dialog.show();
} }
private void updateActionBar() { private void updateViews() {
int position = mNavigationAdapter.getPosition(mPane); int position = mNavigationAdapter.getPosition(mPane);
if (position >= 0 && position < mNavigationAdapter.getCount()) { if (position >= 0 && position < mNavigationAdapter.getCount()) {
mDrawerLeft.setItemChecked(position, true); mDrawerLeft.setItemChecked(position, true);
} else {
mDrawerLeft.setItemChecked(mDrawerLeft.getCheckedItemPosition(), false);
} }
if (mDesktopMode) { if (mDesktopMode) {
@ -219,7 +160,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) { if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) {
mActionBar.setTitle(mIitc.getString(R.string.app_name)); mActionBar.setTitle(mIitc.getString(R.string.app_name));
} else { } else {
mActionBar.setTitle(getPaneTitle(mPane)); mActionBar.setTitle(mPane.label);
} }
} }
@ -231,27 +172,28 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
} }
} }
public void addPane(String name, String label, String icon) {
showNotice(NOTICE_PANES);
int resId = mIitc.getResources().getIdentifier(icon, "drawable", mIitc.getPackageName());
mNavigationAdapter.add(new Pane(name, label, resId));
}
public void closeDrawers() { public void closeDrawers() {
mDrawerLayout.closeDrawers(); mDrawerLayout.closeDrawers();
} }
public String getPaneTitle(Pane pane) { public Pane getPane(String id) {
switch (pane) { for (int i = 0; i < mNavigationAdapter.getCount(); i++) {
case INFO: Pane pane = mNavigationAdapter.getItem(i);
return "Info"; if (pane.name.equals(id))
case FULL: return pane;
return "Full";
case COMPACT:
return "Compact";
case PUBLIC:
return "Public";
case FACTION:
return "Faction";
case DEBUG:
return "Debug";
default:
return mIitc.getString(R.string.app_name);
} }
throw new IllegalArgumentException("Unknown pane: " + id);
}
public void hideActionBar() {
mActionBar.hide();
} }
public boolean isDrawerOpened() { public boolean isDrawerOpened() {
@ -268,7 +210,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
@Override @Override
public void run() { public void run() {
mIitc.invalidateOptionsMenu(); mIitc.invalidateOptionsMenu();
updateActionBar(); updateViews();
} }
}, 200); }, 200);
} }
@ -278,7 +220,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
super.onDrawerOpened(drawerView); super.onDrawerOpened(drawerView);
mIitc.getWebView().onWindowFocusChanged(false); mIitc.getWebView().onWindowFocusChanged(false);
mIitc.invalidateOptionsMenu(); mIitc.invalidateOptionsMenu();
updateActionBar(); updateViews();
mDrawerLayout.closeDrawer(drawerView.equals(mDrawerLeft) ? mDrawerRight : mDrawerLeft); mDrawerLayout.closeDrawer(drawerView.equals(mDrawerLeft) ? mDrawerRight : mDrawerLeft);
} }
@ -310,7 +252,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
public void onPrefChanged() { public void onPrefChanged() {
mDesktopMode = mPrefs.getBoolean("pref_force_desktop", false); mDesktopMode = mPrefs.getBoolean("pref_force_desktop", false);
updateActionBar(); updateViews();
} }
public void openRightDrawer() { public void openRightDrawer() {
@ -321,37 +263,100 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
public void reset() { public void reset() {
mPane = Pane.MAP; mPane = Pane.MAP;
updateActionBar(); mNavigationAdapter.reset();
updateViews();
} }
public void setDebugMode(boolean enabled) { public void setDebugMode(boolean enabled) {
mNavigationAdapter.remove(Pane.DEBUG); // avoid duplicates mNavigationAdapter.reset();
if (enabled) {
mNavigationAdapter.add(Pane.DEBUG);
}
} }
public void setHighlighter(String name) { public void setHighlighter(String name) {
mHighlighter = name; mHighlighter = name;
updateActionBar(); updateViews();
} }
public void setLoadingState(boolean isLoading) { public void setLoadingState(boolean isLoading) {
mIsLoading = isLoading; mIsLoading = isLoading;
updateActionBar(); updateViews();
}
public void switchTo(Pane pane) {
mPane = pane;
updateActionBar();
} }
public void showActionBar() { public void showActionBar() {
mActionBar.show(); mActionBar.show();
} }
public void hideActionBar() { public void switchTo(Pane pane) {
mActionBar.hide(); mPane = pane;
updateViews();
}
private class NavigationAdapter extends ArrayAdapter<Pane> {
public NavigationAdapter() {
super(mIitc, R.layout.list_item_selectable);
reset();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView view = (TextView) super.getView(position, convertView, parent);
Pane item = getItem(position);
view.setText(item.label);
if (item.icon != 0) {
view.setCompoundDrawablesWithIntrinsicBounds(item.icon, 0, 0, 0);
}
return view;
}
public void reset() {
clear();
add(Pane.INFO);
add(Pane.FULL);
add(Pane.COMPACT);
add(Pane.PUBLIC);
add(Pane.FACTION);
if (mPrefs.getBoolean("pref_advanced_menu", false)) {
add(Pane.DEBUG);
}
}
}
public static class Pane {
public static final Pane COMPACT = new Pane("compact", "Compact", R.drawable.ic_action_view_as_list_compact);
public static final Pane DEBUG = new Pane("debug", "Debug", R.drawable.ic_action_error);
public static final Pane FACTION = new Pane("faction", "Faction", R.drawable.ic_action_cc_bcc);
public static final Pane FULL = new Pane("full", "Full", R.drawable.ic_action_view_as_list);
public static final Pane INFO = new Pane("info", "Info", R.drawable.ic_action_about);
public static final Pane MAP = new Pane("map", "IITC Mobile", R.drawable.ic_action_map);
public static final Pane PUBLIC = new Pane("public", "Public", R.drawable.ic_action_group);
private int icon;
public String label;
public String name;
public Pane(String name, String label, int icon) {
this.name = name;
this.label = label;
this.icon = icon;
}
@Override
public boolean equals(Object o) {
if (o == null) return false;
if (o.getClass() != getClass()) return false;
Pane pane = (Pane) o;
return name.equals(pane.name);
}
@Override
public int hashCode() {
return name.hashCode();
}
} }
} }

View File

@ -169,6 +169,13 @@
window.plugin.bookmarks.saveStorageBox(); window.plugin.bookmarks.saveStorageBox();
} }
window.plugin.bookmarks.onPaneChanged = function(pane) {
if(pane == "plugin-bookmarks")
$('#bookmarksBox').css("display", "");
else
$('#bookmarksBox').css("display", "none");
}
// Switch list (maps/portals) // Switch list (maps/portals)
window.plugin.bookmarks.switchPageBkmrksBox = function(elem, page) { window.plugin.bookmarks.switchPageBkmrksBox = function(elem, page) {
window.plugin.bookmarks.statusBox.page = page; window.plugin.bookmarks.statusBox.page = page;
@ -938,8 +945,13 @@
$("#bookmarksBox #bookmarksMin , #bookmarksBox ul li, #bookmarksBox ul li a, #bookmarksBox ul li a span, #bookmarksBox h5, #bookmarksBox .addForm a").disableSelection(); $("#bookmarksBox #bookmarksMin , #bookmarksBox ul li, #bookmarksBox ul li a, #bookmarksBox ul li a span, #bookmarksBox h5, #bookmarksBox .addForm a").disableSelection();
$('#bookmarksBox').css({'top':window.plugin.bookmarks.statusBox.pos.x, 'left':window.plugin.bookmarks.statusBox.pos.y}); $('#bookmarksBox').css({'top':window.plugin.bookmarks.statusBox.pos.x, 'left':window.plugin.bookmarks.statusBox.pos.y});
}else{ }else{
$('#portaldetails').before(window.plugin.bookmarks.htmlBoxTrigger + window.plugin.bookmarks.htmlBkmrksBox); $('body').append(window.plugin.bookmarks.htmlBkmrksBox);
$('#bookmarksBox').css("display", "none").addClass("mobile");
if(typeof android !== 'undefined' && android && android.addPane)
android.addPane("plugin-bookmarks", "Bookmarks", "ic_action_star");
window.addHook('paneChanged', window.plugin.bookmarks.onPaneChanged);
// Remove the star // Remove the star
window.addHook('portalSelected', function(data) { window.addHook('portalSelected', function(data) {
if(data.selectedPortalGuid === null) { if(data.selectedPortalGuid === null) {

View File

@ -358,139 +358,131 @@
/********************************************** /**********************************************
MOBILE MOBILE
**********************************************/ **********************************************/
#sidebar #bookmarksBox{ #bookmarksBox.mobile{
position:static !important; position:absolute !important;
width:auto !important; width: 100% !important;
margin:0 !important; height: 100% !important;
top: 0 !important;
left: 0 !important;
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
background: transparent !important;;
} }
#sidebar #bkmrksTrigger, #bookmarksBox.mobile .bookmarkList ul,
#sidebar #bookmarksBox .bookmarkList ul, #bookmarksBox.mobile .bookmarkList ul li,
#sidebar #bookmarksBox .bookmarkList ul li, #bookmarksBox.mobile .bookmarkList.current,
#sidebar #bookmarksBox .bookmarkList.current, #bookmarksBox.mobile .bookmarkList li.bookmarkFolder.open ul{
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder.open ul{
width:100% !important; width:100% !important;
display:block !important; display:block !important;
} }
#sidebar #bookmarksBox *{ #bookmarksBox.mobile *{
box-shadow:none !important; box-shadow:none !important;
border-width:0 !important; border-width:0 !important;
} }
#sidebar #bookmarksBox #topBar{ #bookmarksBox.mobile #topBar{
display:none !important; display:none !important;
} }
#sidebar #bookmarksBox #bookmarksTypeBar h5{ #bookmarksBox.mobile #bookmarksTypeBar h5{
cursor:pointer; cursor:pointer;
text-align:center; text-align:center;
float:left; float:left;
width:50%; width:50%;
padding:7px 0; padding:7px 0;
} }
#sidebar #bookmarksBox #bookmarksTypeBar h5.current{ #bookmarksBox.mobile #bookmarksTypeBar h5.current{
cursor:default; cursor:default;
color:#fff; color:#fff;
} }
#sidebar #bookmarksBox #bookmarksTypeBar, #bookmarksBox.mobile #bookmarksTypeBar,
#sidebar #bookmarksBox .bookmarkList .addForm{ #bookmarksBox.mobile .bookmarkList .addForm{
border-bottom:1px solid #20a8b1 !important; border-bottom:1px solid #20a8b1 !important;
} }
#sidebar #bookmarksBox .bookmarkList ul li ul li.bkmrk, #bookmarksBox.mobile .bookmarkList ul li ul li.bkmrk,
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel{ #bookmarksBox.mobile .bookmarkList li.bookmarkFolder .folderLabel{
height:36px !important; height:36px !important;
clear:both; clear:both;
} }
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel a, #bookmarksBox.mobile .bookmarkList li.bookmarkFolder .folderLabel a,
#sidebar #bookmarksBox .bookmarkList ul li ul li.bkmrk a{ #bookmarksBox.mobile .bookmarkList ul li ul li.bkmrk a{
background:none; background:none;
padding:7px 0; padding:7px 0;
height:auto; height:auto;
box-shadow:inset 0 1px 0 #20a8b1 !important; box-shadow:inset 0 1px 0 #20a8b1 !important;
} }
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder a.bookmarksRemoveFrom, #bookmarksBox.mobile .bookmarkList li.bookmarkFolder a.bookmarksRemoveFrom,
#sidebar #bookmarksBox .bookmarkList li.bkmrk a.bookmarksRemoveFrom{ #bookmarksBox.mobile .bookmarkList li.bkmrk a.bookmarksRemoveFrom{
box-shadow:inset 0 1px 0 #20a8b1,inset -1px 0 0 #20a8b1 !important; box-shadow:inset 0 1px 0 #20a8b1,inset -1px 0 0 #20a8b1 !important;
width:15%; width:15%;
background:none !important; background:none !important;
} }
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder a.bookmarksAnchor, #bookmarksBox.mobile .bookmarkList li.bookmarkFolder a.bookmarksAnchor,
#sidebar #bookmarksBox .bookmarkList li.bkmrk a.bookmarksLink{ #bookmarksBox.mobile .bookmarkList li.bkmrk a.bookmarksLink{
text-indent:10px; text-indent:10px;
width:85%; width:85%;
height:21px; height:21px;
overflow:hidden; overflow:hidden;
} }
#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder ul{ #bookmarksBox.mobile .bookmarkList ul li.bookmarkFolder ul{
margin-left:0 !important; margin-left:0 !important;
} }
#sidebar #bookmarksBox .bookmarkList > ul{ #bookmarksBox.mobile .bookmarkList > ul{
border-bottom:1px solid #20a8b1 !important; border-bottom:1px solid #20a8b1 !important;
border-right:1px solid #20a8b1 !important; border-right:1px solid #20a8b1 !important;
} }
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.othersBookmarks ul{ #bookmarksBox.mobile .bookmarkList .bookmarkFolder.othersBookmarks ul{
border-top:5px solid #20a8b1 !important; border-top:5px solid #20a8b1 !important;
} }
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder, #bookmarksBox.mobile .bookmarkList li.bookmarkFolder,
#sidebar #bookmarksBox .bookmarkList li.bkmrk{ #bookmarksBox.mobile .bookmarkList li.bkmrk{
box-shadow:inset 0 1px 0 #20a8b1, 1px 0 0 #20a8b1, -1px 1px 0 #20a8b1 !important; box-shadow:inset 0 1px 0 #20a8b1, 1px 0 0 #20a8b1, -1px 1px 0 #20a8b1 !important;
} }
#sidebar #bookmarksBox .bookmarkList > ul{ #bookmarksBox.mobile .bookmarkList > ul{
max-height:none; max-height:none;
width:85% !important; width:85% !important;
} }
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel{ #bookmarksBox.mobile .bookmarkList li.bookmarkFolder .folderLabel{
box-shadow:0 1px 0 #20a8b1 !important; box-shadow:0 1px 0 #20a8b1 !important;
} }
#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder ul{ #bookmarksBox.mobile .bookmarkList ul li.bookmarkFolder ul{
width:85% !important; width:85% !important;
margin-left:15% !important; margin-left:15% !important;
} }
#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder.othersBookmarks ul{ #bookmarksBox.mobile .bookmarkList ul li.bookmarkFolder.othersBookmarks ul{
width:100% !important; width:100% !important;
margin-left:0% !important; margin-left:0% !important;
} }
#sidebar #bkmrksTrigger{ #bookmarksBox.mobile{
position:static;
width:auto;
margin:0;
height:auto;
background:none;
text-indent:0;
padding:11px 0 9px;
margin-bottom:5px;
}
#sidebar #bkmrksTrigger.open{
margin-bottom:0;
}
#sidebar #bookmarksBox{
margin-bottom:5px !important; margin-bottom:5px !important;
} }
#sidebar #bookmarksBox #bookmarksTypeBar{ #bookmarksBox.mobile #bookmarksTypeBar{
height:auto; height:auto;
} }
#sidebar #bookmarksBox .addForm, #bookmarksBox.mobile .addForm,
#sidebar #bookmarksBox .addForm *{ #bookmarksBox.mobile .addForm *{
height:35px; height:35px;
padding:0; padding:0;
} }
#sidebar #bookmarksBox .addForm a{ #bookmarksBox.mobile .addForm a{
line-height:37px; line-height:37px;
} }
#sidebar #bookmarksBox .addForm a{ #bookmarksBox.mobile .addForm a{
width:25% !important; width:25% !important;
} }
#sidebar #bookmarksBox .addForm input{ #bookmarksBox.mobile .addForm input{
width:50% !important; width:50% !important;
text-indent:10px; text-indent:10px;
} }
#sidebar #bookmarksBox #bkmrk_portals .addForm input{ #bookmarksBox.mobile #bkmrk_portals .addForm input{
width:75% !important; width:75% !important;
} }
#sidebar #bookmarksBox #bookmarksTypeBar h5, #bookmarksBox.mobile #bookmarksTypeBar h5,
#sidebar #bookmarksBox .bookmarkList .addForm a{ #bookmarksBox.mobile .bookmarkList .addForm a{
box-shadow:-1px 0 0 #20a8b1 !important; box-shadow:-1px 0 0 #20a8b1 !important;
} }
#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder ul{ #bookmarksBox.mobile .bookmarkList li.bookmarkFolder ul{
display:none !important; display:none !important;
min-height:37px !important; min-height:37px !important;
} }
@ -500,26 +492,26 @@
padding:0 3px 1px 4px; padding:0 3px 1px 4px;
background:#262c32; background:#262c32;
} }
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span, #bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span,
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span, #bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span,
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span, #bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span > span,
#sidebar #bookmarksBox .bookmarkList .triangle{ #bookmarksBox.mobile .bookmarkList .triangle{
width:0 !important; width:0 !important;
height:0 !important; height:0 !important;
} }
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span{ #bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span{
float:left !important; float:left !important;
border-width:5px 0 5px 7px !important; border-width:5px 0 5px 7px !important;
border-color:transparent transparent transparent white !important; border-color:transparent transparent transparent white !important;
margin:7px 3px 0 13px !important; margin:7px 3px 0 13px !important;
} }
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel .bookmarksAnchor span{ #bookmarksBox.mobile .bookmarkList .bookmarkFolder.open .folderLabel .bookmarksAnchor span{
margin:9px 1px 0 12px !important; margin:9px 1px 0 12px !important;
border-width:7px 5px 0 5px !important; border-width:7px 5px 0 5px !important;
border-color:white transparent transparent transparent !important; border-color:white transparent transparent transparent !important;
} }
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span, #bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span,
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{ #bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span > span{
display:none !important; display:none !important;
border-width:0 12px 10px 0 !important; border-width:0 12px 10px 0 !important;
border-color:transparent #20a8b1 transparent transparent !important; border-color:transparent #20a8b1 transparent transparent !important;
@ -528,14 +520,14 @@
top:21px !important; top:21px !important;
left:-10px !important; left:-10px !important;
} }
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{ #bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span > span{
top:18px !important; top:18px !important;
left:0 !important; left:0 !important;
border-width:0 10px 9px 0 !important; border-width:0 10px 9px 0 !important;
border-color:transparent #069 transparent transparent !important; border-color:transparent #069 transparent transparent !important;
} }
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel > span, #bookmarksBox.mobile .bookmarkList .bookmarkFolder.open .folderLabel > span,
#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel > span > span{ #bookmarksBox.mobile .bookmarkList .bookmarkFolder.open .folderLabel > span > span{
display:block !important; display:block !important;
} }
/********************************************** /**********************************************
@ -605,4 +597,4 @@
width:96%; width:96%;
height:120px; height:120px;
resize:vertical; resize:vertical;
} }

View File

@ -112,13 +112,17 @@ window.plugin.portalslist.displayPL = function() {
html = '<table><tr><td>Nothing to show!</td></tr></table>'; html = '<table><tr><td>Nothing to show!</td></tr></table>';
}; };
dialog({ if(typeof android !== 'undefined' && android && android.addPane) {
html: '<div id="portalslist">' + html + '</div>', $('<div id="portalslist" class="mobile">' + html + '</div>').appendTo(document.body);
dialogClass: 'ui-dialog-portalslist', } else {
title: 'Portal list: ' + window.plugin.portalslist.listPortals.length + ' ' + (window.plugin.portalslist.listPortals.length == 1 ? 'portal' : 'portals'), dialog({
id: 'portal-list', html: '<div id="portalslist">' + html + '</div>',
width: 700 dialogClass: 'ui-dialog-portalslist',
}); title: 'Portal list: ' + window.plugin.portalslist.listPortals.length + ' ' + (window.plugin.portalslist.listPortals.length == 1 ? 'portal' : 'portals'),
id: 'portal-list',
width: 700
});
}
//run the name resolving process //run the name resolving process
//resolvePlayerNames(); //resolvePlayerNames();
@ -224,9 +228,23 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) {
return div; return div;
} }
window.plugin.portalslist.onPaneChanged = function(pane) {
if(pane == "plugin-portalslist")
window.plugin.portalslist.displayPL();
else
$("#portalslist").remove()
};
var setup = function() { var setup = function() {
$('#toolbox').append(' <a onclick="window.plugin.portalslist.displayPL()" title="Display a list of portals in the current view">Portals list</a>'); if(typeof android !== 'undefined' && android && android.addPane) {
android.addPane("plugin-portalslist", "Portals list", "ic_action_view_as_list");
addHook("paneChanged", window.plugin.portalslist.onPaneChanged);
} else {
$('#toolbox').append(' <a onclick="window.plugin.portalslist.displayPL()" title="Display a list of portals in the current view">Portals list</a>');
}
$('head').append('<style>' + $('head').append('<style>' +
'#portalslist.mobile {background: transparent; border: 0 none !important; height: 100% !important; width: 100% !important; left: 0 !important; top: 0 !important; position: absolute; overflow: auto; }' +
'#portalslist table {margin-top:5px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' + '#portalslist table {margin-top:5px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' +
'#portalslist table td, #portalslist table th {border-bottom: 1px solid #0b314e; padding:3px; color:white; background-color:#1b415e}' + '#portalslist table td, #portalslist table th {border-bottom: 1px solid #0b314e; padding:3px; color:white; background-color:#1b415e}' +
'#portalslist table tr.res td { background-color: #005684; }' + '#portalslist table tr.res td { background-color: #005684; }' +