mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-02-02 02:58:13 -05:00
Open popup as tab if browser does not support popup.
This commit is contained in:
parent
d8684c6d24
commit
6f0f3e4636
@ -272,12 +272,17 @@ class ChromeOptions extends OmegaTarget.Options
|
||||
url: chrome.extension.getURL('options.html#/ui')
|
||||
)
|
||||
|
||||
if quickSwitch
|
||||
if quickSwitch or not chrome.browserAction.setPopup?
|
||||
chrome.browserAction.setPopup?({popup: ''})
|
||||
if not @_quickSwitchInit
|
||||
@_quickSwitchInit = true
|
||||
chrome.browserAction.onClicked.addListener (tab) =>
|
||||
@clearBadge()
|
||||
if not @_options['-enableQuickSwitch']
|
||||
# If we reach here, then the browser does not support popup.
|
||||
# Let's open the popup page in a tab.
|
||||
chrome.tabs.create(url: 'popup/index.html')
|
||||
return
|
||||
profiles = @_options['-quickSwitchProfiles']
|
||||
index = profiles.indexOf(@_currentProfileName)
|
||||
index = (index + 1) % profiles.length
|
||||
@ -290,7 +295,7 @@ class ChromeOptions extends OmegaTarget.Options
|
||||
return if url.substr(0, 4) == 'moz-'
|
||||
chrome.tabs.reload(tab.id)
|
||||
else
|
||||
chrome.browserAction.setPopup?({popup: 'popup/index.html'})
|
||||
chrome.browserAction.setPopup({popup: 'popup/index.html'})
|
||||
Promise.resolve()
|
||||
|
||||
setInspect: (settings) ->
|
||||
|
@ -21,6 +21,7 @@ html(lang='en' ng-app='omegaPopup' ng-controller='PopupCtrl' ng-csp)
|
||||
head
|
||||
meta(charset='utf-8')
|
||||
title {{'popup_title' | tr}}
|
||||
meta(name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no')
|
||||
link(rel='stylesheet' href='lib/bootstrap/css/bootstrap.min.css')
|
||||
link(rel='stylesheet' href='css/popup.css')
|
||||
body(ng-class='{"with-condition-form": showConditionForm}')
|
||||
|
@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>SwitchyOmega Popup</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="stylesheet" href="css/index.css">
|
||||
</head>
|
||||
<body>
|
||||
|
@ -14,6 +14,9 @@
|
||||
|
||||
function closePopup() {
|
||||
window.close();
|
||||
// If the popup is opened as a tab, the above won't work. Let's reload then.
|
||||
document.body.style.opacity = 0;
|
||||
setTimeout(function() { history.go(0); }, 300);
|
||||
}
|
||||
|
||||
function showOptions(e) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>SwitchyOmega Popup</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="stylesheet" href="css/dialog.css">
|
||||
</head>
|
||||
<body>
|
||||
|
Loading…
Reference in New Issue
Block a user