Thunderbird Lightning扩展程序显示Week
和Day
视图左侧的时间,如此处所示...
我希望有时间显示2个不同的时区(例如当地时间和太平洋时间),如此处所示......
是否有配置参数来执行此操作?还有其他扩展可以调整吗?如果没有,我如何破解Thunderbird扩展程序来执行此操作?
作为参考,Outlook有functionality。此外,这个answer显示了如何破解Lightning扩展。
答案 0 :(得分:0)
我不知道有任何现有的附加组件可以做到这一点,但我可以告诉你它是如何完成的。首先创建一个典型的骨架Thunderbird扩展,在Firefox世界中这被称为" legacy"如果您正在搜索文档,请进行扩展。它应该包含install.rdf和chrome.manifest。我假设您选择view-zones
作为chrome.manifest中的标识符。
接下来,您需要创建一个允许您覆盖calendar-time-bar
绑定的CSS文件。请注意,使用此方法时,只能有一个扩展名覆盖绑定。内容如下:
calendar-time-bar {
-moz-binding: url(chrome://view-zones/content/bindings.xml#calendar-time-bar) !important;
}
这将覆盖您绑定的时间栏,您将在bindings.xml
文件中创建该时间栏。它扩展了内置时间栏,但在重新布局后添加了一些代码以添加那些额外的标签。需要使用style
指令在chrome.manifest文件中引用CSS文件,并且可以扩展chrome://calendar/skin/calendar-views.css
。然后,您必须为chrome://view-zones/content/bindings.xml
创建xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<bindings id="calendar-multiday-view-bindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="calendar-time-bar"
extends="chrome://calendar/content/calendar-multiday-view.xml#calendar-time-bar">
<implementation>
<method name="relayout">
<body><![CDATA[
this.__proto__.__proto__.relayout.call(this);
let XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
let topbox = document.getAnonymousElementByAttribute(this, "anonid", "topbox");
for (let box of topbox.childNodes) {
let timelabel = box.appendChild(document.createElementNS(XUL_NS, "label"));
timelabel.setAttribute("value", "10:00 PT");
}
]]></body>
</method>
</implementation>
</binding>
</bindings>
我暂时将标签保留为静态,但你可以想到一些逻辑会根据{{3中使用的其他标签或相同算法将"10:00 PT"
更改为实际时间}}。您还可以添加类和样式以使其看起来不同。
那就是说,也许您有兴趣将此功能添加到核心Lightning中?我认为这将是一个很好的补充。我很确定我们有一个错误,但我现在无法找到它,所以如果你感兴趣,也许你可以actual method我可以给你更多关于如何设置好。在这种情况下,需要更改file a bug以显示多个标签并添加用户可见的首选项以便能够选择时区。
答案 1 :(得分:0)
我没有解决一般情况下的问题。我只是让时间显示在当前时区和前一小时显示。在我的情况下,当前时区是美国山区时间,前一个小时最终是美国太平洋时间。
在Thunderbird未运行时,必须编辑以下jar文件中的文件calendar-multiday-view.xml
。
C:\ Users \用户nreynold.ORADEV \应用程序数据\漫游\雷鸟\概况\ 简档 \扩展\ {e2fda1a4-762b-4020-b5ad-a41df1933103} \ chrome.jar
方法makeTimeBox()
必须按照注释所示进行更改:
function makeTimeBox(timestr, time2str, size) { // Add time2str parameter
var box = createXULElement("box");
box.setAttribute("orient", orient);
box.setAttribute("align", "left"); // Add
if (orient == "horizontal") {
box.setAttribute("width", size);
} else {
box.setAttribute("height", size);
}
var label = createXULElement("label");
label.setAttribute("class", "calendar-time-bar-label");
label.setAttribute("value", timestr);
label.setAttribute("style", "color: #4080C0; font-weight: bold;"); // Replace "align"
box.appendChild(label);
var label = createXULElement("label"); // Add
label.setAttribute("class", "calendar-time-bar-label"); // Add
label.setAttribute("value", time2str); // Add
box.appendChild(label); // Add
return box;
}
在makeTimeBox()
之后添加以下方法。
function makeTime(hour) {
var h = hour % 12;
if (h == 0)
h = 12;
var s = hour >= 12 ? " pm" : " am";
var result = h + s;
return result;
}
删除makeTimeBox()
var formatter = Components.classes["@mozilla.org/intl/scriptabledateformat;1"].
getService(Components.interfaces.nsIScriptableDateFormat);
更改以下行...
var timeString;
......待......
var timeString, time2String;
低约25行,替换以下行......
timeString = formatter.FormatTime("",
Components.interfaces.nsIScriptableDateFormat.timeFormatNoSeconds,
theHour, 0, 0);
box = makeTimeBox(timeString, durPix);
......待......
timeString = makeTime(theHour) + " MT";
ptHour = theHour - 1;
ptHour += 23;
ptHour %= 24;
ptHour += 1;
time2String = makeTime(ptHour) + " PT";
box = makeTimeBox(timeString, time2String, durPix);