Compatible with Arc browser

This commit is contained in:
suziwen 2024-05-24 19:03:49 +08:00
parent 815e162640
commit 962bc129cd
16 changed files with 2844 additions and 19 deletions

View File

@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "ZeroOmega--Proxy Switchy manifest v3 version",
"version": "3.2.1",
"version": "3.2.2",
"description": "__MSG_manifest_app_description__",
"icons": {
"16": "img/icons/omega-action-16.png",

View File

@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "ZeroOmega--Proxy Switchy manifest v3 version",
"version": "3.2.1",
"version": "3.2.2",
"description": "__MSG_manifest_app_description__",
"icons": {
"16": "img/icons/omega-action-16.png",
@ -20,7 +20,7 @@
"32": "img/icons/omega-action-32.png"
},
"default_title": "__MSG_manifest_icon_default_title__",
"default_popup": "popup/index.html"
"default_popup": "popup-iframe.html"
},
"background": {
"service_worker": "x-background.js",

View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="./lib/iframeResizer/iframeResizer.min.js"></script>
<style>
html,body{
margin: 0;
padding:0;
}
iframe {
min-width: 300px;
}
</style>
</head>
<body>
<iframe id="myIframe" src="./popup/index.html" frameborder="0"></iframe>
<script src="./lib/script.js/script.min.js"></script>
<script src="./popup-iframe.js"></script>
</body>
</html>

View File

@ -0,0 +1,14 @@
document.location.href = './popup/index.html'
// arc browser can't use location.href to change.
// https://github.com/suziwen/ZeroOmega/issues/4
$script('js/omega_target_popup.js', 'om-target', function() {
$script('popup/js/style.js', 'om-style')
iFrameResize({
sizeWidth: true,
autoResize: true,
resizeFrom: 'child',
heightCalculationMethod: 'bodyScroll',
widthCalculationMethod: 'bodyOffset'
}, '#myIframe')
})

View File

@ -22,7 +22,8 @@ module.exports = class ExternalApi
return unless @disabled
@options.setProxyNotControllable(null)
chrome.action.setPopup?({popup: 'popup/index.html'})
#chrome.action.setPopup?({popup: 'popup/index.html'})
chrome.action.setPopup?({popup: 'popup-iframe.html'})
@options.reloadQuickSwitch()
@disabled = false
@options.clearBadge()
@ -49,7 +50,8 @@ module.exports = class ExternalApi
if @knownExts[port.sender.id] >= 32
reason = 'upgrade'
@options.setProxyNotControllable reason, {text: 'X', color: '#5ab432'}
chrome.action.setPopup?({popup: 'popup/index.html'})
#chrome.action.setPopup?({popup: 'popup/index.html'})
chrome.action.setPopup?({popup: 'popup-iframe.html'})
port.postMessage({action: 'state', state: 'disabled'})
when 'enable'
@reenable()

View File

@ -169,7 +169,8 @@ class ChromeOptions extends OmegaTarget.Options
if quickSwitch
chrome.action.setPopup({popup: ''})
else
chrome.action.setPopup({popup: 'popup/index.html'})
#chrome.action.setPopup({popup: 'popup/index.html'})
chrome.action.setPopup({popup: 'popup-iframe.html'})
chrome.contextMenus?.update('enableQuickSwitch', {checked: !!quickSwitch})
Promise.resolve()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -186,6 +186,7 @@ fieldset[disabled] .form-control {
inset: 0;
opacity: 0.1;
background-color: var(--primaryColor);
pointer-events: none;
}
.alert-danger {
@ -386,13 +387,24 @@ main .page-header {
background-color: var(--lighterBackground);
}
.om-nav-item.om-active > a {
color: var(--whiteColor);
color: var(--whiteColor)!important;
background-color: var(--infoColor);
}
.om-divider {
background-color: var(--lighterBackground);
}
.om-edit-toggle{
background-color: var(--defaultBackground);
border-color: var(--selectionBackground);
color: var(--primaryColor);
}
.om-edit-toggle:hover{
background-color: var(--lighterBackground);
border-color: var(--highlightBackground);
}
/**
* spectrum.css
**/

View File

@ -87,19 +87,19 @@ module.controller 'PopupCtrl', ($scope, $window, $q, omegaTarget,
$scope.customCss = customCss
$scope.closePopup = ->
$window.close()
$window.top.close()
$scope.openManage = ->
omegaTarget.openManage()
$window.close()
$window.top.close()
refreshOnProfileChange = false
refresh = ->
if refreshOnProfileChange
omegaTarget.refreshActivePage().then ->
$window.close()
$window.top.close()
else
$window.close()
$window.top.close()
$scope.profileIcons = profileIcons
$scope.dispNameFilter = dispNameFilter
$scope.isActive = (profileName) ->
@ -123,7 +123,7 @@ module.controller 'PopupCtrl', ($scope, $window, $q, omegaTarget,
desc || profile?.name || ''
$scope.openOptions = (hash) ->
omegaTarget.openOptions(hash).then ->
$window.close()
$window.top.close()
$scope.openConditionHelp = ->
pname = encodeURIComponent($scope.currentProfileName)
$scope.openOptions("#/profile/#{pname}?help=condition")
@ -143,9 +143,9 @@ module.controller 'PopupCtrl', ($scope, $window, $q, omegaTarget,
).then(next)
if apply
apply.then -> $window.close()
apply.then -> $window.top.close()
else
$window.close()
$window.top.close()
$scope.tempRuleMenu = {open: false}
$scope.nameExternal = {open: false}

View File

@ -4,8 +4,9 @@
body {
margin: 0;
padding: 0;
padding: 10px;
min-width: 180px;
width: fit-content;
}
body.with-condition-form {

View File

@ -158,6 +158,7 @@ html(lang='en' ng-app='omegaPopup' ng-controller='PopupCtrl' ng-csp)
ng-click='openOptions("#/general")') {{'popup_configureMonitorWebRequests' | tr}}
script(src='js/log_error.js')
script(src='lib/iframeResizer/iframeResizer.contentWindow.min.js')
script(src='lib/jquery/jquery.min.js')
script(src='lib/angular/angular.min.js')
script(src='lib/angular-bootstrap/ui-bootstrap-tpls.min.js')

View File

@ -17,7 +17,7 @@ html, body {
body {
min-width: 12em;
margin: 5px;
padding: 5px 0;
}
.om-hidden {
@ -33,7 +33,7 @@ body {
.om-nav {
list-style: none;
padding: 0;
margin: 0;
margin: 5px;
}
.om-nav-item {

View File

@ -51,6 +51,7 @@
</a>
</li>
</ul>
<script src="../../lib/iframeResizer/iframeResizer.contentWindow.min.js"></script>
<script src="../../lib/script.js/script.min.js"></script>
<script src="js/loader.js"></script>
</body>

View File

@ -13,7 +13,7 @@
}
function closePopup() {
window.close();
window.top.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);

View File

@ -1,6 +1,6 @@
(function() {
function closePopup() {
window.close();
window.top.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);