зеркало из https://github.com/mozilla/pjs.git
Due to popular demand,
Add back the View / Messages as Simple HTML, origianl HTML or plain text options.
This commit is contained in:
Родитель
3e273aface
Коммит
72c36135ff
|
@ -418,6 +418,49 @@ function InitViewHeadersMenu()
|
|||
menuitem.setAttribute("checked", "true");
|
||||
}
|
||||
|
||||
function InitViewBodyMenu()
|
||||
{
|
||||
var html_as = 0;
|
||||
var prefer_plaintext = false;
|
||||
var disallow_classes = 0;
|
||||
try
|
||||
{
|
||||
prefer_plaintext = pref.getBoolPref("mailnews.display.prefer_plaintext");
|
||||
html_as = pref.getIntPref("mailnews.display.html_as");
|
||||
disallow_classes = pref.getIntPref("mailnews.display.disallow_mime_handlers");
|
||||
if (disallow_classes > 0)
|
||||
disallow_classes_no_html = disallow_classes;
|
||||
// else disallow_classes_no_html keeps its inital value (see top)
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
dump("failed to get the body plaintext vs. HTML prefs\n");
|
||||
}
|
||||
|
||||
var AllowHTML_checked = false;
|
||||
var Sanitized_checked = false;
|
||||
var AsPlaintext_checked = false;
|
||||
if (!prefer_plaintext && !html_as && !disallow_classes)
|
||||
AllowHTML_checked = true;
|
||||
else if (!prefer_plaintext && html_as == 3 && disallow_classes > 0)
|
||||
Sanitized_checked = true;
|
||||
else if (prefer_plaintext && html_as == 1 && disallow_classes > 0)
|
||||
AsPlaintext_checked = true;
|
||||
// else (the user edited prefs/user.js) check none of the radio menu items
|
||||
|
||||
var AllowHTML_menuitem = document.getElementById("bodyAllowHTML");
|
||||
var Sanitized_menuitem = document.getElementById("bodySanitized");
|
||||
var AsPlaintext_menuitem = document.getElementById("bodyAsPlaintext");
|
||||
if (AllowHTML_menuitem && Sanitized_menuitem && AsPlaintext_menuitem)
|
||||
{
|
||||
AllowHTML_menuitem.setAttribute("checked", AllowHTML_checked ? "true" : "false");
|
||||
Sanitized_menuitem.setAttribute("checked", Sanitized_checked ? "true" : "false");
|
||||
AsPlaintext_menuitem.setAttribute("checked", AsPlaintext_checked ? "true" : "false");
|
||||
}
|
||||
else
|
||||
dump("Where is my View|Body menu?\n");
|
||||
}
|
||||
|
||||
function IsNewsMessage(messageUri)
|
||||
{
|
||||
return (/^news-message:/.test(messageUri));
|
||||
|
@ -1392,6 +1435,33 @@ function MsgViewBriefHeaders()
|
|||
return true;
|
||||
}
|
||||
|
||||
function MsgBodyAllowHTML()
|
||||
{
|
||||
gPrefs.setBoolPref("mailnews.display.prefer_plaintext", false);
|
||||
gPrefs.setIntPref("mailnews.display.html_as", 0);
|
||||
gPrefs.setIntPref("mailnews.display.disallow_mime_handlers", 0);
|
||||
MsgReload();
|
||||
return true;
|
||||
}
|
||||
|
||||
function MsgBodySanitized()
|
||||
{
|
||||
gPrefs.setBoolPref("mailnews.display.prefer_plaintext", false);
|
||||
gPrefs.setIntPref("mailnews.display.html_as", 3);
|
||||
gPrefs.setIntPref("mailnews.display.disallow_mime_handlers",
|
||||
disallow_classes_no_html);
|
||||
MsgReload();
|
||||
return true;
|
||||
}
|
||||
|
||||
function MsgBodyAsPlaintext()
|
||||
{
|
||||
gPrefs.setBoolPref("mailnews.display.prefer_plaintext", true);
|
||||
gPrefs.setIntPref("mailnews.display.html_as", 1);
|
||||
gPrefs.setIntPref("mailnews.display.disallow_mime_handlers", disallow_classes_no_html);
|
||||
MsgReload();
|
||||
return true;
|
||||
}
|
||||
|
||||
function ToggleInlineAttachment(target)
|
||||
{
|
||||
|
|
|
@ -1168,6 +1168,18 @@
|
|||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="viewBodyMenu" accesskey="&bodyMenu.accesskey;" label="&bodyMenu.label;">
|
||||
<menupopup onpopupshowing="InitViewBodyMenu()">
|
||||
<menuitem id="bodyAllowHTML" type="radio" name="bodyPlaintextVsHTMLPref" label="&bodyAllowHTML.label;"
|
||||
accesskey="&bodyAllowHTML.accesskey;" oncommand="MsgBodyAllowHTML()"/>
|
||||
<menuitem id="bodySanitized" type="radio" name="bodyPlaintextVsHTMLPref" label="&bodySanitized.label;"
|
||||
accesskey="&bodySanitized.accesskey;"
|
||||
oncommand="MsgBodySanitized()"/>
|
||||
<menuitem id="bodyAsPlaintext" type="radio" name="bodyPlaintextVsHTMLPref" label="&bodyAsPlaintext.label;"
|
||||
accesskey="&bodyAsPlaintext.accesskey;" oncommand="MsgBodyAsPlaintext()"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menuitem id="viewAttachmentsInlineMenuitem" label="&viewAttachmentsInlineCmd.label;" accesskey="&viewAttachmentsInlineCmd.accesskey;"
|
||||
oncommand="ToggleInlineAttachment(event.target)" type="checkbox" checked="true"/>
|
||||
<menuseparator/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче