/firefox/latrus/trunk/TODO |
---|
1,9 → 1,5 |
* address bar, search bar etc |
* switch on key |
* click on panel |
* settings (convert table, default state etc) |
* enabled per tab |
* test with multiple windows |
* convert selected text in both directions |
* standard char map |
* window with currect charmap, clickable |
/firefox/latrus/trunk/src/chrome/content/latrus.js |
---|
33,16 → 33,15 |
} |
var latRusWorker = null; |
var latRusEnabled = false; |
var LatRus = { |
init: function() |
{ |
latRusWorker = new Worker(); |
gBrowser.addProgressListener(LatRusWebProgressListener, |
Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT); |
latRusWorker = new Worker(); |
LatRus.setEnabled(latRusEnabled); // update menu and panel |
gBrowser.tabContainer.addEventListener("TabSelect", LatRus.onTabSelect, false); |
}, |
uninit: function() |
50,9 → 49,18 |
gBrowser.removeProgressListener(LatRusWebProgressListener); |
}, |
onTabSelect: function(aEvent) |
{ |
if(aEvent.target.linkedBrowser.latRusEnabled == undefined) { |
aEvent.target.linkedBrowser.latRusEnabled = false; // the default value |
} |
LatRus.updateEnabled(); |
}, |
onKeyPress: function(aEvent) |
{ |
if(!latRusEnabled) return; |
if(!gBrowser.selectedBrowser.latRusEnabled) return; |
if(aEvent.ctrlKey || aEvent.altKey || aEvent.charCode == 0) return true; |
if(aEvent.keyCode == 255) return; // our loop event |
65,23 → 73,32 |
toggleEnabled: function() |
{ |
LatRus.setEnabled(!latRusEnabled); |
LatRus.setEnabled(!gBrowser.selectedBrowser.latRusEnabled); |
}, |
setEnabled: function(enabled) |
{ |
latRusEnabled = enabled; |
gBrowser.selectedBrowser.latRusEnabled = enabled; |
LatRus.updateEnabled(); |
}, |
updateEnabled: function() |
{ |
var item = document.getElementById("context-latrus-enabled"); |
if(item) { |
item.setAttribute("checked", latRusEnabled); |
item.setAttribute("checked", gBrowser.selectedBrowser.latRusEnabled); |
} |
var panel = document.getElementById("latrus-panel"); |
if(panel) { |
panel.label = (latRusEnabled ? "RUS" : "LAT"); |
panel.label = (gBrowser.selectedBrowser.latRusEnabled ? "RUS" : "LAT"); |
} |
}, |
showOptions: function() |
{ |
alert("latrus options"); |
}, |
}; |
window.addEventListener('load', LatRus.init, false); |
/firefox/latrus/trunk/src/chrome/content/latrus.xul |
---|
5,16 → 5,36 |
<script type="application/x-javascript" src="chrome://latrus/content/latrus.js" /> |
<window id="main-window"> |
<commandset id="latrus-commandset"> |
<command id="latrus-command" oncommand="LatRus.toggleEnabled();" /> |
</commandset> |
<keyset id="latrus-keyset"> |
<key id="latrus-key" modifiers="accel,alt" key="L" command="latrus-command" /> |
</keyset> |
</window> |
<popup id="contentAreaContextMenu"> |
<menu id="context-latrus-submenu" label="LatRus" insertafter="spell-separator"> |
<menupopup id="context-latrus-menupopup"> |
<menuitem id="context-latrus-options" label="Options" |
oncommand="LatRus.showOptions()" /> |
</menupopup> |
</menu> |
<menuitem id="context-latrus-enabled" type="checkbox" label="Convert lat->rus" |
oncommand="LatRus.toggleEnabled();" insertafter="spell-separator" /> |
<!--menu id="context-latrus-submenu" insertafter="context-latrus-enabled"> |
<menupopup id="context-latrus-menupopup" /> |
</menu--> |
oncommand="LatRus.toggleEnabled();" insertafter="spell-separator" |
accessKey="L" key="latrus-key" /> |
</popup> |
<popup id="panel-latrus-popup"> |
<menuitem id="panel-latrus-options" label="Options" oncommand="LatRus.showOptions()" /> |
</popup> |
<statusbar id="status-bar"> |
<statusbarpanel id="latrus-panel" /> |
<statusbarpanel id="latrus-panel" onclick="if(event.button == 0) LatRus.toggleEnabled();" |
contextmenu="panel-latrus-popup"> |
</statusbarpanel> |
</statusbar> |
</overlay> |