forked from AuroraMiddleware/gtk
[broadway] Break out document setup into its own function
In the future we might have more documents (one per toplevel browser window).
This commit is contained in:
parent
06ad0f52e2
commit
05bda376f6
@ -660,6 +660,25 @@ function onMouseWheel(ev)
|
||||
return cancelEvent(ev);
|
||||
}
|
||||
|
||||
function setupDocument(document)
|
||||
{
|
||||
document.oncontextmenu = function () { return false; };
|
||||
document.onmousemove = onMouseMove;
|
||||
document.onmouseover = onMouseOver;
|
||||
document.onmouseout = onMouseOut;
|
||||
document.onmousedown = onMouseDown;
|
||||
document.onmouseup = onMouseUp;
|
||||
document.onkeydown = onKeyDown;
|
||||
document.onkeyup = onKeyUp;
|
||||
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener('DOMMouseScroll', onMouseWheel, false);
|
||||
document.addEventListener('mousewheel', onMouseWheel, false);
|
||||
} else if (document.attachEvent) {
|
||||
element.attachEvent("onmousewheel", onMouseWheel);
|
||||
}
|
||||
}
|
||||
|
||||
function connect()
|
||||
{
|
||||
var xhr = createXHR();
|
||||
@ -688,19 +707,5 @@ function connect()
|
||||
} else {
|
||||
alert("WebSocket not supported, input will not work!");
|
||||
}
|
||||
document.oncontextmenu = function () { return false; };
|
||||
document.onmousemove = onMouseMove;
|
||||
document.onmouseover = onMouseOver;
|
||||
document.onmouseout = onMouseOut;
|
||||
document.onmousedown = onMouseDown;
|
||||
document.onmouseup = onMouseUp;
|
||||
document.onkeydown = onKeyDown;
|
||||
document.onkeyup = onKeyUp;
|
||||
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener('DOMMouseScroll', onMouseWheel, false);
|
||||
document.addEventListener('mousewheel', onMouseWheel, false);
|
||||
} else if (document.attachEvent) {
|
||||
element.attachEvent("onmousewheel", onMouseWheel);
|
||||
}
|
||||
setupDocument(document);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user