Skip to content

Commit c47ca80

Browse files
committed
show dialog for user confirmation if too many links are to be opened.
1 parent 1b8f414 commit c47ca80

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

src/content_scripts/common/utils.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -899,19 +899,31 @@ function tabOpenLink(str, simultaneousness) {
899899
}).filter(function(u) {
900900
return u.length > 0;
901901
});
902-
// open the first batch links immediately
903-
urls.slice(0, simultaneousness).forEach(function(url) {
904-
RUNTIME("openLink", {
905-
tab: {
906-
tabbed: true
907-
},
908-
url: url
909-
});
910-
});
911-
// queue the left for later opening when there is one tab closed.
902+
912903
if (urls.length > simultaneousness) {
913-
RUNTIME("queueURLs", {
914-
urls: urls.slice(simultaneousness)
904+
dispatchSKEvent("front", ['showDialog', `Do you really want to open all these ${urls.length} links?`, () => {
905+
// open the first batch links immediately
906+
urls.slice(0, simultaneousness).forEach(function(url) {
907+
RUNTIME("openLink", {
908+
tab: {
909+
tabbed: true
910+
},
911+
url: url
912+
});
913+
});
914+
// queue the left for later opening when there is one tab closed.
915+
RUNTIME("queueURLs", {
916+
urls: urls.slice(simultaneousness)
917+
});
918+
}]);
919+
} else {
920+
urls.forEach(function(url) {
921+
RUNTIME("openLink", {
922+
tab: {
923+
tabbed: true
924+
},
925+
url: url
926+
});
915927
});
916928
}
917929
}

0 commit comments

Comments
 (0)