<?xml version="1.0"?>

<!-- THIS IS BUSTED IN FIREFOX 7 - they've changed the way they do JAR files. -->

<!-- get this plugin instead -->

<!-- Break the Home/End keys on OSX to be like every other incorrect O/S -->

<!-- Instructions following or use this script (right-click to download) -->

<!--
Install thusly:
cd tempdir
cp /Applications/{Thunderbird|Firefox}.app/Contents/MacOS/chrome/toolkit.jar .
jar xvf toolkit.jar

Replace content/global/platformHTMLBindings.xml with this one (right-click to download)
jar cvf toolkit.jar content/
mv toolkit.jar /Applications/{Thunderbird|Firefox}.app/Contents/MacOS/chrome/

-->

<!-- tested on firefox 3.6 and thunderbird 3.1 (when will this be an option?) -->

<!-- for mozilla 5 browser and email client, content/global/platformHTMLBindings.xml has been moved -->
<!-- install as follows (or use this script (right-click to download)): -->
<!--
cd tempdir
cp /Applications/{Thunderbird|Firefox}/Contents/MacOS/omni.jar .
jar xf omni.jar chrome/toolkit/content/global/platformHTMLBindings.xml

Replace content/global/platformHTMLBindings.xml with this one (right-click to download)
jar uf omni.jar chrome/toolkit/content/global/platformHTMLBindings.xml
mv omni.jar /Applications/{Thunderbird|Firefox}/Contents/MacOS/

-->

<!-- mind thunderbird5 appears to be busted on osx lion—ymmv -->

<!-- your sponsor invites you to visit bloodnok.net ... -->

<bindings id="htmlBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<binding id="inputFields">
<handlers>
<handler event="keypress" keycode="VK_LEFT" command="cmd_charPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" command="cmd_charNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectCharPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectCharNext"/>

<!-- Cut/copy/paste/undo -->
<handler event="keypress" key="c" modifiers="accel" command="cmd_copy"/>
<handler event="keypress" key="x" modifiers="accel" command="cmd_cut"/>
<handler event="keypress" key="v" modifiers="accel" command="cmd_paste"/>
<handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift"/>
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
<handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>

<!-- added by KAM, 15 March 07 -->
<handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine"/>
<handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine"/>
<handler event="keypress" keycode="VK_HOME" modifiers="accel" command="cmd_moveTop"/>
<handler event="keypress" keycode="VK_END" modifiers="accel" command="cmd_moveBottom"/>
<handler event="keypress" keycode="VK_HOME" modifiers="accel,shift" command="cmd_selectTop"/>
<handler event="keypress" keycode="VK_END" modifiers="accel,shift" command="cmd_selectBottom"/>
<!-- end KAM additions -->

<handler event="keypress" keycode="VK_UP" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectBeginLine"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectEndLine"/>
<handler event="keypress" keycode="VK_UP" modifiers="accel" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="accel" command="cmd_endLine"/>

<handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_wordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_wordNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="alt,shift" command="cmd_selectWordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="alt,shift" command="cmd_selectWordNext"/>

<handler event="keypress" keycode="VK_LEFT" modifiers="accel" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="accel" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="accel,shift" command="cmd_selectBeginLine"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="accel,shift" command="cmd_selectEndLine"/>
<handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteWordBackward"/>
<handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteWordForward"/>

<handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
<handler event="keypress" key="b" modifiers="control" command="cmd_charPrevious"/>
<handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/>
<handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
<handler event="keypress" key="f" modifiers="control" command="cmd_charNext"/>
<handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
<handler event="keypress" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>
<handler event="keypress" key="n" modifiers="control" command="cmd_lineNext"/>
<handler event="keypress" key="p" modifiers="control" command="cmd_linePrevious"/>
<handler event="keypress" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/>
<handler event="keypress" key="w" modifiers="control" command="cmd_deleteWordBackward"/>
<handler event="keypress" key="v" modifiers="control" command="cmd_scrollPageDown"/>
</handlers>
</binding>

<binding id="textAreas">
<handlers>
<handler event="keypress" keycode="VK_LEFT" command="cmd_charPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" command="cmd_charNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectCharPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectCharNext"/>
<handler event="keypress" keycode="VK_UP" command="cmd_linePrevious"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_lineNext"/>
<handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectLinePrevious"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectLineNext"/>

