1 //QuanLib: eBook Library
2 //(C) 2017 by Christian Jaekl (cejaekl@yahoo.com)
6 // Global state information (yuck). TODO: refactor this to compartmentalize.
8 mousePos: { // Last known position of the mouse cursor
17 document.onmousemove = onMouseMove;
19 BooksView.init(BooksModel);
20 PagingController.init(BooksModel);
21 SearchController.init(BooksModel);
26 // TODO: refactor this to compartmentalize more functionality.
28 function report(message) {
29 document.getElementById('books').innerHTML = message;
32 function onMouseMove(event) {
33 if (typeof event === 'undefined') {
40 if ( x === g_state.mousePos.x
41 && y === g_state.mousePos.y)
43 // No change from previous known position.
44 // Nothing to see (or do) here, move along.
48 // Remember current mouse (x,y) position
49 g_state.mousePos.x = x;
50 g_state.mousePos.y = y;
52 ToolTip.mouseMoved(x, y);
56 if (BooksModel.last < (BooksModel.count - 1)) {
57 PagingController.adjustPos(BooksModel.first + BooksModel.pageSize);
62 if (BooksModel.first > 0) {
63 PagingController.adjustPos(BooksModel.first - BooksModel.pageSize);
67 function onSlide(value) {
68 PagingController.adjustPos(value);
72 SearchController.onSearch();