Skip to content

Commit

Permalink
1. 修复投喂链接失效的问题
Browse files Browse the repository at this point in the history
2. 增加edge插件地址
3. 实现#35的功能需求
  • Loading branch information
scoful committed Dec 19, 2023
1 parent fb4acc6 commit 25ec87f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
2. 经过4年时间自用,敢保证永不丢失数据,速度超快,可存储数据超多,绝对是效率提升工具!
3. 说说OneTab插件,刚开始使用的童鞋估计都会跟我一样感觉相见恨晚,惊叹怎么那么好用呢!特别是对于那些喜欢开很多tab但是就不想关的童鞋,鼠标一点就所有tab全部关闭并收集到后台管理页了,方便后面慢慢看,简直不要太舒服。但是呢,如果长时间使用,有几率触发bug,所有保存的tab的记录都不见了。找不回来的那种痛!本人经历了至少三次了Orz:sob:!OneTab的数据是存储在浏览器的storage里的,丢了后真的就找不回来了,~~而且OneTab已经好久好久没更新了,作者也联系不上~~,已经有更新了,但还不如不更新,会有同步bug,直接丢失所有数据。痛定思痛,本插件实现了类似OneTab的功能,并且利用了GitHub和Gitee的gist来**实时**远程保存,本地+远程=双保存双保险,妈妈再也不用担心我丢了收集了好久的数据了。那些历史久远的,想等等再看,然后几年都没去看的那些网址:flushed:,一切都有记录在案。甚至可以帮助回忆某年某日做了什么,为什么会打开这些网址!

## 支持多款浏览器
- 谷歌 Chrome 浏览器:[Chrome商店](https://chrome.google.com/webstore/detail/cloudskymonster/niahhcandihcfbamcfhikgojghnnfjan)
- 微软 Edge 浏览器:[Edge商店](https://microsoftedge.microsoft.com/addons/detail/cloudskymonster/hfinincbgekmplkkhnpaodhconghkboh)

## 快速使用

Expand All @@ -28,7 +31,7 @@
- 在任何打开的网页,按快捷键Ctrl+Q,可以**发送所有标签**
- 在任何打开的网页,按快捷键Alt+Q,可以**发送当前标签**
- 如需要定时同步功能,请配置GitHub或Gitee的token,可二选一或全配置
- [详细介绍](README_ALL.md)
- [查看全功能介绍(详细啰嗦版)](README_ALL.md)
- 关于暗黑模式,折腾了一下发现,Chrome浏览器自带的暗黑模式效果就很不错,就没有另外添加了。[暗黑模式开启方法](#暗黑模式开启方法)

## 安装方法
Expand Down
39 changes: 32 additions & 7 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,16 @@ function saveTabGroup(tabGroup) {

// 打开background页
function openBackgroundPage() {
let pinnedTabsCount = 0
// 查询当前窗口的所有标签页
chrome.tabs.query({currentWindow: true}, function (tabs) {
// 统计固定标签的数量
pinnedTabsCount = tabs.filter(tab => tab.pinned).length;
});
chrome.tabs.query({url: "chrome-extension://*/workbench.html*", currentWindow: true}, function (tab) {
if (tab.length >= 1) {
chrome.tabs.move(tab[0].id, {index: 0}, function callback() {
chrome.tabs.highlight({tabs: 0}, function callback() {
chrome.tabs.highlight({tabs: pinnedTabsCount}, function callback() {
});
});
chrome.tabs.reload(tab[0].id, {}, function (tab) {
Expand Down Expand Up @@ -741,7 +747,10 @@ chrome.alarms.onAlarm.addListener(function (alarm) {
// 持续监听是否按了manifest设置的快捷键
chrome.commands.onCommand.addListener(function (command) {
if (command === "toggle-feature-save-all") {
chrome.tabs.query({url: ["https://*/*", "http://*/*"], currentWindow: true}, function (tabsArr) {
chrome.tabs.query({url: ["https://*/*", "http://*/*"], currentWindow: true}, function (tabs) {
var tabsArr = tabs.filter(function (tab) {
return !tab.pinned;
});
saveTabs(tabsArr);
openBackgroundPage();
closeTabs(tabsArr);
Expand All @@ -751,7 +760,10 @@ chrome.commands.onCommand.addListener(function (command) {
chrome.storage.local.get(function (storage) {
chrome.tabs.query({
url: ["https://*/*", "http://*/*"], highlighted: true, currentWindow: true
}, function (tabsArr) {
}, function (tabs) {
var tabsArr = tabs.filter(function (tab) {
return !tab.pinned;
});
let opts = storage.options
let openBackgroundAfterSendTab = "yes"
if (opts) {
Expand Down Expand Up @@ -839,7 +851,10 @@ chrome.contextMenus.onClicked.addListener(function (info, tab) {
chrome.storage.local.get(function (storage) {
chrome.tabs.query({
url: ["https://*/*", "http://*/*"], highlighted: true, currentWindow: true
}, function (tabsArr) {
}, function (tabs) {
var tabsArr = tabs.filter(function (tab) {
return !tab.pinned;
});
let opts = storage.options
let openBackgroundAfterSendTab = "yes"
if (opts) {
Expand All @@ -864,7 +879,10 @@ chrome.contextMenus.onClicked.addListener(function (info, tab) {
openBackgroundPage();
break;
case 'sendAllTabs':
chrome.tabs.query({url: ["https://*/*", "http://*/*"], currentWindow: true}, function (req) {
chrome.tabs.query({url: ["https://*/*", "http://*/*"], currentWindow: true}, function (tabs) {
var req = tabs.filter(function (tab) {
return !tab.pinned;
});
if (req.length > 0) {
saveTabs(req);
openBackgroundPage();
Expand All @@ -883,7 +901,11 @@ chrome.contextMenus.onClicked.addListener(function (info, tab) {
}
chrome.tabs.query({
url: ["https://*/*", "http://*/*"], highlighted: true, currentWindow: true
}, function (req) {
}, function (tabs) {
console.log(tabs)
var req = tabs.filter(function (tab) {
return !tab.pinned;
});
if (req.length > 0) {
saveTabs(req);
if (openBackgroundAfterSendTab === "yes") {
Expand All @@ -899,7 +921,10 @@ chrome.contextMenus.onClicked.addListener(function (info, tab) {
});
break;
case 'sendOtherTabs':
chrome.tabs.query({url: ["https://*/*", "http://*/*"], active: false, currentWindow: true}, function (req) {
chrome.tabs.query({url: ["https://*/*", "http://*/*"], highlighted: false, currentWindow: true}, function (tabs) {
var req = tabs.filter(function (tab) {
return !tab.pinned;
});
if (req.length > 0) {
saveTabs(req);
openBackgroundPage();
Expand Down
2 changes: 1 addition & 1 deletion js/workbench.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-heart"></span> ${chrome.i18n.getMessage("donate")}<span class="caret"></span></a>
<ul id="others" class="dropdown-menu">
<li id="showLog"><img src="https://image.baidu.com/search/down?url=http://ww1.sinaimg.cn/large/692b2078gy1gbslrzhjmfj20gh0ettca.jpg"></li>
<li id="showLog"><img src="http://fc.sinaimg.cn/large/692b2078gy1gbslrzhjmfj20gh0ettca.jpg"></li>
</ul>
</li>
</ul>
Expand Down

0 comments on commit 25ec87f

Please sign in to comment.