<!-- Cut/copy/paste/undo -->
<handler event="keypress" key="c" modifiers="accel" command="cmd_copy"/>
<handler event="keypress" key="x" modifiers="accel" command="cmd_cut"/>
<handler event="keypress" key="v" modifiers="accel" command="cmd_paste"/>
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
<handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift"/>
<handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>

<!-- added by KAM, 15 March 07 -->
<handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine"/>
<handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine"/>
<handler event="keypress" keycode="VK_HOME" modifiers="accel" command="cmd_moveTop"/>
<handler event="keypress" keycode="VK_END" modifiers="accel" command="cmd_moveBottom"/>
<handler event="keypress" keycode="VK_HOME" modifiers="accel,shift" command="cmd_selectTop"/>
<handler event="keypress" keycode="VK_END" modifiers="accel,shift" command="cmd_selectBottom"/>
<!-- deleted by KAM -->
<!--
<handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop"/>
<handler event="keypress" keycode="VK_END" command="cmd_scrollBottom"/>
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_scrollTop"/>
<handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_scrollBottom"/>
-->
<!-- end KAM changes -->

<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_scrollPageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/>

<handler event="keypress" keycode="VK_UP" modifiers="accel" command="cmd_moveTop"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="accel" command="cmd_moveBottom"/>
<handler event="keypress" keycode="VK_UP" modifiers="accel,shift" command="cmd_selectTop"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="accel,shift" command="cmd_selectBottom"/>

<handler event="keypress" keycode="VK_UP" modifiers="alt" command="cmd_movePageUp"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="alt" command="cmd_movePageDown"/>
<handler event="keypress" keycode="VK_UP" modifiers="alt,shift" command="cmd_selectPageUp"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="alt,shift" command="cmd_selectPageDown"/>

<handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_wordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_wordNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="alt,shift" command="cmd_selectWordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="alt,shift" command="cmd_selectWordNext"/>

<handler event="keypress" keycode="VK_LEFT" modifiers="accel" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="accel" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="accel,shift" command="cmd_selectBeginLine"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="accel,shift" command="cmd_selectEndLine"/>
<handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteWordBackward"/>
<handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteWordForward"/>

<handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
<handler event="keypress" key="b" modifiers="control" command="cmd_charPrevious"/>
<handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/>
<handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
<handler event="keypress" key="f" modifiers="control" command="cmd_charNext"/>
<handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
<handler event="keypress" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>
<handler event="keypress" key="n" modifiers="control" command="cmd_lineNext"/>
<handler event="keypress" key="p" modifiers="control" command="cmd_linePrevious"/>
<handler event="keypress" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/>
<handler event="keypress" key="w" modifiers="control" command="cmd_deleteWordBackward"/>
<handler event="keypress" key="v" modifiers="control" command="cmd_scrollPageDown"/>
</handlers>
</binding>

<binding id="browser">
<handlers>
<handler event="draggesture">
<!--
nsDragAndDrop.startDrag(event, contentAreaDNDObserver);
-->

</handler>
<handler event="dragover">
<!--
nsDragAndDrop.dragOver(event, contentAreaDNDObserver);
-->

</handler>
<handler event="dragdrop">
<!--
nsDragAndDrop.drop(event, contentAreaDNDObserver);
-->

</handler>

<handler event="keypress" key=" " modifiers="shift" command="cmd_scrollPageUp"/>
<handler event="keypress" key=" " command="cmd_scrollPageDown"/>

<handler event="keypress" keycode="VK_UP" command="cmd_scrollLineUp"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_scrollLineDown"/>
<handler event="keypress" keycode="VK_LEFT" command="cmd_scrollLeft"/>
<handler event="keypress" keycode="VK_RIGHT" command="cmd_scrollRight"/>

<handler event="keypress" key="x" command="cmd_cut" modifiers="accel"/>
<handler event="keypress" key="c" command="cmd_copy" modifiers="accel"/>
<handler event="keypress" key="v" command="cmd_paste" modifiers="accel"/>
<handler event="keypress" key="z" command="cmd_undo" modifiers="accel"/>
<handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift"/>
<handler event="keypress" key="a" command="cmd_selectAll" modifiers="accel"/>

<handler event="keypress" key="/" command="cmd_findTypeText"/>
<handler event="keypress" key="'" command="cmd_findTypeLinks"/>
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_scrollPageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/>

