diff --git a/code/hooks.js b/code/hooks.js index b4959745..60eefe45 100644 --- a/code/hooks.js +++ b/code/hooks.js @@ -50,6 +50,10 @@ // iitcLoaded: called after IITC and all plugins loaded // portalDetailLoaded: called when a request to load full portal detail // 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.VALID_HOOKS = [ @@ -60,7 +64,7 @@ window.VALID_HOOKS = [ 'publicChatDataAvailable', 'factionChatDataAvailable', 'requestFinished', 'nicknameClicked', 'geoSearch', 'iitcLoaded', - 'portalDetailLoaded']; + 'portalDetailLoaded', 'paneChanged']; window.runHooks = function(event, data) { if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event); diff --git a/code/panes.js b/code/panes.js index 4c3898d4..c5ea4eea 100644 --- a/code/panes.js +++ b/code/panes.js @@ -3,6 +3,8 @@ window.show = function(id) { window.hideall(); + runHooks("paneChanged", id); + switch(id) { case 'full': window.chat.show('full'); @@ -27,9 +29,6 @@ window.show = function(id) { case 'info': window.smartphone.sideButton.click(); break; - default: - window.smartphone.mapButton.click(); - break; } if (typeof android !== 'undefined' && android && android.switchToPane) { diff --git a/mobile/res/drawable-hdpi/ic_action_star.png b/mobile/res/drawable-hdpi/ic_action_star.png new file mode 100644 index 00000000..7c3e1db9 Binary files /dev/null and b/mobile/res/drawable-hdpi/ic_action_star.png differ diff --git a/mobile/res/drawable-mdpi/ic_action_star.png b/mobile/res/drawable-mdpi/ic_action_star.png new file mode 100644 index 00000000..c9e12ac2 Binary files /dev/null and b/mobile/res/drawable-mdpi/ic_action_star.png differ diff --git a/mobile/res/drawable-xhdpi/ic_action_star.png b/mobile/res/drawable-xhdpi/ic_action_star.png new file mode 100644 index 00000000..e3291481 Binary files /dev/null and b/mobile/res/drawable-xhdpi/ic_action_star.png differ diff --git a/mobile/res/drawable-xxhdpi/ic_action_star.png b/mobile/res/drawable-xxhdpi/ic_action_star.png new file mode 100644 index 00000000..f1e51a75 Binary files /dev/null and b/mobile/res/drawable-xxhdpi/ic_action_star.png differ diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index 1babb023..7fe993dd 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -68,6 +68,12 @@ • tap and hold a portal for a second
• tap on the left half of the status bar]]> + +
+ Some plugins (e.g. portals list and bookmarks) now appear in the navigation drawer for quick access.
+ They won\'t appear in the info pane any more.

