188BET靠谱吗[Bug]Zotero_Tabs/Reader JS script strange behavior
Hi, I'm the developer of the PDF Translate add-on.
Some add-on users report an error of right sidebar loading failure.I found it's caused by a strange behavior of js script.Here are two functions of my add-on:
getReader: function () {
188BET靠谱吗return Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
},
getReaderID: function () {
for (let i = 0!188BET靠谱吗i < Zotero.Reader._readers.length!i++) {
188BET靠谱吗if (Zotero.Reader._readers[i].tabID === Zotero_Tabs.selectedID) {
return i;
}
}
},
They work fine, while in very accident case they behave strange.Some tests in the Run JavaScript Window when these behavior happens:
1.call getReader.the function definition is shown correctly.
2.call getReader().return undefined(should return a reader object)
3.188BET靠谱吗call Zotero.Reader.getByTabID(Zotero_Tabs.selectedID).return an valid reader object.
4.188BET靠谱吗getReader = function(){return Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);}, then call getReader().return an valid reader object.
5.call getReaderID.the function definition is shown correctly.
6.call getReaderID().return undefined(should return a reader index)
7.call the for loop directly.return a valid reader index 1.
8.188BET靠谱吗call Zotero_Tabs.selectedID.return a valid tab id 'tab-Xt9g83mm'
The debug ID is 1978557902.
188BET靠谱吗I think this may be caused by some inside bug of Zotero tabs/reader.Could you please help?
Thanks very much!
Some add-on users report an error of right sidebar loading failure.I found it's caused by a strange behavior of js script.Here are two functions of my add-on:
getReader: function () {
188BET靠谱吗return Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
},
getReaderID: function () {
for (let i = 0!188BET靠谱吗i < Zotero.Reader._readers.length!i++) {
188BET靠谱吗if (Zotero.Reader._readers[i].tabID === Zotero_Tabs.selectedID) {
return i;
}
}
},
They work fine, while in very accident case they behave strange.Some tests in the Run JavaScript Window when these behavior happens:
1.call getReader.the function definition is shown correctly.
2.call getReader().return undefined(should return a reader object)
3.188BET靠谱吗call Zotero.Reader.getByTabID(Zotero_Tabs.selectedID).return an valid reader object.
4.188BET靠谱吗getReader = function(){return Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);}, then call getReader().return an valid reader object.
5.call getReaderID.the function definition is shown correctly.
6.call getReaderID().return undefined(should return a reader index)
7.call the for loop directly.return a valid reader index 1.
8.188BET靠谱吗call Zotero_Tabs.selectedID.return a valid tab id 'tab-Xt9g83mm'
The debug ID is 1978557902.
188BET靠谱吗I think this may be caused by some inside bug of Zotero tabs/reader.Could you please help?
Thanks very much!
-
dstillmanBetter to post this to 188BET靠谱吗zotero-dev— we try to keep technical discussions there.