Shorten the menu title on mobile.

This commit is contained in:
FelisCatus 2017-08-03 22:39:23 -04:00
parent b40ff3d36c
commit d8684c6d24
2 changed files with 13 additions and 1 deletions

View File

@ -255,12 +255,15 @@ options.currentProfileChanged = (reason) ->
if currentName if currentName
title = chrome.i18n.getMessage('browserAction_titleWithResult', [ title = chrome.i18n.getMessage('browserAction_titleWithResult', [
currentName, '', details]) currentName, '', details])
shortTitle = 'Omega: ' + currentName # TODO: I18n.
else else
title = details title = details
shortTitle = 'Omega: ' + details # TODO: I18n.
if external and current.profileType != 'SystemProfile' if external and current.profileType != 'SystemProfile'
message = chrome.i18n.getMessage('browserAction_titleExternalProxy') message = chrome.i18n.getMessage('browserAction_titleExternalProxy')
title = message + '\n' + title title = message + '\n' + title
shortTitle = 'Omega-Extern: ' + details # TODO: I18n.
options.setBadge() options.setBadge()
if not current.name or not OmegaPac.Profiles.isInclusive(current) if not current.name or not OmegaPac.Profiles.isInclusive(current)
@ -271,6 +274,7 @@ options.currentProfileChanged = (reason) ->
tabs.resetAll( tabs.resetAll(
icon: icon icon: icon
title: title title: title
shortTitle: shortTitle
) )
encodeError = (obj) -> encodeError = (obj) ->

View File

@ -25,7 +25,10 @@ class ChromeTabs
tabs.forEach (tab) => tabs.forEach (tab) =>
@_dirtyTabs[tab.id] = tab.id @_dirtyTabs[tab.id] = tab.id
@onUpdated tab.id, {}, tab if tab.active @onUpdated tab.id, {}, tab if tab.active
chrome.browserAction.setTitle({title: action.title}) if chrome.browserAction.setPopup?
chrome.browserAction.setTitle({title: action.title})
else
chrome.browserAction.setTitle({title: action.shortTitle})
@setIcon(action.icon) @setIcon(action.icon)
onUpdated: (tabId, changeInfo, tab) -> onUpdated: (tabId, changeInfo, tab) ->
@ -41,6 +44,11 @@ class ChromeTabs
for own id of @_badgeTab for own id of @_badgeTab
try chrome.browserAction.setBadgeText?(text: '', tabId: id) try chrome.browserAction.setBadgeText?(text: '', tabId: id)
@_badgeTab = null @_badgeTab = null
if not chrome.browserAction.setPopup?
# TODO: Is there a way to show current proxy for page? Is there even
# enough space?
return
if not tab.url? or tab.url.indexOf("chrome") == 0 if not tab.url? or tab.url.indexOf("chrome") == 0
if @_defaultAction if @_defaultAction
chrome.browserAction.setTitle({ chrome.browserAction.setTitle({