mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 10:47:59 +01:00
[muttator] new FolderLoaded :autocmd
This commit is contained in:
@@ -129,13 +129,16 @@ liberator.Completion = function () //{{{
|
||||
}
|
||||
return longest;
|
||||
},
|
||||
|
||||
// TODO: move "nodes" to {muttator,vimperator}.js
|
||||
autocommands: function (filter)
|
||||
{
|
||||
substrings = [];
|
||||
var nodes = [
|
||||
["BrowserExit", "when firefox exits"],
|
||||
["BrowserRestart", "when firefox restarts"],
|
||||
["PageLoad", "when a page gets (re)loaded/opened"]
|
||||
["PageLoad", "when a page gets (re)loaded/opened"],
|
||||
["FolderLoaded", "when a new folder in Thunderbird is opened"]
|
||||
];
|
||||
|
||||
if (!filter)
|
||||
@@ -147,6 +150,7 @@ liberator.Completion = function () //{{{
|
||||
|
||||
return [0, buildLongestCommonSubstring(mapped, filter)];
|
||||
},
|
||||
|
||||
dialog: function (filter)
|
||||
{
|
||||
substrings = [];
|
||||
@@ -181,7 +185,7 @@ liberator.Completion = function () //{{{
|
||||
searchEngineSuggest: function (filter, engineAliases)
|
||||
{
|
||||
if (!filter)
|
||||
return [0, null];
|
||||
return [0, []];
|
||||
|
||||
var engineList = (engineAliases || liberator.options["suggestengines"]).split(",");
|
||||
var responseType = "application/x-suggestions+json";
|
||||
@@ -202,16 +206,17 @@ liberator.Completion = function () //{{{
|
||||
if (engine && engine.supportsResponseType(responseType))
|
||||
queryURI = engine.getSubmission(query, responseType).uri.asciiSpec;
|
||||
else
|
||||
return;
|
||||
return [0, []];
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", queryURI, false);
|
||||
xhr.send(null);
|
||||
|
||||
var json = Components.classes["@mozilla.org/dom/json;1"].createInstance(Components.interfaces.nsIJSON);
|
||||
var json = Components.classes["@mozilla.org/dom/json;1"]
|
||||
.createInstance(Components.interfaces.nsIJSON);
|
||||
var results = json.decode(xhr.responseText)[1];
|
||||
if (!results)
|
||||
return;
|
||||
return [0, []];
|
||||
|
||||
results.forEach(function (item)
|
||||
{
|
||||
@@ -219,7 +224,7 @@ liberator.Completion = function () //{{{
|
||||
// could return objects which toString() method could be called to
|
||||
// execute untrusted code
|
||||
if (typeof item != "string")
|
||||
return;
|
||||
return [0, []];
|
||||
|
||||
completions.push([(matches ? matches[1] : "") + item, engine.name + " suggestion"]);
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ liberator.Mail = function () //{{{
|
||||
if (folder)
|
||||
{
|
||||
var msgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
dump (msgFolder.prettiestName + " loaded\n");
|
||||
liberator.autocommands.trigger("FolderLoaded", msgFolder);
|
||||
|
||||
// Jump to a message when requested
|
||||
var indices = [];
|
||||
@@ -593,18 +593,7 @@ liberator.Mail = function () //{{{
|
||||
function ()
|
||||
{
|
||||
var want_html = (gPrefBranch.getIntPref("mailnews.display.html_as", 1) == 1);
|
||||
|
||||
gPrefBranch.setBoolPref("mailnews.display.prefer_plaintext", want_html ? false : true);
|
||||
gPrefBranch.setIntPref("mailnews.display.html_as", want_html ? 0 : 1);
|
||||
gPrefBranch.setIntPref("mailnews.display.disallow_mime_handlers", want_html ? 0 : gDisallow_classes_no_html);
|
||||
|
||||
/*MsgBodySanitized() {
|
||||
gPrefBranch.setBoolPref("mailnews.display.prefer_plaintext",
|
||||
false); gPrefBranch.setIntPref("mailnews.display.html_as", 3);
|
||||
gPrefBranch.setIntPref("mailnews.display.disallow_mime_handlers",
|
||||
gDisallow_classes_no_html); MsgReload(); return true; }*/
|
||||
|
||||
MsgReload();
|
||||
liberator.mail.setHTML(want_html ? 1 : 0);
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
@@ -998,6 +987,20 @@ liberator.Mail = function () //{{{
|
||||
liberator.beep();
|
||||
},
|
||||
|
||||
setHTML: function (value)
|
||||
{
|
||||
var values = [[true, 1, gDisallow_classes_no_html], // plaintext
|
||||
[false, 0, 0], // HTML
|
||||
[false, 3, gDisallow_classes_no_html]]; // sanitized/simple HTML
|
||||
|
||||
if (typeof(value) != "number" || value < 0 || value > 2)
|
||||
value = 1;
|
||||
|
||||
gPrefBranch.setBoolPref("mailnews.display.prefer_plaintext", values[value][0]);
|
||||
gPrefBranch.setIntPref("mailnews.display.html_as", values[value][1]);
|
||||
gPrefBranch.setIntPref("mailnews.display.disallow_mime_handlers", values[value][2]);
|
||||
MsgReload();
|
||||
}
|
||||
};
|
||||
|
||||
//}}}
|
||||
|
||||
Reference in New Issue
Block a user