From 3697dbd0aa1c4647fbbd6202b24fd43361643517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Betn=C3=A9r?= Date: Mon, 27 Mar 2006 21:12:28 +0000 Subject: [PATCH] playlist.js Click outside the "edit playlist name" box will end the edit and send the new name to the server Fixed a positioning error when the page is scrolled --- admin-root/playlist.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/admin-root/playlist.js b/admin-root/playlist.js index a033b654..0ad58d6d 100644 --- a/admin-root/playlist.js +++ b/admin-root/playlist.js @@ -83,7 +83,7 @@ var EditPlaylistName = { }, show: function () { input = $('edit_playlist_name'); - input.style.top = RicoUtil.toViewportPosition(el).y+ 'px'; + input.style.top = RicoUtil.toDocumentPosition(el).y+ 'px'; input.value = this.playlistName; input.style.display = 'block'; Field.activate(input); @@ -95,10 +95,20 @@ var EditPlaylistName = { GlobalEvents.removeListener(this); }, response: function (request) { + // Check that the save gave response 200 OK }, click: function (e) { + var x = Event.pointerX(e); + var y = Event.pointerY(e); + var el = $('edit_playlist_name'); + var pos = RicoUtil.toViewportPosition(el); + if ((x > pos.x) && (x < pos.x + el.offsetWidth) && + (y > pos.y) && (y < pos.y + el.offsetHeight)) { + // Click was in input box + return; + } if (EditPlaylistName.playlistId) { -// EditPlaylistName.save(); + EditPlaylistName.save(); } } }