Scaffold: Add action to open test URL in internal browser (#2117)

This commit is contained in:
Abe Jellinek 2021-07-13 00:33:57 -07:00 committed by GitHub
parent 4db5b4a23f
commit d2db842938
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 6 deletions

View file

@ -1117,14 +1117,26 @@ var Scaffold = new function() {
Zotero.Utilities.Internal.copyTextToClipboard(urlOrData);
}
/*
* Open the url of the first selected test in the browser.
*/
this.openURL = function() {
/**
* Open the url of the first selected test in the browser (Browser tab or
* the system's default browser).
* @param {boolean} openExternally whether to open in the default browser
**/
this.openURL = function (openExternally) {
var listbox = document.getElementById("testing-listbox");
var item = listbox.selectedItems[0];
var url = item.getElementsByTagName("listcell")[0].getAttribute("label");
Zotero.launchURL(url);
if (openExternally) {
Zotero.launchURL(url);
}
else {
var tabs = document.getElementById('tabs');
_browser.loadURIWithFlags(
url,
Components.interfaces.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE
);
tabs.selectedItem = document.getElementById('tab-browser');
}
}
/*