Skip to content

Commit

Permalink
feat: Refine shortcut settings and minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhua committed Aug 11, 2024
1 parent 8e6ec58 commit 9ada993
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ chrome.runtime.sendMessage(`Aria2-Explorer extension ID`, downloadItem)

## 📥 安装地址

[![Chrome Web Store](https://storage.googleapis.com/chrome-gcs-uploader.appspot.com/image/WlD8wC6g8khYWPJUsQceQkhXSlv1/UV4C4ybeBTsZt43U4xis.png)](https://chrome.google.com/webstore/detail/mpkodccbngfoacfalldjimigbofkhgjn "Aria2 Explorer")
[![Chrome Web Store](https://storage.googleapis.com/web-dev-uploads/image/WlD8wC6g8khYWPJUsQceQkhXSlv1/UV4C4ybeBTsZt43U4xis.png)](https://chrome.google.com/webstore/detail/mpkodccbngfoacfalldjimigbofkhgjn "Aria2 Explorer")
[<img src="https://developer.microsoft.com/en-us/store/badges/images/English_get-it-from-MS.png" height=58 >](https://microsoftedge.microsoft.com/addons/detail/jjfgljkjddpcpfapejfkelkbjbehagbh "Aria2 Explorer")

## 💡 常见问题
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ chrome.runtime.sendMessage(`Aria2-Explorer extension ID`, downloadItem)

## 📥 Installation

[![Chrome Web Store](https://storage.googleapis.com/chrome-gcs-uploader.appspot.com/image/WlD8wC6g8khYWPJUsQceQkhXSlv1/UV4C4ybeBTsZt43U4xis.png)](https://chrome.google.com/webstore/detail/mpkodccbngfoacfalldjimigbofkhgjn "Aria2 Explorer")
[![Chrome Web Store](https://storage.googleapis.com/web-dev-uploads/image/WlD8wC6g8khYWPJUsQceQkhXSlv1/UV4C4ybeBTsZt43U4xis.png)](https://chrome.google.com/webstore/detail/mpkodccbngfoacfalldjimigbofkhgjn "Aria2 Explorer")
[<img src="https://developer.microsoft.com/en-us/store/badges/images/English_get-it-from-MS.png" height=58 >](https://microsoftedge.microsoft.com/addons/detail/jjfgljkjddpcpfapejfkelkbjbehagbh "Aria2 Explorer")

## 💡 Tips & FAQs
Expand Down
12 changes: 7 additions & 5 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,7 @@ async function launchUI(info) {
focused: true
});
chrome.tabs.update(tabs[0].id, {
active: true,
url: webUiUrl
active: true
});
return;
}
Expand Down Expand Up @@ -527,7 +526,7 @@ function onMenuClick(info, tab) {
if (info.menuItemId == "MENU_OPEN_WEB_UI") {
launchUI();
} else if (info.menuItemId == "MENU_START_ARIA2") {
const url = chrome.runtime.getURL('aria2.html')
const url = chrome.runtime.getURL('aria2.html');
chrome.tabs.create({ url });
} else if (info.menuItemId == "MENU_CAPTURE_DOWNLOAD") {
chrome.storage.local.set({ integration: info.checked });
Expand Down Expand Up @@ -786,7 +785,10 @@ function registerAllListeners() {
chrome.commands.onCommand.addListener(function (command) {
if (command === "toggle-capture") {
Configs.integration = !Configs.integration;
chrome.storage.local.set({ integration: Configs.integration })
chrome.storage.local.set({ integration: Configs.integration });
} else if (command === "launch-aria2") {
const url = chrome.runtime.getURL('aria2.html');
chrome.tabs.create({ url });
}
});

Expand Down Expand Up @@ -923,7 +925,7 @@ async function notifyTaskStatus(data) {
} else {
contextMessage = dir + Utils.getFileNameFromUrl(files[0].uris[0].uri);
}
if (bittorrent && !(contextMessage.startsWith("[METADATA]") || contextMessage.endsWith(".torrent"))) {
if (message == 'aria2.onDownloadComplete' && bittorrent && !(contextMessage.startsWith("[METADATA]") || contextMessage.endsWith(".torrent"))) {
message = 'aria2.onSeedingComplete';
}
}
Expand Down
36 changes: 19 additions & 17 deletions css/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,31 +125,42 @@ a:hover>.fa-lightbulb,
transform: rotateY(360deg) scale3d(1.2, 1.2, 1);
}

#colorMode {
.clickable {
font-size: 1.5rem;
line-height: 1.5;
padding-inline: 1rem;
margin-right: -3rem;
cursor: pointer;
border-radius: 1.5rem;
text-shadow: 0 0 5px gray;
transition: background-color .3s, box-shadow .3s;
}

#colorMode:hover {
.clickable:hover {
background-color: #fff5;
box-shadow: 0 0 0.3rem #d0d0d0, inset 0 0 2px #eee;
}

#colorMode:active {
.clickable:active {
box-shadow: 0 0 0px #d0d0d0, inset 0 0 0.5rem #acacac;
}

#colorMode .fa {
color:gainsboro;
.clickable .fa {
text-shadow: 0 0 3px gray;
transition: transform .3s, color .48s;
}

.clickable .fa:hover {
text-decoration: none;
transform: rotateY(0deg) scale(1.1);
}

.clickable:active .fa {
transform: rotateY(90deg) scale(1);
}

#colorMode {
padding-inline: 1rem;
margin-right: -3rem;
}

#colorMode .fa-sun {
color: gold;
text-shadow: 0 0 5px #7f6c00;
Expand All @@ -167,15 +178,6 @@ a:hover>.fa-lightbulb,
text-shadow: 0 0 5px #003d7e;
}

#colorMode .fa:hover {
text-decoration: none;
transform: rotateY(0deg) scale(1.1);
}

#colorMode:active .fa {
transform: rotateY(90deg) scale(1);
}

#copyright {
line-height: 30px;
}
Expand Down
19 changes: 19 additions & 0 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { DefaultConfigs, DefaultAriaNgOptions } from "./config.js";

const AriaNgOptionsKey = "AriaNg.Options"; // AriaNG options local storage key

const SHORTCUTS_PAGE_URL = "chrome://extensions/shortcuts";

const ColorModeList = [
{ name: 'light', icon: 'fa-sun', title: 'LightMode' },
{ name: 'dark', icon: 'fa-moon', title: 'DarkMode' },
Expand Down Expand Up @@ -131,6 +133,23 @@ var Configs =
}
}

$("#shortcuts-setting").off().on("click", function () {
chrome.tabs.query({ "url": SHORTCUTS_PAGE_URL }).then(function (tabs) {
if (tabs?.length > 0) {
chrome.windows.update(tabs[0].windowId, {
focused: true
});
chrome.tabs.update(tabs[0].id, {
active: true
});
} else {
chrome.tabs.create({
url: SHORTCUTS_PAGE_URL
});
}
});
});

$("#add-rpc").off().on("click", function () {
let i = $(".rpcGroup").length;
let newInput = rpcInputGroup(i).replace("password", "text");
Expand Down
8 changes: 7 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "A2E",
"version": "2.5.1",
"version": "2.5.2",
"manifest_version": 3,
"minimum_chrome_version": "100.0.0",
"default_locale": "en",
Expand Down Expand Up @@ -45,6 +45,12 @@
"default": "Alt+A"
},
"description": "__MSG_toggleCapture__"
},
"launch-aria2": {
"suggested_key": {
"default": "Alt+X"
},
"description": "__MSG_startAria2Str__"
}
},
"externally_connectable": {
Expand Down
22 changes: 15 additions & 7 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<label class="col-sm-2 text-info"><i class="fa-solid fa-download"></i>
__MSG_downloadCaptureStr__</label>
<div class="col-sm-10">
<div class="input-group custom-control-inline custom-switch tool-tip tool-tip-icon" tooltip-content="⌨: Alt + A">
<div class="input-group custom-control-inline custom-switch">
<input class="custom-control-input" type="checkbox" id="integration">
<label class="custom-control-label" for="integration">
__MSG_downloadCaptureDes__
Expand All @@ -56,6 +56,9 @@
<div class="input-group-append">
<span class="input-group-text form-control-sm">MB</span>
</div>
<div id="shortcuts-setting" class="clickable tool-tip" tooltip-content="⌨: Alt + A">
<i class="fa fa-gear mx-3 text-primary"></i>
</div>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="askBeforeDownload">
Expand Down Expand Up @@ -87,7 +90,8 @@
__MSG_monitorAria2Des__
</label>
</div>
<div id="monitor-all" class="custom-control custom-switch tool-tip tool-tip-icon" tooltip-content="__MSG_monitorAllTip__">
<div id="monitor-all" class="custom-control custom-switch tool-tip tool-tip-icon"
tooltip-content="__MSG_monitorAllTip__">
<input class="custom-control-input" type="checkbox" id="monitorAll">
<label class="custom-control-label" for="monitorAll">
__MSG_monitorAllDes__
Expand Down Expand Up @@ -176,9 +180,11 @@
<label class="col-sm-2 text-info"><i class="fa-solid fa-rotate"></i>
__MSG_configCloudSync__</label>
<div class="col-sm-auto">
<button type="button" class="btn btn-primary mx-1 tool-tip" id="upload" tooltip-content="⌨: Alt + U"><i class="fa-solid fa-cloud-arrow-up"></i>
<button type="button" class="btn btn-primary mx-1 tool-tip" id="upload" tooltip-content="⌨: Alt + U"><i
class="fa-solid fa-cloud-arrow-up"></i>
__MSG_upload__</button>
<button type="button" class="btn btn-primary mx-1 tool-tip" id="download" tooltip-content="⌨: Alt + J"><i class="fa-solid fa-cloud-arrow-down"></i>
<button type="button" class="btn btn-primary mx-1 tool-tip" id="download" tooltip-content="⌨: Alt + J"><i
class="fa-solid fa-cloud-arrow-down"></i>
__MSG_download__</button>
<em>(__MSG_configCloudSyncDes__)</em>
<span class="alert" id="sync-result"></span>
Expand All @@ -188,7 +194,7 @@

<footer class="footer">
<div class="footer-content">
<a id="colorMode" title="__MSG_ColorMode__"><i class="fa"></i></a>
<div id="colorMode" class="clickable" title="__MSG_ColorMode__"><i class="fa"></i></div>
<div class="container footer-content">
<span id="copyright">
<a target="_blank" href="https://www.aria2e.com">
Expand All @@ -198,9 +204,11 @@
</span>

<span class="text-center">
<button type="submit" class="btn btn-success mr-5 tool-tip" id="save" tooltip-content="⌨: Alt + S"><i class="fa-regular fa-circle-check"></i>
<button type="submit" class="btn btn-success mr-5 tool-tip" id="save" tooltip-content="⌨: Alt + S"><i
class="fa-regular fa-circle-check"></i>
__MSG_Save__</button>
<button type="reset" class="btn btn-warning mx-5 tool-tip" id="reset" tooltip-content="⌨: Alt + R"><i class="fa-regular fa-circle-xmark"></i>
<button type="reset" class="btn btn-warning mx-5 tool-tip" id="reset" tooltip-content="⌨: Alt + R"><i
class="fa-regular fa-circle-xmark"></i>
__MSG_Reset__</button>
</span>

Expand Down

0 comments on commit 9ada993

Please sign in to comment.