/usr/share/doc/libjs-mochikit/examples/mouse_events/mouse_events.js is in libjs-mochikit 1.4.2-4fakesync1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | /*
Mouse Events: Simple Mouse Scrolling Handlers
*/
function showMouseEvent(evt) {
getElement("show-mouse-event-repr").innerHTML = repr(evt);
evt.stop();
};
function stopPageFromScrolling( event ) {
var src = event.src();
var scrollTop = src.scrollTop;
// While trying to stop scrolling events for IE, found that it
// jumped around a bit. The following fudgetFactor is NOT the way
// to handle this but was the best I could do with the limited time
// I had.
var fudgeFactor = /MSIE/.test(navigator.userAgent) ? 25 : 0;
// scrolling up
if (event.mouse().wheel.y < 0) {
// Following test should probably be "if (scrollTop == 0)" which
// works in FF but not IE.
if (scrollTop <= fudgeFactor) {
event.stop();
}
}
//..scrolling down
else {
// Following test should be "if (scrollTop == src.scrollHeight - src.clientHeight)",
// see comment above.
if (src.scrollHeight <= (scrollTop + src.clientHeight + fudgeFactor)) {
event.stop();
}
}
};
function connectEvents(){
connect("show-mouse-event", "onmousemove", showMouseEvent);
connect("show-mouse-event", "onmousedown", showMouseEvent);
connect("show-mouse-event", "onmouseup", showMouseEvent);
connect("show-mouse-event", "onmousewheel", showMouseEvent);
connect("no-scroll-page", "onmousewheel", stopPageFromScrolling);
};
connect(window, 'onload',
function() {
connectEvents();
var elems = getElementsByTagAndClassName("A", "view-source");
var page = "mouse_events/";
for (var i = 0; i < elems.length; i++) {
var elem = elems[i];
var href = elem.href.split(/\//).pop();
elem.target = "_blank";
elem.href = "../view-source/view-source.html#" + page + href;
}
});
|