+ Swipe from the left edge of your screen (or click the app icon) to seem them.]]> +
UI Misc diff --git a/mobile/smartphone.css b/mobile/smartphone.css index be95476e..60c1109f 100644 --- a/mobile/smartphone.css +++ b/mobile/smartphone.css @@ -1,5 +1,4 @@ body { - background: #000; color: #fff; } @@ -81,7 +80,7 @@ body { } #sidebar, #chatcontrols, #chat, #chatinput { - background: #0B3351 !important; + background: transparent !important; } .leaflet-top .leaflet-control { @@ -199,19 +198,18 @@ body { padding: 5px; margin-top: 3px; margin-bottom: 3px; - border: 2px outset #0e3d4e; + border: 2px outset #20A8B1; } #toolbox > a { padding: 5px; margin-top: 3px; margin-bottom: 3px; - border: 2px outset #0e3d4e; + border: 2px outset #20A8B1; } #portaldetails .close { padding: 4px; - border: 1px outset #0e3d4e; + border: 1px outset #20A8B1; margin-top: 2px; - background: #0e3d4e; } diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java index 0222fbe9..010afcdd 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java @@ -13,8 +13,6 @@ import android.widget.Toast; import com.cradle.iitc_mobile.IITC_NavigationHelper.Pane; import com.cradle.iitc_mobile.share.ShareActivity; -import java.util.Locale; - // provide communication between IITC script and android app public class IITC_JSInterface { // context of main activity @@ -96,7 +94,7 @@ public class IITC_JSInterface { public void run() { Pane pane; try { - pane = Pane.valueOf(id.toUpperCase(Locale.getDefault())); + pane = mIitc.getNavigationHelper().getPane(id); } catch (IllegalArgumentException e) { 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); + } + }); + } } diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java b/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java index 1e06f9e1..687aff13 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java @@ -12,7 +12,6 @@ import android.widget.ArrayAdapter; import android.widget.CheckedTextView; import android.widget.ListView; import android.widget.Spinner; -import android.widget.TextView; import org.json.JSONArray; import org.json.JSONException; diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index dfda5290..3332f442 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -35,7 +35,6 @@ import com.cradle.iitc_mobile.IITC_NavigationHelper.Pane; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; -import java.util.Locale; import java.util.Stack; 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) { - String name = pane.name().toLowerCase(Locale.getDefault()); - mIitcWebView.loadUrl("javascript: window.show('" + name + "');"); + mIitcWebView.loadUrl("javascript: window.show('" + pane.name + "');"); } @Override diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java index 87224326..7f93e1ae 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java @@ -34,71 +34,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt // Makes the icon/title clickable // getActionBar().setHomeButtonEnabled(enabled); - private class NavigationAdapter extends ArrayAdapter { - 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_INFO = 1 << 1; + public static final int NOTICE_PANES = 1 << 2; // next one would be 1<<2; (this results in 1,2,4,8,...) private final IITC_Mobile mIitc; @@ -140,9 +78,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt } private void showNotice(final int which) { - if ((mPrefs.getInt("pref_messages", 0) & which) != 0) { - return; - } + if ((mPrefs.getInt("pref_messages", 0) & which) != 0) return; String text; switch (which) { @@ -152,6 +88,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt case NOTICE_INFO: text = mIitc.getText(R.string.notice_info).toString(); break; + case NOTICE_PANES: + text = mIitc.getText(R.string.notice_panes).toString(); + break; default: return; } @@ -185,10 +124,12 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt dialog.show(); } - private void updateActionBar() { + private void updateViews() { int position = mNavigationAdapter.getPosition(mPane); if (position >= 0 && position < mNavigationAdapter.getCount()) { mDrawerLeft.setItemChecked(position, true); + } else { + mDrawerLeft.setItemChecked(mDrawerLeft.getCheckedItemPosition(), false); } if (mDesktopMode) { @@ -219,7 +160,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) { mActionBar.setTitle(mIitc.getString(R.string.app_name)); } 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() { mDrawerLayout.closeDrawers(); } - public String getPaneTitle(Pane pane) { - switch (pane) { - case INFO: - return "Info"; - case FULL: - 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); + public Pane getPane(String id) { + for (int i = 0; i < mNavigationAdapter.getCount(); i++) { + Pane pane = mNavigationAdapter.getItem(i); + if (pane.name.equals(id)) + return pane; } + throw new IllegalArgumentException("Unknown pane: " + id); + } + + public void hideActionBar() { + mActionBar.hide(); } public boolean isDrawerOpened() { @@ -268,7 +210,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt @Override public void run() { mIitc.invalidateOptionsMenu(); - updateActionBar(); + updateViews(); } }, 200); } @@ -278,7 +220,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt super.onDrawerOpened(drawerView); mIitc.getWebView().onWindowFocusChanged(false); mIitc.invalidateOptionsMenu(); - updateActionBar(); + updateViews(); mDrawerLayout.closeDrawer(drawerView.equals(mDrawerLeft) ? mDrawerRight : mDrawerLeft); } @@ -310,7 +252,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt public void onPrefChanged() { mDesktopMode = mPrefs.getBoolean("pref_force_desktop", false); - updateActionBar(); + updateViews(); } public void openRightDrawer() { @@ -321,37 +263,100 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt public void reset() { mPane = Pane.MAP; - updateActionBar(); + mNavigationAdapter.reset(); + updateViews(); } public void setDebugMode(boolean enabled) { - mNavigationAdapter.remove(Pane.DEBUG); // avoid duplicates - if (enabled) { - mNavigationAdapter.add(Pane.DEBUG); - } + mNavigationAdapter.reset(); } public void setHighlighter(String name) { mHighlighter = name; - updateActionBar(); + updateViews(); } public void setLoadingState(boolean isLoading) { mIsLoading = isLoading; - updateActionBar(); - } - - public void switchTo(Pane pane) { - mPane = pane; - - updateActionBar(); + updateViews(); } public void showActionBar() { mActionBar.show(); } - public void hideActionBar() { - mActionBar.hide(); + public void switchTo(Pane pane) { + mPane = pane; + + updateViews(); + } + + private class NavigationAdapter extends ArrayAdapter { + 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(); + } } } diff --git a/plugins/bookmarks-by-zaso.user.js b/plugins/bookmarks-by-zaso.user.js index 89d4e6ed..c709cfb4 100644 --- a/plugins/bookmarks-by-zaso.user.js +++ b/plugins/bookmarks-by-zaso.user.js @@ -169,6 +169,13 @@ 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) window.plugin.bookmarks.switchPageBkmrksBox = function(elem, 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').css({'top':window.plugin.bookmarks.statusBox.pos.x, 'left':window.plugin.bookmarks.statusBox.pos.y}); }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 window.addHook('portalSelected', function(data) { if(data.selectedPortalGuid === null) { diff --git a/plugins/bookmarks-css.css b/plugins/bookmarks-css.css index 2fca0d09..9c160667 100644 --- a/plugins/bookmarks-css.css +++ b/plugins/bookmarks-css.css @@ -358,139 +358,131 @@ /********************************************** MOBILE **********************************************/ -#sidebar #bookmarksBox{ - position:static !important; - width:auto !important; - margin:0 !important; +#bookmarksBox.mobile{ + position:absolute !important; + width: 100% !important; + height: 100% !important; + top: 0 !important; + left: 0 !important; + margin: 0 !important; + padding: 0 !important; + border: 0 !important; + background: transparent !important;; } -#sidebar #bkmrksTrigger, -#sidebar #bookmarksBox .bookmarkList ul, -#sidebar #bookmarksBox .bookmarkList ul li, -#sidebar #bookmarksBox .bookmarkList.current, -#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder.open ul{ +#bookmarksBox.mobile .bookmarkList ul, +#bookmarksBox.mobile .bookmarkList ul li, +#bookmarksBox.mobile .bookmarkList.current, +#bookmarksBox.mobile .bookmarkList li.bookmarkFolder.open ul{ width:100% !important; display:block !important; } -#sidebar #bookmarksBox *{ +#bookmarksBox.mobile *{ box-shadow:none !important; border-width:0 !important; } -#sidebar #bookmarksBox #topBar{ +#bookmarksBox.mobile #topBar{ display:none !important; } -#sidebar #bookmarksBox #bookmarksTypeBar h5{ +#bookmarksBox.mobile #bookmarksTypeBar h5{ cursor:pointer; text-align:center; float:left; width:50%; padding:7px 0; } -#sidebar #bookmarksBox #bookmarksTypeBar h5.current{ +#bookmarksBox.mobile #bookmarksTypeBar h5.current{ cursor:default; color:#fff; } -#sidebar #bookmarksBox #bookmarksTypeBar, -#sidebar #bookmarksBox .bookmarkList .addForm{ +#bookmarksBox.mobile #bookmarksTypeBar, +#bookmarksBox.mobile .bookmarkList .addForm{ border-bottom:1px solid #20a8b1 !important; } -#sidebar #bookmarksBox .bookmarkList ul li ul li.bkmrk, -#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel{ +#bookmarksBox.mobile .bookmarkList ul li ul li.bkmrk, +#bookmarksBox.mobile .bookmarkList li.bookmarkFolder .folderLabel{ height:36px !important; clear:both; } -#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel a, -#sidebar #bookmarksBox .bookmarkList ul li ul li.bkmrk a{ +#bookmarksBox.mobile .bookmarkList li.bookmarkFolder .folderLabel a, +#bookmarksBox.mobile .bookmarkList ul li ul li.bkmrk a{ background:none; padding:7px 0; height:auto; box-shadow:inset 0 1px 0 #20a8b1 !important; } -#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder a.bookmarksRemoveFrom, -#sidebar #bookmarksBox .bookmarkList li.bkmrk a.bookmarksRemoveFrom{ +#bookmarksBox.mobile .bookmarkList li.bookmarkFolder a.bookmarksRemoveFrom, +#bookmarksBox.mobile .bookmarkList li.bkmrk a.bookmarksRemoveFrom{ box-shadow:inset 0 1px 0 #20a8b1,inset -1px 0 0 #20a8b1 !important; width:15%; background:none !important; } -#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder a.bookmarksAnchor, -#sidebar #bookmarksBox .bookmarkList li.bkmrk a.bookmarksLink{ +#bookmarksBox.mobile .bookmarkList li.bookmarkFolder a.bookmarksAnchor, +#bookmarksBox.mobile .bookmarkList li.bkmrk a.bookmarksLink{ text-indent:10px; width:85%; height:21px; overflow:hidden; } -#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder ul{ +#bookmarksBox.mobile .bookmarkList ul li.bookmarkFolder ul{ margin-left:0 !important; } -#sidebar #bookmarksBox .bookmarkList > ul{ +#bookmarksBox.mobile .bookmarkList > ul{ border-bottom: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; } -#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder, -#sidebar #bookmarksBox .bookmarkList li.bkmrk{ +#bookmarksBox.mobile .bookmarkList li.bookmarkFolder, +#bookmarksBox.mobile .bookmarkList li.bkmrk{ 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; width:85% !important; } -#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder .folderLabel{ +#bookmarksBox.mobile .bookmarkList li.bookmarkFolder .folderLabel{ box-shadow:0 1px 0 #20a8b1 !important; } -#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder ul{ +#bookmarksBox.mobile .bookmarkList ul li.bookmarkFolder ul{ width:85% !important; margin-left:15% !important; } -#sidebar #bookmarksBox .bookmarkList ul li.bookmarkFolder.othersBookmarks ul{ +#bookmarksBox.mobile .bookmarkList ul li.bookmarkFolder.othersBookmarks ul{ width:100% !important; margin-left:0% !important; } -#sidebar #bkmrksTrigger{ - 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{ +#bookmarksBox.mobile{ margin-bottom:5px !important; } -#sidebar #bookmarksBox #bookmarksTypeBar{ +#bookmarksBox.mobile #bookmarksTypeBar{ height:auto; } -#sidebar #bookmarksBox .addForm, -#sidebar #bookmarksBox .addForm *{ +#bookmarksBox.mobile .addForm, +#bookmarksBox.mobile .addForm *{ height:35px; padding:0; } -#sidebar #bookmarksBox .addForm a{ +#bookmarksBox.mobile .addForm a{ line-height:37px; } -#sidebar #bookmarksBox .addForm a{ +#bookmarksBox.mobile .addForm a{ width:25% !important; } -#sidebar #bookmarksBox .addForm input{ +#bookmarksBox.mobile .addForm input{ width:50% !important; text-indent:10px; } -#sidebar #bookmarksBox #bkmrk_portals .addForm input{ +#bookmarksBox.mobile #bkmrk_portals .addForm input{ width:75% !important; } -#sidebar #bookmarksBox #bookmarksTypeBar h5, -#sidebar #bookmarksBox .bookmarkList .addForm a{ +#bookmarksBox.mobile #bookmarksTypeBar h5, +#bookmarksBox.mobile .bookmarkList .addForm a{ box-shadow:-1px 0 0 #20a8b1 !important; } -#sidebar #bookmarksBox .bookmarkList li.bookmarkFolder ul{ +#bookmarksBox.mobile .bookmarkList li.bookmarkFolder ul{ display:none !important; min-height:37px !important; } @@ -500,26 +492,26 @@ padding:0 3px 1px 4px; background:#262c32; } -#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span, -#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span, -#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span, -#sidebar #bookmarksBox .bookmarkList .triangle{ +#bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span, +#bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span, +#bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span > span, +#bookmarksBox.mobile .bookmarkList .triangle{ width:0 !important; height:0 !important; } -#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span{ +#bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel .bookmarksAnchor span{ float:left !important; border-width:5px 0 5px 7px !important; border-color:transparent transparent transparent white !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; border-width:7px 5px 0 5px !important; border-color:white transparent transparent transparent !important; } -#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span, -#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{ +#bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span, +#bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span > span{ display:none !important; border-width:0 12px 10px 0 !important; border-color:transparent #20a8b1 transparent transparent !important; @@ -528,14 +520,14 @@ top:21px !important; left:-10px !important; } -#sidebar #bookmarksBox .bookmarkList .bookmarkFolder .folderLabel > span > span{ +#bookmarksBox.mobile .bookmarkList .bookmarkFolder .folderLabel > span > span{ top:18px !important; left:0 !important; border-width:0 10px 9px 0 !important; border-color:transparent #069 transparent transparent !important; } -#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel > span, -#sidebar #bookmarksBox .bookmarkList .bookmarkFolder.open .folderLabel > span > span{ +#bookmarksBox.mobile .bookmarkList .bookmarkFolder.open .folderLabel > span, +#bookmarksBox.mobile .bookmarkList .bookmarkFolder.open .folderLabel > span > span{ display:block !important; } /********************************************** @@ -605,4 +597,4 @@ width:96%; height:120px; resize:vertical; -} \ No newline at end of file +} diff --git a/plugins/portals-list.user.js b/plugins/portals-list.user.js index ce61c6a6..536085f0 100644 --- a/plugins/portals-list.user.js +++ b/plugins/portals-list.user.js @@ -112,13 +112,17 @@ window.plugin.portalslist.displayPL = function() { html = '
Nothing to show!
'; }; - dialog({ - html: '
' + html + '
', - 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 - }); + if(typeof android !== 'undefined' && android && android.addPane) { + $('
' + html + '
').appendTo(document.body); + } else { + dialog({ + html: '
' + html + '
', + 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 //resolvePlayerNames(); @@ -224,9 +228,23 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) { return div; } +window.plugin.portalslist.onPaneChanged = function(pane) { + if(pane == "plugin-portalslist") + window.plugin.portalslist.displayPL(); + else + $("#portalslist").remove() +}; + var setup = function() { - $('#toolbox').append(' Portals list'); + 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(' Portals list'); + } + $('head').append('