To try the thousands of add-ons available here, download Mozilla Firefox, a fast, free way to surf the Web!
ĐóngChào mừng đến với tiện ích Firefox.
Choose from thousands of extra features and styles to make Firefox your own.
Đóngpiviul
Giới thiệu về tôi
Tên | piviul |
---|---|
Người dùng kể từ | Tháng 2. 12, 2010 |
Số tiện ích được phát triển | 0 add-ons |
Đánh giá trung bình của các tiện ích của nhà phát triển | Chưa được xếp hạng |
Đánh giá Của tôi
Message Archive Options
Rated 5 out of 5 stars
Hi, the last 15th february I've send the patched overlay.js to eviljeff hoping in a fast update of the add-on. Because there are other interested in the patch I write the new overlay.js here:
--- begin overlay.js
var messagearchiveoptions = {
preferenceService: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.messagearchiveoptions@eviljeff.com."),
get monthValue() {return this.preferenceService.getComplexValue("monthstring",Components.interfaces.nsISupportsString).toString();},
get yearValue() {return this.preferenceService.getComplexValue("yearstring", Components.interfaces.nsISupportsString).toString();},
get keyModifiers() {
var modifiers=new Array();
if (this.preferenceService.getBoolPref("key.shift")) modifiers.push("shift");
if (this.preferenceService.getBoolPref("key.alt")) modifiers.push("alt");
if (this.preferenceService.getBoolPref("key.control")) modifiers.push("accel");
return modifiers;
},
onLoad: function() {
BatchMessageMover.prototype.archiveSelectedMessages = function() {
gFolderDisplay.hintMassMoveStarting();
var selectedMessages = gFolderDisplay.selectedMessages;
if (!selectedMessages.length) {
return;
}
var messages = Components.classes['@mozilla.org/array;1'].createInstance(Components.interfaces.nsIMutableArray);
for (let i = 0; i < selectedMessages.length; ++i) {
let msgHdr = selectedMessages[i];
let server = msgHdr.folder.server;
let rootFolder = server.rootFolder;
let msgDate = new Date(msgHdr.date / 1000);
let fullPath = String(msgHdr.folder.URI).replace(server.serverURI, "").substring(1);
let rootPath = fullPath.substring(0, fullPath.indexOf('/', 1));
if (rootPath.length == 0) rootPath=fullPath;
let yearValue = messagearchiveoptions.yearValue.replace('%F', fullPath);
yearValue = yearValue.replace('%f', rootPath);
let msgYear = msgDate.toLocaleFormat(yearValue);
let monthValue = messagearchiveoptions.monthValue.replace('%F', fullPath);
monthValue = monthValue.replace('%f', rootPath);
let monthFolderName = msgDate.toLocaleFormat(monthValue);
let archiveFolderUri;
if (server.type == "rss") {
archiveFolderUri = server.serverURI + "/Archives";
} else {
let identity = getIdentityForServer(server);
if (!identity) {
identity = getIdentityForHeader(msgHdr);
}
archiveFolderUri = identity.archiveFolder;
}
let archiveFolder = GetMsgFolderFromUri(archiveFolderUri, false);
let granularity = archiveFolder.server.archiveGranularity;
let copyBatchKey = msgHdr.folder.URI + "\0";
if (granularity >= Components.interfaces.nsIMsgIncomingServer.perYearArchiveFolders) {
copyBatchKey += msgYear;
}
if (granularity >= Components.interfaces.nsIMsgIncomingServer.perMonthArchiveFolders) {
copyBatchKey += monthFolderName;
}
if (!(copyBatchKey in this._batches)) {
this._batches[copyBatchKey] = [msgHdr.folder, archiveFolderUri, granularity, msgYear, monthFolderName];
}
this._batches[copyBatchKey].push(msgHdr);
}
this.processNextBatch();
}
document.getElementById("key_archive").setAttribute("modifiers",this.keyModifiers.join(", "));
},
observe:function(subject ,topic , data) {
if (topic!="nsPref:changed") return;
document.getElementById("key_archive").setAttribute("modifiers",this.keyModifiers.join(", "));
}
};
window.addEventListener("load", function(e) { messagearchiveoptions.onLoad(e); }, false);
messagearchiveoptions.preferenceService.QueryInterface(Components.interfaces.nsIPrefBranch2).addObserver("key", messagearchiveoptions, false);
--- end
I've removed the license block so please don't delete it from the original overlay.js!
Have a grat day
Piviul
Message Archive Options
Rated 4 out of 5 stars
We have done some little changes to overlay.js to have folder structure (root only or full structure) support permitting new %f (root structure) or %F (full structure) in the year and month options as asked from andras.tim, BlackForst and Illtud Daniel. This is de diff:
38,48c38,48
< preferenceService: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.messagearchiveoptions@eviljeff.com."),
<
< get monthValue() {return this.preferenceService.getComplexValue("monthstring",Components.interfaces.nsISupportsString).toString();},
< get yearValue() {return this.preferenceService.getComplexValue("yearstring", Components.interfaces.nsISupportsString).toString();},
< get keyModifiers() {
< var modifiers=new Array();
< if (this.preferenceService.getBoolPref("key.shift")) modifiers.push("shift");
< if (this.preferenceService.getBoolPref("key.alt")) modifiers.push("alt");
< if (this.preferenceService.getBoolPref("key.control")) modifiers.push("accel");
< return modifiers;
< },
---
> preferenceService: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.messagearchiveoptions@eviljeff.com."),
>
> get monthValue() {return this.preferenceService.getComplexValue("monthstring",Components.interfaces.nsISupportsString).toString();},
> get yearValue() {return this.preferenceService.getComplexValue("yearstring", Components.interfaces.nsISupportsString).toString();},
> get keyModifiers() {
> var modifiers=new Array();
> if (this.preferenceService.getBoolPref("key.shift")) modifiers.push("shift");
> if (this.preferenceService.getBoolPref("key.alt")) modifiers.push("alt");
> if (this.preferenceService.getBoolPref("key.control")) modifiers.push("accel");
> return modifiers;
> },
50,55c50,98
< var origfunc=BatchMessageMover.prototype.archiveSelectedMessages.toSource();
< origfunc=origfunc.replace('msgDate.toLocaleFormat("%Y-%m")','msgDate.toLocaleFormat(messagearchiveoptions.monthValue)');
< origfunc=origfunc.replace('msgDate.getFullYear().toString()','msgDate.toLocaleFormat(messagearchiveoptions.yearValue)');
< eval("BatchMessageMover.prototype.archiveSelectedMessages = "+origfunc);
< //BatchMessageMover.prototype.archiveSelectedMessages = this.archiveSelectedMessages;
<
---
> BatchMessageMover.prototype.archiveSelectedMessages = function() {
> gFolderDisplay.hintMassMoveStarting();
> var selectedMessages = gFolderDisplay.selectedMessages;
> if (!selectedMessages.length) {
> return;
> }
> var messages = Components.classes['@mozilla.org/array;1'].createInstance(Components.interfaces.nsIMutableArray);
> for (let i = 0; i < selectedMessages.length; ++i) {
> let msgHdr = selectedMessages[i];
> let server = msgHdr.folder.server;
> let rootFolder = server.rootFolder;
> let msgDate = new Date(msgHdr.date / 1000);
> //let msgYear = msgDate.toLocaleFormat(messagearchiveoptions.yearValue);
> //let monthFolderName = msgDate.toLocaleFormat(messagearchiveoptions.monthValue);
> let fullPath = String(msgHdr.folder.URI).replace(server.serverURI, "").substring(1);
> let rootPath = fullPath.substring(0, fullPath.indexOf('/', 1));
> if (rootPath.length == 0) rootPath=fullPath;
> let yearValue = messagearchiveoptions.yearValue.replace('%F', fullPath);
> yearValue = yearValue.replace('%f', rootPath);
> let msgYear = msgDate.toLocaleFormat(yearValue);
> let monthValue = messagearchiveoptions.monthValue.replace('%F', fullPath);
> monthValue = monthValue.replace('%f', rootPath);
> let monthFolderName = msgDate.toLocaleFormat(monthValue);
> let archiveFolderUri;
> if (server.type == "rss") {
> archiveFolderUri = server.serverURI + "/Archives";
> } else {
> let identity = getIdentityForServer(server);
> if (!identity) {
> identity = getIdentityForHeader(msgHdr);
> }
> archiveFolderUri = identity.archiveFolder;
> }
> let archiveFolder = GetMsgFolderFromUri(archiveFolderUri, false);
> let granularity = archiveFolder.server.archiveGranularity;
> let copyBatchKey = msgHdr.folder.URI + "\0";
> if (granularity >= Components.interfaces.nsIMsgIncomingServer.perYearArchiveFolders) {
> copyBatchKey += msgYear;
> }
> if (granularity >= Components.interfaces.nsIMsgIncomingServer.perMonthArchiveFolders) {
> copyBatchKey += monthFolderName;
> }
> if (!(copyBatchKey in this._batches)) {
> this._batches[copyBatchKey] = [msgHdr.folder, archiveFolderUri, granularity, msgYear, monthFolderName];
> }
> this._batches[copyBatchKey].push(msgHdr);
> }
> this.processNextBatch();
> }
Piviul
Để tạo ra bộ sưu tập của riêng mình, bạn phải có một tài khoản trên Tiện ích Mozilla.