Subversion Repositories general

Compare Revisions

Regard whitespace Rev 1334 → Rev 1335

/mozilla/latrus/trunk/src/chrome/content/latrus.js
4,12 → 4,13
enabled: false,
showHint: false,
hintPanelInited: false,
lastKnownSelection: null,
 
init: function()
{
LatRus.worker = new LatRusWorker_Rus();
LatRus.setEnabled(false);
LatRus.setHint(false);
LatRus.setEnabled(LatRus.enabled);
LatRus.setHint(LatRus.showHint);
inited = true;
},
 
26,6 → 27,13
aEvent.originalTarget.dispatchEvent(newEvent);
},
 
onFocus: function(aEvent)
{
if(aEvent.originalTarget.toString().indexOf("HTML") >= 0) {
LatRus.lastKnownSelection = aEvent.originalTarget;
}
},
 
toggleEnabled: function()
{
LatRus.setEnabled(!LatRus.enabled);
148,7 → 156,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;
},
160,19 → 168,38
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");
182,6 → 209,7
/* REGISTER */
if(!LatRus.inited && !window.frameElement) {
window.addEventListener('load', LatRus.init, false);
window.addEventListener('focus', LatRus.onFocus, true);
window.addEventListener('keypress', LatRus.onKeyPress, true);
}