<!-- added by bloodnok, 20 April 07 -->
<handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
<!-- deleted by bloodnok -->
<!--
<handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop"/>
<handler event="keypress" keycode="VK_END" command="cmd_scrollBottom"/>
-->
<!-- end bloodnok changes -->

<handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_wordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_wordNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="alt,shift" command="cmd_selectWordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="alt,shift" command="cmd_selectWordNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectCharPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectCharNext"/>
<handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectLinePrevious"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectLineNext"/>
<handler event="keypress" keycode="VK_UP" modifiers="accel" command="cmd_scrollTop"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="accel" command="cmd_scrollBottom"/>
</handlers>
</binding>

<binding id="editor">
<handlers>
<handler event="keypress" keycode="VK_LEFT" command="cmd_charPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" command="cmd_charNext"/>
<handler event="keypress" keycode="VK_LEFT" command="cmd_selectCharPrevious" modifiers="shift"/>
<handler event="keypress" keycode="VK_RIGHT" command="cmd_selectCharNext" modifiers="shift"/>
<handler event="keypress" keycode="VK_UP" command="cmd_linePrevious"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_lineNext"/>
<handler event="keypress" keycode="VK_UP" command="cmd_selectLinePrevious" modifiers="shift"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_selectLineNext" modifiers="shift"/>

<handler event="keypress" key="z" command="cmd_undo" modifiers="accel"/>
<handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift" />
<handler event="keypress" key="x" command="cmd_cut" modifiers="accel"/>
<handler event="keypress" key="c" command="cmd_copy" modifiers="accel"/>
<handler event="keypress" key="v" command="cmd_paste" modifiers="accel"/>
<handler event="keypress" key="a" command="cmd_selectAll" modifiers="accel"/>

<!-- added by bloodnok, 20 April 07 -->
<handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine"/>
<handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine"/>
<handler event="keypress" keycode="VK_HOME" modifiers="accel" command="cmd_moveTop"/>
<handler event="keypress" keycode="VK_END" modifiers="accel" command="cmd_moveBottom"/>
<handler event="keypress" keycode="VK_HOME" modifiers="accel,shift" command="cmd_selectTop"/>
<handler event="keypress" keycode="VK_END" modifiers="accel,shift" command="cmd_selectBottom"/>
<!-- deleted by bloodnok -->
<!--
<handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop"/>
<handler event="keypress" keycode="VK_END" command="cmd_scrollBottom"/>
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_scrollTop"/>
<handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_scrollBottom"/>
-->
<!-- end bloodnok changes -->

<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_scrollPageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/>

<handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_wordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_wordNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="shift,alt" command="cmd_selectWordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="shift,alt" command="cmd_selectWordNext"/>

<handler event="keypress" keycode="VK_LEFT" modifiers="accel" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="accel" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="accel,shift" command="cmd_selectBeginLine"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="accel,shift" command="cmd_selectEndLine"/>

<handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_deleteCharForward"/>

<handler event="keypress" keycode="VK_UP" modifiers="alt" command="cmd_movePageUp"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="alt" command="cmd_movePageDown"/>
<handler event="keypress" keycode="VK_UP" modifiers="alt,shift" command="cmd_selectPageUp"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="alt,shift" command="cmd_selectPageDown"/>

<handler event="keypress" keycode="VK_UP" modifiers="accel" command="cmd_moveTop"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="accel" command="cmd_moveBottom"/>
<handler event="keypress" keycode="VK_UP" modifiers="accel,shift" command="cmd_selectTop"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="accel,shift" command="cmd_selectBottom"/>

<handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteWordBackward"/>
<handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteWordForward"/>

<handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
<handler event="keypress" key="b" modifiers="control" command="cmd_charPrevious"/>
<handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/>
<handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
<handler event="keypress" key="f" modifiers="control" command="cmd_charNext"/>
<handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
<handler event="keypress" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>
<handler event="keypress" key="n" modifiers="control" command="cmd_lineNext"/>
<handler event="keypress" key="p" modifiers="control" command="cmd_linePrevious"/>
<handler event="keypress" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/>
<handler event="keypress" key="w" modifiers="control" command="cmd_deleteWordBackward"/>
<handler event="keypress" key="v" modifiers="control" command="cmd_scrollPageDown"/>
</handlers>
</binding>
</bindings>