|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!DOCTYPE overlay SYSTEM "chrome://markdown_here/locale/strings.dtd"> |
| 3 | + |
| 4 | +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> |
| 5 | + |
| 6 | +<prefwindow id="markdown-here-options-intermediate" |
| 7 | + title="&moz_options_dlg_title;" |
| 8 | + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
| 9 | + buttons="accept" |
| 10 | + ondialogaccept="openOptionsTab()"> |
| 11 | + |
| 12 | +<script> |
| 13 | +function openOptionsTab() { |
| 14 | + var optionsUrl = 'resource://markdown_here_common/options.html'; |
| 15 | + var windowMediator = Components.classes['@mozilla.org/appshell/window-mediator;1'] |
| 16 | + .getService(Components.interfaces.nsIWindowMediator); |
| 17 | + |
| 18 | + if (navigator.userAgent.indexOf('Thunderbird') >= 0 || |
| 19 | + navigator.userAgent.indexOf('Icedove') >= 0) { |
| 20 | + windowMediator.getMostRecentWindow('mail:3pane') |
| 21 | + .document.getElementById('tabmail') |
| 22 | + .openTab('contentTab', {contentPage: optionsUrl}); |
| 23 | + } |
| 24 | + else if (navigator.userAgent.indexOf('Postbox') >= 0) { |
| 25 | + /* Haven't yet figured out how to open a tab in Postbox */ |
| 26 | + var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] |
| 27 | + .getService(Components.interfaces.nsIPromptService); |
| 28 | + prompts.alert(null, 'Markdown Here', 'Sorry, the options page is not supported for Postbox.'); |
| 29 | + } |
| 30 | + else if (navigator.userAgent.indexOf('Zotero') >= 0) { |
| 31 | + var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] |
| 32 | + .getService(Components.interfaces.nsIPromptService); |
| 33 | + prompts.alert(null, 'Markdown Here', 'Sorry, the options page is not supported for Zotero.'); |
| 34 | + |
| 35 | + /* This code does open the options page in a separate window, |
| 36 | + but the page can't communicate with the background services |
| 37 | + to get and set the options, so it's effectively unsupported. */ |
| 38 | + /* |
| 39 | + var win = windowMediator.getMostRecentWindow('navigator:browser'); |
| 40 | + win.open(optionsUrl, "Markdown-Here-Options"); |
| 41 | + */ |
| 42 | + } |
| 43 | + else { |
| 44 | + var win = windowMediator.getMostRecentWindow('navigator:browser'); |
| 45 | + win.gBrowser.selectedTab = win.gBrowser.addTab(optionsUrl); |
| 46 | + } |
| 47 | +} |
| 48 | +</script> |
| 49 | + |
| 50 | +<prefpane> |
| 51 | + <hbox align="center"> |
| 52 | + <text value="&moz_options_dlg_instruction;" |
| 53 | + style="font-weight:bold"/> |
| 54 | + </hbox> |
| 55 | +</prefpane> |
| 56 | + |
| 57 | +</prefwindow> |
0 commit comments