I want to make some of my sidebar functions available through user
configurable keyboard shortcuts which are available before the sidebar
is open. So at the moment it looks something like this:
...
<overlay id="moji-button"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
...
<keyset id="mainKeyset">
<key id="key_mojiLookupWord" oncommand="contextMenuWordHandler();" />
<key id="key_mojiLookupKanji" oncommand="contextMenuKanjiHandler();" />
</keyset>
...
<script type="application/x-javascript">
var pref =
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
document.getElementById("key_mojiLookupWord").modifiers
= pref.getCharPref("moji.wordShortcutModifiers");
document.getElementById("key_mojiLookupWord").key
= pref.getCharPref("moji.wordShortcut");
document.getElementById("key_mojiLookupKanji").modifiers
= pref.getCharPref("moji.kanjiShortcutModifiers");
document.getElementById("key_mojiLookupKanji").key
= pref.getCharPref("moji.kanjiShortcut");
</script>
</overlay>
However, the DOM does not contain the key elements yet when the script
is running. The getElementById calls return null. Does anyone know how I
can get this working? Is there maybe a way to link attribute values to
preference entries? Or where can I put that script lines so that they
are running after the overlay elements have been inserted in the DOM?
Thx,
Gerald
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners