зеркало из https://github.com/mozilla/pjs.git
Listener code for the onload event. r=hyatt, a=bobj bug #28108.
This commit is contained in:
Родитель
de5295e2e4
Коммит
5e6f2e6306
|
@ -44,20 +44,9 @@ function SelectDetector(event)
|
|||
|
||||
function UpdateCurrentCharset()
|
||||
{
|
||||
menu = Components.classes['component://netscape/rdf/datasource?name=charset-menu'];
|
||||
|
||||
if (menu) {
|
||||
menu = menu.getService();
|
||||
menu = menu.QueryInterface(Components.interfaces.nsICurrentCharsetListener);
|
||||
}
|
||||
|
||||
charset = document.commandDispatcher.focusedWindow.content.document.characterSet;
|
||||
charset = document.commandDispatcher.focusedWindow.document.characterSet;
|
||||
charset = charset.toLowerCase();
|
||||
|
||||
if (menu) {
|
||||
menu.SetCurrentCharset(charset);
|
||||
}
|
||||
|
||||
menuitem = document.getElementById('charset.' + charset);
|
||||
|
||||
if (menuitem) {
|
||||
|
@ -91,3 +80,27 @@ function UpdateMenus(event)
|
|||
UpdateCurrentCharset();
|
||||
UpdateCharsetDetector();
|
||||
}
|
||||
|
||||
function charsetLoadListener (event)
|
||||
{
|
||||
menu = Components.classes['component://netscape/rdf/datasource?name=charset-menu'];
|
||||
|
||||
if (menu) {
|
||||
menu = menu.getService();
|
||||
menu = menu.QueryInterface(Components.interfaces.nsICurrentCharsetListener);
|
||||
}
|
||||
|
||||
charset = window.content.document.characterSet;
|
||||
charset = charset.toLowerCase();
|
||||
|
||||
if (menu) {
|
||||
menu.SetCurrentCharset(charset);
|
||||
}
|
||||
|
||||
// XXX you know, here I could also set the checkmark, for the case when a
|
||||
// doc finishes loading after the menu is already diplayed. But I get a
|
||||
// weird assertion!
|
||||
}
|
||||
|
||||
contentArea = window.document.getElementById("appcontent")
|
||||
contentArea.addEventListener("load", charsetLoadListener, true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче