Skip to content

Commit

Permalink
feat: Add an option to disable Download Panel for the context menu do…
Browse files Browse the repository at this point in the history
…wnloads.

closes #7
  • Loading branch information
RossWang committed Nov 19, 2017
1 parent 7226fc7 commit b4e6a40
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 12 deletions.
15 changes: 10 additions & 5 deletions App/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@
"description": ""
},

"OP_secure": {
"message": "Secure",
"description": ""
},

"OPN_protocol": {
"message": "RPC connection protocol of Aria2.",
"description": ""
Expand Down Expand Up @@ -315,6 +310,16 @@
"description": ""
},

"OP_cmDownPanel": {
"message": "Display Download Panel",
"description": ""
},

"OPN_cmDownPanel": {
"message": "Whether to display a download panel for the download event trigger from the context menu",
"description": ""
},

"OP_winWidth": {
"message": "Download Panel width offset",
"description": ""
Expand Down
15 changes: 10 additions & 5 deletions App/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@
"description": ""
},

"OP_secure": {
"message": "安全",
"description": ""
},

"OPN_protocol": {
"message": "Aria2的RPC通讯协议。",
"description": ""
Expand Down Expand Up @@ -314,6 +309,16 @@
"message": "在图标上显示目前正在下载的数量",
"description": ""
},

"OP_cmDownPanel": {
"message": "显示下载视窗",
"description": ""
},

"OPN_cmDownPanel": {
"message": "从右键选单启动的下载是否要下载视窗",
"description": ""
},

"OP_winWidth": {
"message": "下载窗口宽度改变量",
Expand Down
10 changes: 10 additions & 0 deletions App/_locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,16 @@
"message": "在圖標上顯示目前正在下載的數量",
"description": ""
},

"OP_cmDownPanel": {
"message": "顯示下載視窗",
"description": ""
},

"OPN_cmDownPanel": {
"message": "從右鍵選單啟動的下載是否要下載視窗",
"description": ""
},

"OP_winWidth": {
"message": "下載視窗寬度改變量",
Expand Down
20 changes: 18 additions & 2 deletions App/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,16 @@ function cmCallback (info, tab) {
fileSize: "",
requestHeaders: requestHeaders
}
browser.storage.local.get(config.command.guess, item => {
if (item.cmDownPanel) {
downloadPanel(d);
}
else {
sendTo(url,"","",requestHeaders);
}
});
//sendTo(url,"","",requestHeaders);
downloadPanel(d);
//downloadPanel(d);
console.log(info);
}, (e) => {
console.log("Error", e);
Expand All @@ -638,8 +646,16 @@ function cmCallback (info, tab) {
fileSize: "",
requestHeaders: requestHeaders
}
browser.storage.local.get(config.command.guess, item => {
if (item.cmDownPanel) {
downloadPanel(d);
}
else {
sendTo(url,"","",requestHeaders);
}
});
//sendTo(url,"","",requestHeaders);
downloadPanel(d);
//downloadPanel(d);
console.log(info);
} );;
}
Expand Down
1 change: 1 addition & 0 deletions App/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ config.command = {
autoSet: true,
chgLog: true,
badge: true,
cmDownPanel: true,
};
}
};
11 changes: 11 additions & 0 deletions App/data/options/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@
<td></td>
<td data-message="OPN_badge" class="note">Display current active download count on top of the icon</td>
</tr>
<tr>
<td></td>
<td>
<input id="cmDownPanel" style="margin-left: 0px; margin-top: 5px;" type="checkbox">
<label data-message="OP_cmDownPanel" for="cmDownPanel">Display Download Panel</label>
</td>
</tr>
<tr>
<td></td>
<td data-message="OPN_cmDownPanel" class="note">Whether to display a download panel for the download event trigger from the context menu</td>
</tr>
<tr>
<td></td>
<td>
Expand Down
3 changes: 3 additions & 0 deletions App/data/options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function save() {
const autoSet = document.getElementById('autoSet').checked;
const chgLog = document.getElementById('chgLog').checked;
const badge = document.getElementById('badge').checked;
const cmDownPanel = document.getElementById('cmDownPanel').checked;
const dpHeight = document.getElementById('dpHeight').value;
const dpWidth = document.getElementById('dpWidth').value;
if (!windowLoc){
Expand Down Expand Up @@ -55,6 +56,7 @@ function save() {
autoSet,
chgLog,
badge,
cmDownPanel,
dpHeight,
dpWidth
}, () => {
Expand Down Expand Up @@ -97,6 +99,7 @@ function restore() {
document.getElementById('autoSet').checked = prefs.autoSet;
document.getElementById('chgLog').checked = prefs.chgLog;
document.getElementById('badge').checked = prefs.badge;
document.getElementById('cmDownPanel').checked = prefs.cmDownPanel;
});
browser.storage.local.get(['dpWidth', 'dpHeight'], prefs => {
document.getElementById('dpWidth').value = prefs.dpWidth;
Expand Down

0 comments on commit b4e6a40

Please sign in to comment.