Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options: Associate file picker with input box by id. #91

Open
wants to merge 1 commit into
base: mailextension
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ window.addEventListener("load", function (event) {
}, false);
}, false);

function pick_file(pref, title) {
function pick_file(textboxId, title) {
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, "Select the "+title+" binary", nsIFilePicker.modeOpen);
Expand All @@ -26,7 +26,7 @@ function pick_file(pref, title) {
if( rv != nsIFilePicker.returnOK) {
return;
}
pref.value = fp.file.path;
document.getElementById(textboxId).value = fp.file.path;
});
}

Expand Down
4 changes: 2 additions & 2 deletions content/options.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<hbox align="baseline">
<label control="latex_textbox" value="Path to latex executable:" />
<html:input preference="tblatex.latex_path" id="latex_textbox" />
<button label="Browse..." oncommand="pick_file(document.getElementsByTagName('html:input')[0], 'latex');" />
<button label="Browse..." oncommand="pick_file('latex_textbox', 'latex');" />
</hbox>
<hbox align="baseline">
<label control="dvipng_textbox" value="Path to dvipng executable:" />
<html:input preference="tblatex.dvipng_path" id="dvipng_textbox" />
<button label="Browse..." oncommand="pick_file(document.getElementsByTagName('html:input')[1], 'dvipng');" />
<button label="Browse..." oncommand="pick_file('dvipng_textbox', 'dvipng');" />
</hbox>
<label style="text-decoration: underline; color: navy; cursor: pointer" value="Open the autodetection dialog"
onclick="open_autodetect();" />
Expand Down