Scaffold: Add action to open test URL in internal browser (#2117)
This commit is contained in:
parent
4db5b4a23f
commit
d2db842938
3 changed files with 25 additions and 6 deletions
|
@ -1117,15 +1117,27 @@ var Scaffold = new function() {
|
||||||
Zotero.Utilities.Internal.copyTextToClipboard(urlOrData);
|
Zotero.Utilities.Internal.copyTextToClipboard(urlOrData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Open the url of the first selected test in the browser.
|
* Open the url of the first selected test in the browser (Browser tab or
|
||||||
*/
|
* the system's default browser).
|
||||||
this.openURL = function() {
|
* @param {boolean} openExternally whether to open in the default browser
|
||||||
|
**/
|
||||||
|
this.openURL = function (openExternally) {
|
||||||
var listbox = document.getElementById("testing-listbox");
|
var listbox = document.getElementById("testing-listbox");
|
||||||
var item = listbox.selectedItems[0];
|
var item = listbox.selectedItems[0];
|
||||||
var url = item.getElementsByTagName("listcell")[0].getAttribute("label");
|
var url = item.getElementsByTagName("listcell")[0].getAttribute("label");
|
||||||
|
if (openExternally) {
|
||||||
Zotero.launchURL(url);
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run selected test(s)
|
* Run selected test(s)
|
||||||
|
|
|
@ -52,7 +52,12 @@
|
||||||
<menupopup id="testing-context-menue">
|
<menupopup id="testing-context-menue">
|
||||||
<menuitem label="&scaffold.testing.edit.import;" tooltiptext="Edit the input data for the current test" oncommand="Scaffold.editImportFromTest()"/>
|
<menuitem label="&scaffold.testing.edit.import;" tooltiptext="Edit the input data for the current test" oncommand="Scaffold.editImportFromTest()"/>
|
||||||
<menuitem label="&scaffold.testing.copyToClipboard;" tooltiptext="Copy the URL or data for the current test to the clipboard" oncommand="Scaffold.copyToClipboard()"/>
|
<menuitem label="&scaffold.testing.copyToClipboard;" tooltiptext="Copy the URL or data for the current test to the clipboard" oncommand="Scaffold.copyToClipboard()"/>
|
||||||
<menuitem label="&scaffold.testing.openUrl;" tooltiptext="Open the URL for the current test in the browser" oncommand="Scaffold.openURL()"/>
|
<menu label="&scaffold.testing.openUrl;">
|
||||||
|
<menupopup>
|
||||||
|
<menuitem label="&scaffold.testing.openUrl.internally;" tooltiptext="Open the URL for the current test in the Scaffold browser" oncommand="Scaffold.openURL(false)"/>
|
||||||
|
<menuitem label="&scaffold.testing.openUrl.externally;" tooltiptext="Open the URL for the current test in your default browser" oncommand="Scaffold.openURL(true)"/>
|
||||||
|
</menupopup>
|
||||||
|
</menu>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</popupset>
|
</popupset>
|
||||||
|
|
||||||
|
|
|
@ -74,3 +74,5 @@
|
||||||
<!ENTITY scaffold.testing.edit.import "Edit Import">
|
<!ENTITY scaffold.testing.edit.import "Edit Import">
|
||||||
<!ENTITY scaffold.testing.copyToClipboard "Copy to Clipboard">
|
<!ENTITY scaffold.testing.copyToClipboard "Copy to Clipboard">
|
||||||
<!ENTITY scaffold.testing.openUrl "Open URL">
|
<!ENTITY scaffold.testing.openUrl "Open URL">
|
||||||
|
<!ENTITY scaffold.testing.openUrl.internally "In Browser Tab">
|
||||||
|
<!ENTITY scaffold.testing.openUrl.externally "In External Browser">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue