Skip to content

Commit 41cd4e2

Browse files
committed
version 0.3.2
1 parent 49379a8 commit 41cd4e2

10 files changed

+70
-59
lines changed

v3/data/window/elements.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2014-2023 InBasic
1+
/* Copyright (C) 2014-2025 InBasic
22
*
33
* This Source Code Form is subject to the terms of the Mozilla Public
44
* License, v. 2.0. If a copy of the MPL was not distributed with this

v3/data/window/external.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2014-2023 InBasic
1+
/* Copyright (C) 2014-2025 InBasic
22
*
33
* This Source Code Form is subject to the terms of the Mozilla Public
44
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -11,9 +11,10 @@
1111
/* global persist, visible, $ */
1212
'use strict';
1313
{
14-
const os = navigator.userAgent.indexOf('Firefox') !== -1 ? 'firefox' : (
15-
navigator.userAgent.indexOf('OPR') === -1 ? (
16-
navigator.userAgent.indexOf('Edg/') === -1 ? 'chrome' : 'edge') : 'opera'
14+
const os = navigator.userAgent.includes('Firefox') ? 'firefox' : (
15+
navigator.userAgent.includes('OPR') ? 'opera' : (
16+
navigator.userAgent.includes('Edg/') ? 'edge' : 'chrome'
17+
)
1718
);
1819
const id = {
1920
chrome: 'bifmfjgpgndemajpeeoiopbeilbaifdo',
File renamed without changes.
File renamed without changes.
File renamed without changes.

v3/data/window/index.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
56
<title>Bulk Media Downloader (active)</title>
6-
<link rel="stylesheet" href="fontello.css">
7+
<link rel="stylesheet" href="fonts/fontello.css">
78
<link rel="stylesheet" href="index.css">
89
</head>
910
<body vbox data-active=true>
@@ -17,14 +18,14 @@
1718
<li>When the intended resource is grabbed, make sure to press the "Pause" button to release network observer and prevent cluttering of this window with new resources.</li>
1819
<li class="chrome">Detection of YouTube resources is locked because of restrictions of the Chrome Store.</li>
1920
<li>To download full-size images, use <a href="https://webextension.org/listing/save-images.html" target="_blank">Download all Images</a> extension.</li>
20-
<li>To convert media files to different formats, use <a href="https://add0n.com/media-converter.html" target="_blank">Media Converter</a> extension.</li>
21+
<li>To convert media files to MP3 format, use <a href="https://webextension.org/listing/mp3-converter.html" target="_blank">MP3 Converter</a> extension.</li>
2122
<li>To download HLS (Live Streams or M3U8), use <a href="https://webextension.org/listing/hls-downloader.html" target="_blank">Live Stream Downloader</a> extension.</li>
2223
</ul>
2324
</details>
2425
</div>
2526
<div hbox pack="center" align="center">
2627
<div id="stats">0/0</div>
27-
<img alt="" src="working.gif">
28+
<img alt="" src="images/working.gif">
2829
</div>
2930
</div>
3031
<div style="display: none;">

v3/data/window/index.js

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2014-2023 InBasic
1+
/* Copyright (C) 2014-2025 InBasic
22
*
33
* This Source Code Form is subject to the terms of the Mozilla Public
44
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -11,8 +11,8 @@
1111
/* globals $, persist */
1212
'use strict';
1313

14-
document.body.dataset.os = navigator.userAgent.indexOf('Firefox') !== -1 ? 'firefox' : (
15-
navigator.userAgent.indexOf('OPR') === -1 ? 'chrome' : 'opera'
14+
document.body.dataset.os = navigator.userAgent.includes('Firefox') ? 'firefox' : (
15+
navigator.userAgent.includes('OPR') ? 'opera' : 'chrome'
1616
);
1717
if (window.location.search) {
1818
document.body.dataset.tabId = window.location.search.replace('?tabId=', '');
@@ -203,15 +203,19 @@ Object.defineProperty(config, 'size', {
203203
}
204204
});
205205

206-
function notify(message) {
207-
chrome.storage.local.get({
206+
async function notify(message) {
207+
const prefs = await chrome.storage.local.get({
208208
notify: true
209-
}, prefs => prefs.notify && chrome.notifications.create(null, {
210-
type: 'basic',
211-
iconUrl: '/data/icons/48.png',
212-
title: 'Bulk Media Downloader',
213-
message
214-
}));
209+
});
210+
if (prefs.notify) {
211+
const id = await chrome.notifications.create({
212+
type: 'basic',
213+
iconUrl: '/data/icons/48.png',
214+
title: 'Bulk Media Downloader',
215+
message
216+
});
217+
setTimeout(chrome.notifications.clear, 3000, id);
218+
}
215219
}
216220
function visible(e) {
217221
return Boolean(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
@@ -449,17 +453,15 @@ chrome.storage.local.get({
449453
});
450454

451455
// resize
452-
window.addEventListener('resize', () => {
456+
addEventListener('resize', () => {
453457
chrome.storage.local.set({
454-
left: window.screenX,
455-
top: window.screenY,
456458
width: Math.max(window.outerWidth, 100),
457459
height: Math.max(window.outerHeight, 100)
458460
});
459461
});
460462

461463
// unload
462-
window.addEventListener('beforeunload', () => {
464+
addEventListener('beforeunload', () => {
463465
monitor.deactivate();
464466
});
465467

v3/data/window/persist.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2014-2023 InBasic
1+
/* Copyright (C) 2014-2025 InBasic
22
*
33
* This Source Code Form is subject to the terms of the Mozilla Public
44
* License, v. 2.0. If a copy of the MPL was not distributed with this

v3/manifest.json

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Bulk Media Downloader",
33
"description": "Grab and download media (image and video) sources by monitoring network (like FlashGot)",
4-
"version": "0.3.1",
4+
"version": "0.3.2",
55
"manifest_version": 3,
66
"permissions": [
77
"storage",
@@ -14,7 +14,8 @@
1414
"*://*/*"
1515
],
1616
"background": {
17-
"service_worker": "worker.js"
17+
"service_worker": "worker.js",
18+
"scripts": ["worker.js"]
1819
},
1920
"action": {},
2021
"homepage_url": "https://webextension.org/listing/bulk-media-downloader.html",
@@ -33,5 +34,11 @@
3334
}],
3435
"commands": {
3536
"_execute_action": {}
37+
},
38+
"browser_specific_settings": {
39+
"gecko": {
40+
"id": "{72b2e02b-3a71-4895-886c-fd12ebe36ba3}",
41+
"strict_min_version": "128.0"
42+
}
3643
}
3744
}

v3/worker.js

+33-33
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2014-2023 InBasic
1+
/* Copyright (C) 2014-2025 InBasic
22
*
33
* This Source Code Form is subject to the terms of the Mozilla Public
44
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -10,37 +10,33 @@
1010

1111
'use strict';
1212

13-
chrome.action.onClicked.addListener(tab => {
14-
chrome.runtime.sendMessage({
13+
chrome.action.onClicked.addListener(async tab => {
14+
const resp = await chrome.runtime.sendMessage({
1515
cmd: 'bring-to-front'
16-
}, async resp => {
17-
chrome.runtime.lastError;
18-
if (resp === true) {
19-
chrome.tabs.sendMessage(tab.id, {
20-
cmd: 'update-id',
21-
id: tab.id
22-
});
23-
}
24-
else {
25-
const win = await chrome.windows.getCurrent();
16+
}).catch(() => {});
2617

27-
chrome.storage.local.get({
28-
width: 800,
29-
height: 600,
30-
left: win.left + Math.round((win.width - 800) / 2),
31-
top: win.top + Math.round((win.height - 600) / 2)
32-
}, prefs => {
33-
chrome.windows.create({
34-
url: 'data/window/index.html?tabId=' + tab.id,
35-
width: prefs.width,
36-
height: prefs.height,
37-
left: prefs.left,
38-
top: prefs.top,
39-
type: 'popup'
40-
});
41-
});
42-
}
43-
});
18+
if (resp === true) {
19+
chrome.tabs.sendMessage(tab.id, {
20+
cmd: 'update-id',
21+
id: tab.id
22+
});
23+
}
24+
else {
25+
const win = await chrome.windows.getCurrent();
26+
27+
const prefs = await chrome.storage.local.get({
28+
width: 800,
29+
height: 600
30+
});
31+
chrome.windows.create({
32+
url: 'data/window/index.html?tabId=' + tab.id,
33+
width: prefs.width,
34+
height: prefs.height,
35+
left: win.left + Math.round((win.width - prefs.width) / 2),
36+
top: win.top + Math.round((win.height - prefs.height) / 2),
37+
type: 'popup'
38+
});
39+
}
4440
});
4541

4642
chrome.runtime.onMessage.addListener((request, sender) => {
@@ -57,6 +53,11 @@ chrome.runtime.onMessage.addListener((request, sender) => {
5753
// Image Downloader (Open modified @belaviyo's image downloader UI [with developer's permission])
5854
{
5955
const once = () => {
56+
if (once.done) {
57+
return;
58+
}
59+
once.done = true;
60+
6061
chrome.contextMenus.create({
6162
title: 'Download all Images',
6263
contexts: ['action'],
@@ -88,8 +89,7 @@ chrome.contextMenus.onClicked.addListener(info => {
8889
{
8990
const {management, runtime: {onInstalled, setUninstallURL, getManifest}, storage, tabs} = chrome;
9091
if (navigator.webdriver !== true) {
91-
const page = getManifest().homepage_url;
92-
const {name, version} = getManifest();
92+
const {homepage_url: page, name, version} = getManifest();
9393
onInstalled.addListener(({reason, previousVersion}) => {
9494
management.getSelf(({installType}) => installType === 'normal' && storage.local.get({
9595
'faqs': true,
@@ -98,7 +98,7 @@ chrome.contextMenus.onClicked.addListener(info => {
9898
if (reason === 'install' || (prefs.faqs && reason === 'update')) {
9999
const doUpdate = (Date.now() - prefs['last-update']) / 1000 / 60 / 60 / 24 > 45;
100100
if (doUpdate && previousVersion !== version) {
101-
tabs.query({active: true, currentWindow: true}, tbs => tabs.create({
101+
tabs.query({active: true, lastFocusedWindow: true}, tbs => tabs.create({
102102
url: page + '?version=' + version + (previousVersion ? '&p=' + previousVersion : '') + '&type=' + reason,
103103
active: reason === 'install',
104104
...(tbs && tbs.length && {index: tbs[0].index + 1})

0 commit comments

Comments
 (0)