X-Git-Url: http://jaekl.net/gitweb/?p=quanweb.git;a=blobdiff_plain;f=js%2FToolTip.js;fp=js%2FToolTip.js;h=0000000000000000000000000000000000000000;hp=5e88238f91eaf13ba40d29c262d4ca47363fa3b2;hb=13efcb823cde095d5562ac061ef5a859d91c0f70;hpb=222a53b5def154dcc59dbaad98404ea2930e8434 diff --git a/js/ToolTip.js b/js/ToolTip.js deleted file mode 100644 index 5e88238..0000000 --- a/js/ToolTip.js +++ /dev/null @@ -1,123 +0,0 @@ -// ======= -// ToolTip - -var ToolTip = (function () { - // ================= - // Private variables - var my = {}, - bookId = undefined, - milliSecs = 500, // time to wait before displaying tooltip - mousePos = { - x: undefined, - y: undefined - }, - threshold = 10, // number of pixels that mouse can move before tip is dismissed - timer = undefined; - - // ================ - // Public variables - my.booksModel = undefined; - - // ============== - // Public Methods - - // Set the book ID for the details pane, and then show it - my.displayDetails = function (newBookId) { - bookId = newBookId; - my.showDetails(); - }; - - // Hide the details pane, if it is currently visible - my.hideDetails = function () { - mousePos.x = undefined; - mousePos.y = undefined; - - var elem = document.getElementById('details'); - elem.innerHTML = ''; - elem.style.display = 'none'; - }; - - my.mouseMoved = function (x, y) { - // Is there an active tooltip? - if (typeof mousePos.x === 'undefined') { - // No active tooltip, so nothing further to do - return; - } - - var deltaX = Math.abs(x - mousePos.x); - var deltaY = Math.abs(y - mousePos.y); - - if ( (deltaX > threshold) - || (deltaY > threshold) ) - { - my.stopTooltipTimer(); - my.hideDetails(); - } - }; - - // Show the details pane - my.showDetails = function () { - var id = bookId; - var elem = document.getElementById('details'); - var index = BooksModel.map[id]; - var book = BooksModel.cache[index]; - var html = '
' + book.Title + '
' - + '' + ce(book.AuthorReading) + '
' + ce(book.Series) + ' ' + ce(book.Volume) + '