Does FG accept multiple links?!
Code: Select all
gFlashGot.download(element.querySelectorAll('a')); // NodeList
gFlashGot.download(element.getElementsByTagName('a')); // HTMLCollection
When I send 1 node, it works fine.
Code: Select all
NodeList {0: HTMLAnchorElement, length: 1}
HTMLCollection {0: HTMLAnchorElement, length: 1}
If I send more than 1 node, nothing happens.
Code: Select all
NodeList {0: HTMLAnchorElement, 1: HTMLAnchorElement, length: 2} browserOverlay.js:171
HTMLCollection {0: HTMLAnchorElement, 1: HTMLAnchorElement, length: 2}
Is it possible to send multiple links? how?
Update: I tried sending an array of object, each object with one href property.. but again FG did not accept it
I also get a flashgot progress bar on my addon bar!! which seems to be stuck
Update: I had to send each link separately inside an array to make it work. I feel that FG hugs when multiple links are set. Out of curiosity, which part of the FG code deals with gFlashGot.download()? I am curios to have a closer look at it.
Code: Select all
for (let i = 0, len = elem.length; i < len; i++) {
gFlashGot.download([elem[i]]);
}
After looking at FG code, I even tried gFlashGot.download(array, 1, ''); and 2 and 3 as the 2nd value
The progress bar hangs ...
Sometimes there are errors logged in console
Code: Select all
[FlashGot Redirect Processor] uploaded_to: TypeError: this.links.some is not a function RedirectContext.prototype.change@chrome://flashgot/content/RedirectContext.js:123
uploaded_to@chrome://flashgot/content/RedirectContext.js:1006
RedirectContext.prototype.processLink@chrome://flashgot/content/RedirectContext.js:64
RedirectContext.prototype.process@chrome://flashgot/content/RedirectContext.js:49
Please note that all this happens if the array sent contains more than 1 object.
After looking at FG code... it seems ....
Code: Select all
download: function(links, opType, dmName) {
switch (links.length) {
case 0:
return false;
case 1:
opType = this.OP_ONE;
break;
default:
if (!opType) opType = this.OP_SEL;
}
....
If links.length === 0 it will end the execution of the function
If links.length === 1 it will set opType = this.OP_ONE
What happens if links.length > 1 ??
default set opType = this.OP_SEL only if parameter2 is not sent
As a test, I tried...
Code: Select all
gFlashGot.download([lnks], gFlashGotService.OP_ALL, null);
gFlashGot.download([lnks], gFlashGotService.OP_QET, null);
gFlashGot.download([lnks], 2, null);
gFlashGot.download([lnks], 3, null);
Therefore..... if links.length > 1 and !opType ... that is where we get the errors from RedirectContext.js
Please note that the same links works find if activated via FlashGot Selection contextMenu/keyboard shortcut
Something is missing from processing gFlashGot.download(lnks);
Looking forward to your comments
Regards