4,13 → 4,12 |
enabled: false, |
showHint: false, |
hintPanelInited: false, |
lastKnownSelection: null, |
|
init: function() |
{ |
LatRus.worker = new LatRusWorker_Rus(); |
LatRus.setEnabled(LatRus.enabled); |
LatRus.setHint(LatRus.showHint); |
LatRus.setEnabled(false); |
LatRus.setHint(false); |
inited = true; |
}, |
|
27,13 → 26,6 |
aEvent.originalTarget.dispatchEvent(newEvent); |
}, |
|
onFocus: function(aEvent) |
{ |
if(aEvent.originalTarget.toString().indexOf("HTML") >= 0) { |
LatRus.lastKnownSelection = aEvent.originalTarget; |
} |
}, |
|
toggleEnabled: function() |
{ |
LatRus.setEnabled(!LatRus.enabled); |
156,7 → 148,7 |
|
this.diplayHintPart(this.worker.getForwardTable(), panel, "latrus_hint_forward"); |
this.diplayHintPart(this.worker.getBackwardTable(), panel, "latrus_hint_backward"); |
this.diplayHintPart(this.worker.getAdditionalTable(), panel, "latrus_hint_additional"); |
//this.diplayHintPart(this.worker.getAdditionalTable(), panel, "latrus_hint_additional"); |
|
LatRus.hintPanelInited = true; |
}, |
168,38 → 160,19 |
panel.removeChild(box); |
} |
|
for(var i = 0, l = table.length; i < l; ++i) { |
if(i % 32 == 0) { |
box = document.createElement("box"); |
box.setAttribute("id", boxId); |
panel.appendChild(box); |
} |
|
for(var i = 0, l = table.length; i < l; ++i) { |
var button = document.createElement("button"); |
button.setAttribute("label", table[i]); |
button.setAttribute("onclick", "LatRus.addLetterClick(this)"); |
//button.setAttribute("onclick", "LatRus.addLetterClick(this)"); |
button.setAttribute("class", "latrusHintLetterButton"); |
box.appendChild(button); |
} |
}, |
|
addLetterClick: function(button) |
{ |
if(LatRus.lastKnownSelection) { |
LatRus.lastKnownSelection.focus(); |
|
var newEvent = LatRus.lastKnownSelection.ownerDocument.createEvent("KeyEvents"); |
newEvent.initKeyEvent("keypress", true, true, null, |
false, false, false, false, 255, button.label.charCodeAt(0)); |
LatRus.lastKnownSelection.dispatchEvent(newEvent); |
} |
}, |
|
openInputBox: function() |
{ |
getBrowser().loadOneTab("chrome://latrus/content/input.html", null, null, null, false, false); |
}, |
|
showOptions: function() |
{ |
alert("latrus options"); |
209,7 → 182,6 |
/* REGISTER */ |
if(!LatRus.inited && !window.frameElement) { |
window.addEventListener('load', LatRus.init, false); |
window.addEventListener('focus', LatRus.onFocus, true); |
window.addEventListener('keypress', LatRus.onKeyPress, true); |
} |
|